nir: Add NVIDIA-specific geometry shader opcodes

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>
This commit is contained in:
Mary Guillemard 2023-09-22 18:30:51 +02:00 committed by Marge Bot
parent 1fa7c37a36
commit 5308378a35
3 changed files with 11 additions and 0 deletions

View 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:

View 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;

View 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