nir: Add new GS intrinsics that maintain a count of emitted vertices.
This patch also introduces a lowering pass to convert the simple GS intrinsics to the new ones. See the comments above that for the rationale behind the new intrinsics. This should be useful for i965; it's a generic enough mechanism that I could see other drivers potentially using it as well, so I don't feel too bad about putting it in the generic code. v2: - Use nir_after_block_before_jump for the cursor (caught by Jason Ekstrand - I'd mistakenly used nir_after_block when rebasing this code onto the new NIR control flow API). - Remove the old emit_vertex intrinsic at the end, rather than in the middle (requested by Jason). - Use state->... directly rather than locals (requested by Jason). - Report progress from nir_lower_gs_intrinsics() (requested by me). - Remove "Authors:" section from file comment (requested by Michael Schellenberger Costa). Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
This commit is contained in:
@@ -79,9 +79,30 @@ BARRIER(memory_barrier)
|
||||
/** A conditional discard, with a single boolean source. */
|
||||
INTRINSIC(discard_if, 1, ARR(1), false, 0, 0, 0, 0)
|
||||
|
||||
/**
|
||||
* Basic Geometry Shader intrinsics.
|
||||
*
|
||||
* emit_vertex implements GLSL's EmitStreamVertex() built-in. It takes a single
|
||||
* index, which is the stream ID to write to.
|
||||
*
|
||||
* end_primitive implements GLSL's EndPrimitive() built-in.
|
||||
*/
|
||||
INTRINSIC(emit_vertex, 0, ARR(), false, 0, 0, 1, 0)
|
||||
INTRINSIC(end_primitive, 0, ARR(), false, 0, 0, 1, 0)
|
||||
|
||||
/**
|
||||
* Geometry Shader intrinsics with a vertex count.
|
||||
*
|
||||
* Alternatively, drivers may implement these intrinsics, and use
|
||||
* nir_lower_gs_intrinsics() to convert from the basic intrinsics.
|
||||
*
|
||||
* These maintain a count of the number of vertices emitted, as an additional
|
||||
* unsigned integer source.
|
||||
*/
|
||||
INTRINSIC(emit_vertex_with_counter, 1, ARR(1), false, 0, 0, 1, 0)
|
||||
INTRINSIC(end_primitive_with_counter, 1, ARR(1), false, 0, 0, 1, 0)
|
||||
INTRINSIC(set_vertex_count, 1, ARR(1), false, 0, 0, 0, 0)
|
||||
|
||||
/*
|
||||
* Atomic counters
|
||||
*
|
||||
|
Reference in New Issue
Block a user