nir: Add NVIDIA-specific geometry shader opcodes
authorMary Guillemard <mary.guillemard@collabora.com>
Fri, 22 Sep 2023 16:30:51 +0000 (18:30 +0200)
committerMarge Bot <emma+marge@anholt.net>
Tue, 24 Oct 2023 22:21:18 +0000 (22:21 +0000)
Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25000>

src/compiler/nir/nir_divergence_analysis.c
src/compiler/nir/nir_gather_info.c
src/compiler/nir/nir_intrinsics.py

index 37ce3cc..ad34c4d 100644 (file)
@@ -608,6 +608,8 @@ visit_intrinsic(nir_shader *shader, nir_intrinsic_instr *instr)
    case nir_intrinsic_load_ray_flags:
    case nir_intrinsic_load_cull_mask:
    case nir_intrinsic_load_sysval_nv:
+   case nir_intrinsic_emit_vertex_nv:
+   case nir_intrinsic_end_primitive_nv:
    case nir_intrinsic_report_ray_intersection:
    case nir_intrinsic_rq_proceed:
    case nir_intrinsic_rq_load:
index eb0734e..40a5a42 100644 (file)
@@ -765,12 +765,14 @@ gather_intrinsic_info(nir_intrinsic_instr *instr, nir_shader *shader,
 
    case nir_intrinsic_end_primitive:
    case nir_intrinsic_end_primitive_with_counter:
+   case nir_intrinsic_end_primitive_nv:
       assert(shader->info.stage == MESA_SHADER_GEOMETRY);
       shader->info.gs.uses_end_primitive = 1;
       FALLTHROUGH;
 
    case nir_intrinsic_emit_vertex:
    case nir_intrinsic_emit_vertex_with_counter:
+   case nir_intrinsic_emit_vertex_nv:
       shader->info.gs.active_stream_mask |= 1 << nir_intrinsic_stream_id(instr);
 
       break;
index 576defa..4dfbc04 100644 (file)
@@ -1972,6 +1972,13 @@ intrinsic("ald_nv", dest_comp=0, src_comp=[1, 1], bit_sizes=[32],
 intrinsic("ast_nv", src_comp=[0, 1, 1],
           indices=[BASE, RANGE_BASE, RANGE, FLAGS], flags=[])
 
+# NVIDIA-specific Geometry Shader intrinsics.
+# These contain an additional integer source and destination with the primitive handle input/output.
+intrinsic("emit_vertex_nv", dest_comp=1, src_comp=[1], indices=[STREAM_ID])
+intrinsic("end_primitive_nv", dest_comp=1, src_comp=[1], indices=[STREAM_ID])
+# Contains the final primitive handle and indicate the end of emission.
+intrinsic("final_primitive_nv", src_comp=[1])
+
 # In order to deal with flipped render targets, gl_PointCoord may be flipped
 # in the shader requiring a shader key or extra instructions or it may be
 # flipped in hardware based on a state bit.  This version of gl_PointCoord