intel/brw: fixup wm_prog_data_barycentric_modes()

Always select sample barycentric when persample dispatch is unknown at
compile time and let the payload adjustments feed the expected value
based on dispatch.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: mesa-stable
Reviewed-by: Ivan Briano <ivan.briano@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27803>
This commit is contained in:
Lionel Landwerlin
2024-04-18 09:54:11 +03:00
committed by Marge Bot
parent 48bf95ba96
commit 1bbe2d9833
4 changed files with 46 additions and 9 deletions
+12 -4
View File
@@ -1091,7 +1091,8 @@ fs_visitor::import_uniforms(fs_visitor *v)
}
enum brw_barycentric_mode
brw_barycentric_mode(nir_intrinsic_instr *intr)
brw_barycentric_mode(const struct brw_wm_prog_key *key,
nir_intrinsic_instr *intr)
{
const glsl_interp_mode mode =
(enum glsl_interp_mode) nir_intrinsic_interp_mode(intr);
@@ -1103,7 +1104,13 @@ brw_barycentric_mode(nir_intrinsic_instr *intr)
switch (intr->intrinsic) {
case nir_intrinsic_load_barycentric_pixel:
case nir_intrinsic_load_barycentric_at_offset:
bary = BRW_BARYCENTRIC_PERSPECTIVE_PIXEL;
/* When per sample interpolation is dynamic, assume sample
* interpolation. We'll dynamically remap things so that the FS thread
* payload is not affected.
*/
bary = key->persample_interp == BRW_SOMETIMES ?
BRW_BARYCENTRIC_PERSPECTIVE_SAMPLE :
BRW_BARYCENTRIC_PERSPECTIVE_PIXEL;
break;
case nir_intrinsic_load_barycentric_centroid:
bary = BRW_BARYCENTRIC_PERSPECTIVE_CENTROID;
@@ -3472,6 +3479,7 @@ is_used_in_not_interp_frag_coord(nir_def *def)
*/
static unsigned
brw_compute_barycentric_interp_modes(const struct intel_device_info *devinfo,
const struct brw_wm_prog_key *key,
const nir_shader *shader)
{
unsigned barycentric_interp_modes = 0;
@@ -3500,7 +3508,7 @@ brw_compute_barycentric_interp_modes(const struct intel_device_info *devinfo,
nir_intrinsic_op bary_op = intrin->intrinsic;
enum brw_barycentric_mode bary =
brw_barycentric_mode(intrin);
brw_barycentric_mode(key, intrin);
barycentric_interp_modes |= 1 << bary;
@@ -3700,7 +3708,7 @@ brw_nir_populate_wm_prog_data(nir_shader *shader,
prog_data->inner_coverage = shader->info.fs.inner_coverage;
prog_data->barycentric_interp_modes =
brw_compute_barycentric_interp_modes(devinfo, shader);
brw_compute_barycentric_interp_modes(devinfo, key, shader);
/* From the BDW PRM documentation for 3DSTATE_WM:
*