diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c index 36074afa268..b19c5487194 100644 --- a/src/compiler/nir/nir.c +++ b/src/compiler/nir/nir.c @@ -2501,6 +2501,8 @@ nir_intrinsic_from_system_value(gl_system_value val) return nir_intrinsic_load_mesh_view_count; case SYSTEM_VALUE_FRAG_SHADING_RATE: return nir_intrinsic_load_frag_shading_rate; + case SYSTEM_VALUE_FULLY_COVERED: + return nir_intrinsic_load_fully_covered; default: unreachable("system value does not directly correspond to intrinsic"); } @@ -2648,6 +2650,8 @@ nir_system_value_from_intrinsic(nir_intrinsic_op intrin) return SYSTEM_VALUE_FRAG_SHADING_RATE; case nir_intrinsic_load_mesh_view_count: return SYSTEM_VALUE_MESH_VIEW_COUNT; + case nir_intrinsic_load_fully_covered: + return SYSTEM_VALUE_FULLY_COVERED; default: unreachable("intrinsic doesn't produce a system value"); } diff --git a/src/compiler/nir/nir_divergence_analysis.c b/src/compiler/nir/nir_divergence_analysis.c index a8ca2ed45c9..96fd2534571 100644 --- a/src/compiler/nir/nir_divergence_analysis.c +++ b/src/compiler/nir/nir_divergence_analysis.c @@ -471,6 +471,7 @@ visit_intrinsic(nir_shader *shader, nir_intrinsic_instr *instr) case nir_intrinsic_load_point_coord: case nir_intrinsic_load_line_coord: case nir_intrinsic_load_frag_coord: + case nir_intrinsic_load_fully_covered: case nir_intrinsic_load_sample_pos: case nir_intrinsic_load_sample_pos_or_center: case nir_intrinsic_load_vertex_id_zero_base: diff --git a/src/compiler/nir/nir_gather_info.c b/src/compiler/nir/nir_gather_info.c index 66ffdbdd341..85034a55003 100644 --- a/src/compiler/nir/nir_gather_info.c +++ b/src/compiler/nir/nir_gather_info.c @@ -709,6 +709,7 @@ gather_intrinsic_info(nir_intrinsic_instr *instr, nir_shader *shader, case nir_intrinsic_load_invocation_id: case nir_intrinsic_load_frag_coord: case nir_intrinsic_load_frag_shading_rate: + case nir_intrinsic_load_fully_covered: case nir_intrinsic_load_point_coord: case nir_intrinsic_load_line_coord: case nir_intrinsic_load_front_face: diff --git a/src/compiler/nir/nir_intrinsics.py b/src/compiler/nir/nir_intrinsics.py index f72cdd19cfb..43e921068ef 100644 --- a/src/compiler/nir/nir_intrinsics.py +++ b/src/compiler/nir/nir_intrinsics.py @@ -1109,6 +1109,9 @@ intrinsic("store_stack", [0], intrinsic("load_frag_shading_rate", dest_comp=1, bit_sizes=[32], flags=[CAN_ELIMINATE, CAN_REORDER]) +# Whether the rasterized fragment is fully covered by the generating primitive. +system_value("fully_covered", dest_comp=1, bit_sizes=[1]) + # OpenCL printf instruction # First source is a deref to the format string # Second source is a deref to a struct containing the args diff --git a/src/compiler/shader_enums.c b/src/compiler/shader_enums.c index 15d1923562d..1778d7cf56c 100644 --- a/src/compiler/shader_enums.c +++ b/src/compiler/shader_enums.c @@ -338,6 +338,7 @@ gl_system_value_name(gl_system_value sysval) ENUM(SYSTEM_VALUE_TCS_HEADER_IR3), ENUM(SYSTEM_VALUE_REL_PATCH_ID_IR3), ENUM(SYSTEM_VALUE_FRAG_SHADING_RATE), + ENUM(SYSTEM_VALUE_FULLY_COVERED), }; STATIC_ASSERT(ARRAY_SIZE(names) == SYSTEM_VALUE_MAX); return NAME(sysval); diff --git a/src/compiler/shader_enums.h b/src/compiler/shader_enums.h index 2005098a95f..004e733e79b 100644 --- a/src/compiler/shader_enums.h +++ b/src/compiler/shader_enums.h @@ -869,6 +869,12 @@ typedef enum */ SYSTEM_VALUE_FRAG_SHADING_RATE, + /* + * Rasterized fragment is fully covered by the generating primitive + * (SPV_EXT_fragment_fully_covered). + */ + SYSTEM_VALUE_FULLY_COVERED, + SYSTEM_VALUE_MAX /**< Number of values */ } gl_system_value; diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c index bf3c86748ca..a09e51bd44a 100644 --- a/src/compiler/spirv/vtn_variables.c +++ b/src/compiler/spirv/vtn_variables.c @@ -1174,6 +1174,11 @@ vtn_get_builtin_location(struct vtn_builder *b, case SpvBuiltInCullPrimitiveEXT: *location = VARYING_SLOT_CULL_PRIMITIVE; break; + case SpvBuiltInFullyCoveredEXT: + *location = SYSTEM_VALUE_FULLY_COVERED; + set_mode_system_value(b, mode); + break; + default: vtn_fail("Unsupported builtin: %s (%u)", spirv_builtin_to_string(builtin), builtin);