brw: check if the FS needs vertex_attributes_bypass to be set

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34445>
This commit is contained in:
Iván Briano 2025-04-07 11:36:57 -07:00 committed by Marge Bot
parent c327b83706
commit acdd30a9da
4 changed files with 29 additions and 0 deletions

View file

@ -995,6 +995,8 @@ brw_nir_populate_wm_prog_data(nir_shader *shader,
const unsigned offset_bary_modes =
brw_compute_offset_barycentric_interp_modes(key, shader);
prog_data->vertex_attributes_bypass = brw_needs_vertex_attributes_bypass(shader);
prog_data->uses_npc_bary_coefficients =
offset_bary_modes & INTEL_BARYCENTRIC_NONPERSPECTIVE_BITS;
prog_data->uses_pc_bary_coefficients =

View file

@ -722,6 +722,13 @@ struct brw_wm_prog_data {
bool contains_flat_varying;
bool contains_noperspective_varying;
/** Fragment shader barycentrics
*
* Request that the HW delta computation of attributes be turned off. This is needed
* when the FS has per-vertex inputs or reads BaryCoordKHR/BaryCoordNoPerspKHR.
*/
bool vertex_attributes_bypass;
/** True if the shader wants sample shading
*
* This corresponds to whether or not a gl_SampleId, gl_SamplePosition, or

View file

@ -675,6 +675,25 @@ lower_indirect_primitive_id(nir_builder *b,
return true;
}
bool
brw_needs_vertex_attributes_bypass(const nir_shader *shader)
{
/* Even if there are no actual per-vertex inputs, if the fragment
* shader uses BaryCoord*, we need to set everything accordingly
* so the barycentrics don't get reordered.
*/
if (BITSET_TEST(shader->info.system_values_read, SYSTEM_VALUE_BARYCENTRIC_LINEAR_COORD) ||
BITSET_TEST(shader->info.system_values_read, SYSTEM_VALUE_BARYCENTRIC_PERSP_COORD))
return true;
nir_foreach_shader_in_variable(var, shader) {
if (var->data.per_vertex)
return true;
}
return false;
}
void
brw_nir_lower_fs_inputs(nir_shader *nir,
const struct intel_device_info *devinfo,

View file

@ -181,6 +181,7 @@ bool brw_nir_lower_cs_intrinsics(nir_shader *nir,
const struct intel_device_info *devinfo,
struct brw_cs_prog_data *prog_data);
bool brw_nir_lower_alpha_to_coverage(nir_shader *shader);
bool brw_needs_vertex_attributes_bypass(const nir_shader *shader);
bool brw_nir_lower_fs_msaa(nir_shader *shader,
const struct brw_wm_prog_key *key);