intel/fs: Set NonPerspectiveBarycentricEnable when the interpolator needs it.

[anholt: changed to make all drivers do the right thing by moving the
payload barycentric check into the compiler]

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17381>
This commit is contained in:
Lionel Landwerlin
2022-07-07 12:24:38 +03:00
committed by Marge Bot
parent 075564c251
commit 2d1f021e16
6 changed files with 22 additions and 10 deletions

View File

@@ -6732,9 +6732,7 @@ crocus_upload_dirty_render_state(struct crocus_context *ice,
cl.UserClipDistanceCullTestEnableBitmask =
brw_vue_prog_data(ice->shaders.prog[MESA_SHADER_VERTEX]->prog_data)->cull_distance_mask;
if (wm_prog_data->barycentric_interp_modes &
BRW_BARYCENTRIC_NONPERSPECTIVE_BITS)
cl.NonPerspectiveBarycentricEnable = true;
cl.NonPerspectiveBarycentricEnable = wm_prog_data->uses_nonperspective_interp_modes;
cl.ForceZeroRTAIndexEnable = cso_fb->layers <= 1;
cl.MaximumVPIndex = ice->state.num_viewports - 1;

View File

@@ -6332,9 +6332,7 @@ iris_upload_dirty_render_state(struct iris_context *ice,
cl.PerspectiveDivideDisable = ice->state.window_space_position;
cl.ViewportXYClipTestEnable = !points_or_lines;
if (wm_prog_data->barycentric_interp_modes &
BRW_BARYCENTRIC_NONPERSPECTIVE_BITS)
cl.NonPerspectiveBarycentricEnable = true;
cl.NonPerspectiveBarycentricEnable = wm_prog_data->uses_nonperspective_interp_modes;
cl.ForceZeroRTAIndexEnable = cso_fb->layers <= 1;
cl.MaximumVPIndex = ice->state.num_viewports - 1;

View File

@@ -889,10 +889,17 @@ struct brw_wm_prog_data {
/**
* Mask of which interpolation modes are required by the fragment shader.
* Used in hardware setup on gfx6+.
* Those interpolations are delivered as part of the thread payload. Used
* in hardware setup on gfx6+.
*/
uint32_t barycentric_interp_modes;
/**
* Whether nonperspective interpolation modes are used by the
* barycentric_interp_modes or fragment shader through interpolator messages.
*/
bool uses_nonperspective_interp_modes;
/**
* Mask of which FS inputs are marked flat by the shader source. This is
* needed for setting up 3DSTATE_SF/SBE.

View File

@@ -7277,6 +7277,9 @@ brw_nir_populate_wm_prog_data(const nir_shader *shader,
prog_data->barycentric_interp_modes =
brw_compute_barycentric_interp_modes(devinfo, shader);
prog_data->uses_nonperspective_interp_modes |=
(prog_data->barycentric_interp_modes &
BRW_BARYCENTRIC_NONPERSPECTIVE_BITS) != 0;
/* You can't be coarse and per-sample */
assert(!key->coarse_pixel || !key->persample_interp);

View File

@@ -2168,7 +2168,14 @@ emit_pixel_interpolater_send(const fs_builder &bld,
fs_inst *inst = bld.emit(opcode, dst, src, desc);
/* 2 floats per slot returned */
inst->size_written = 2 * dst.component_size(inst->exec_size);
inst->pi_noperspective = interpolation == INTERP_MODE_NOPERSPECTIVE;
if (interpolation == INTERP_MODE_NOPERSPECTIVE) {
inst->pi_noperspective = true;
/* TGL BSpec says:
* This field cannot be set to "Linear Interpolation"
* unless Non-Perspective Barycentric Enable in 3DSTATE_CLIP is enabled"
*/
wm_prog_data->uses_nonperspective_interp_modes = true;
}
wm_prog_data->pulls_bary = true;

View File

@@ -1543,8 +1543,7 @@ emit_3dstate_clip(struct anv_graphics_pipeline *pipeline,
clip.ViewportZClipTestEnable = pipeline->depth_clip_enable;
#else
clip.NonPerspectiveBarycentricEnable = wm_prog_data ?
(wm_prog_data->barycentric_interp_modes &
BRW_BARYCENTRIC_NONPERSPECTIVE_BITS) != 0 : 0;
wm_prog_data->uses_nonperspective_interp_modes : 0;
#endif
GENX(3DSTATE_CLIP_pack)(NULL, pipeline->gfx7.clip, &clip);