spirv: Add plumbing for ray_cull_mask

Add a new cull_mask system value that is exposed
by the ray_cull_mask capability of
SPV_KHR_ray_cull_mask.

Signed-off-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16430>
This commit is contained in:
Konstantin Seurer 2022-05-10 16:10:31 +02:00 committed by Marge Bot
parent 7c44cb6f5e
commit 2e0e150e69
7 changed files with 16 additions and 0 deletions

View file

@ -2507,6 +2507,8 @@ nir_intrinsic_from_system_value(gl_system_value val)
return nir_intrinsic_load_ray_geometry_index;
case SYSTEM_VALUE_RAY_INSTANCE_CUSTOM_INDEX:
return nir_intrinsic_load_ray_instance_custom_index;
case SYSTEM_VALUE_CULL_MASK:
return nir_intrinsic_load_cull_mask;
case SYSTEM_VALUE_MESH_VIEW_COUNT:
return nir_intrinsic_load_mesh_view_count;
case SYSTEM_VALUE_FRAG_SHADING_RATE:
@ -2652,6 +2654,8 @@ nir_system_value_from_intrinsic(nir_intrinsic_op intrin)
return SYSTEM_VALUE_RAY_GEOMETRY_INDEX;
case nir_intrinsic_load_ray_instance_custom_index:
return SYSTEM_VALUE_RAY_INSTANCE_CUSTOM_INDEX;
case nir_intrinsic_load_cull_mask:
return SYSTEM_VALUE_CULL_MASK;
case nir_intrinsic_load_frag_shading_rate:
return SYSTEM_VALUE_FRAG_SHADING_RATE;
case nir_intrinsic_load_mesh_view_count:

View file

@ -856,6 +856,7 @@ system_value("ray_flags", 1)
system_value("ray_geometry_index", 1)
system_value("ray_instance_custom_index", 1)
system_value("shader_record_ptr", 1, bit_sizes=[64])
system_value("cull_mask", 1)
# Driver-specific viewport scale/offset parameters.
#

View file

@ -331,6 +331,7 @@ gl_system_value_name(gl_system_value sysval)
ENUM(SYSTEM_VALUE_RAY_HIT_KIND),
ENUM(SYSTEM_VALUE_RAY_FLAGS),
ENUM(SYSTEM_VALUE_RAY_GEOMETRY_INDEX),
ENUM(SYSTEM_VALUE_CULL_MASK),
ENUM(SYSTEM_VALUE_MESH_VIEW_COUNT),
ENUM(SYSTEM_VALUE_MESH_VIEW_INDICES),
ENUM(SYSTEM_VALUE_GS_HEADER_IR3),

View file

@ -825,6 +825,7 @@ typedef enum
SYSTEM_VALUE_RAY_FLAGS,
SYSTEM_VALUE_RAY_GEOMETRY_INDEX,
SYSTEM_VALUE_RAY_INSTANCE_CUSTOM_INDEX,
SYSTEM_VALUE_CULL_MASK,
/*@}*/
/**

View file

@ -81,6 +81,7 @@ struct spirv_supported_capabilities {
bool physical_storage_buffer_address;
bool post_depth_coverage;
bool printf;
bool ray_cull_mask;
bool ray_tracing;
bool ray_query;
bool ray_traversal_primitive_culling;

View file

@ -4789,6 +4789,10 @@ vtn_handle_preamble_instruction(struct vtn_builder *b, SpvOp opcode,
spv_check_supported(intel_subgroup_buffer_block_io, cap);
break;
case SpvCapabilityRayCullMaskKHR:
spv_check_supported(ray_cull_mask, cap);
break;
case SpvCapabilityRayTracingKHR:
spv_check_supported(ray_tracing, cap);
break;

View file

@ -1121,6 +1121,10 @@ vtn_get_builtin_location(struct vtn_builder *b,
*location = SYSTEM_VALUE_RAY_GEOMETRY_INDEX;
set_mode_system_value(b, mode);
break;
case SpvBuiltInCullMaskKHR:
*location = SYSTEM_VALUE_CULL_MASK;
set_mode_system_value(b, mode);
break;
case SpvBuiltInShadingRateKHR:
*location = SYSTEM_VALUE_FRAG_SHADING_RATE;
set_mode_system_value(b, mode);