intel/brw: Recreate GS output registers after EmitVertex
Geometry shaders write outputs multiple times, with EmitVertex() between them. The value of output variables becomes undefined after calling EmitVertex(), so we don't need to preserve those. This lets us recreate new registers after each EmitVertex(), assuming we aren't in control flow, allowing them to have separate live ranges. It also means that those registers are more likely to be written once, rather than having multiple writes, which can make optimization easier. This is pretty much a total hack, but it's helpful. Reviewed-by: Caio Oliveira <caio.oliveira@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29624>
This commit is contained in:
@@ -3161,6 +3161,13 @@ fs_nir_emit_gs_intrinsic(nir_to_brw_state &ntb,
|
||||
|
||||
case nir_intrinsic_emit_vertex_with_counter:
|
||||
emit_gs_vertex(ntb, instr->src[0], nir_intrinsic_stream_id(instr));
|
||||
|
||||
/* After an EmitVertex() call, the values of all outputs are undefined.
|
||||
* If this is not in control flow, recreate a fresh set of output
|
||||
* registers to keep their live ranges separate.
|
||||
*/
|
||||
if (instr->instr.block->cf_node.parent->type == nir_cf_node_function)
|
||||
fs_nir_setup_outputs(ntb);
|
||||
break;
|
||||
|
||||
case nir_intrinsic_end_primitive_with_counter:
|
||||
|
Reference in New Issue
Block a user