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;
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;
/**
* 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.
*/
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);
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;
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);