ac/nir,radv,radeonsi/nir: use correct indices for interpolation intrinsics
Fixes artifacts in World of Warcraft when Multi-sample Alpha-Test is
enabled with DXVK.
It also fixes artifacts with Fallout 4's god rays with DXVK.
Various piglit interpolateAt*() tests under NIR are also fixed.
v2: formatting fix
update commit message to include Fallout 4 and the Fixes tag
Fixes: f4e499ec79
('radv: add initial non-conformant radv vulkan driver')
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106595
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
This commit is contained in:
@@ -2838,7 +2838,7 @@ static LLVMValueRef visit_interp(struct ac_nir_context *ctx,
|
|||||||
LLVMValueRef src0 = NULL;
|
LLVMValueRef src0 = NULL;
|
||||||
|
|
||||||
nir_variable *var = nir_deref_instr_get_variable(nir_instr_as_deref(instr->src[0].ssa->parent_instr));
|
nir_variable *var = nir_deref_instr_get_variable(nir_instr_as_deref(instr->src[0].ssa->parent_instr));
|
||||||
int input_index = var->data.location - VARYING_SLOT_VAR0;
|
int input_index = ctx->abi->fs_input_attr_indices[var->data.location - VARYING_SLOT_VAR0];
|
||||||
switch (instr->intrinsic) {
|
switch (instr->intrinsic) {
|
||||||
case nir_intrinsic_interp_deref_at_centroid:
|
case nir_intrinsic_interp_deref_at_centroid:
|
||||||
location = INTERP_CENTROID;
|
location = INTERP_CENTROID;
|
||||||
|
@@ -77,6 +77,9 @@ struct ac_shader_abi {
|
|||||||
*/
|
*/
|
||||||
LLVMValueRef *inputs;
|
LLVMValueRef *inputs;
|
||||||
|
|
||||||
|
/* Varying -> attribute number mapping. Also NIR-only */
|
||||||
|
unsigned fs_input_attr_indices[MAX_VARYING];
|
||||||
|
|
||||||
void (*emit_outputs)(struct ac_shader_abi *abi,
|
void (*emit_outputs)(struct ac_shader_abi *abi,
|
||||||
unsigned max_outputs,
|
unsigned max_outputs,
|
||||||
LLVMValueRef *addrs);
|
LLVMValueRef *addrs);
|
||||||
|
@@ -2239,6 +2239,8 @@ handle_fs_inputs(struct radv_shader_context *ctx,
|
|||||||
|
|
||||||
if (LLVMIsUndef(interp_param))
|
if (LLVMIsUndef(interp_param))
|
||||||
ctx->shader_info->fs.flat_shaded_mask |= 1u << index;
|
ctx->shader_info->fs.flat_shaded_mask |= 1u << index;
|
||||||
|
if (i >= VARYING_SLOT_VAR0)
|
||||||
|
ctx->abi.fs_input_attr_indices[i - VARYING_SLOT_VAR0] = index;
|
||||||
++index;
|
++index;
|
||||||
} else if (i == VARYING_SLOT_CLIP_DIST0) {
|
} else if (i == VARYING_SLOT_CLIP_DIST0) {
|
||||||
int length = ctx->shader_info->info.ps.num_input_clips_culls;
|
int length = ctx->shader_info->info.ps.num_input_clips_culls;
|
||||||
|
@@ -1011,6 +1011,9 @@ bool si_nir_build_llvm(struct si_shader_context *ctx, struct nir_shader *nir)
|
|||||||
LLVMValueRef data[4];
|
LLVMValueRef data[4];
|
||||||
unsigned loc = variable->data.location;
|
unsigned loc = variable->data.location;
|
||||||
|
|
||||||
|
if (loc >= VARYING_SLOT_VAR0 && nir->info.stage == MESA_SHADER_FRAGMENT)
|
||||||
|
ctx->abi.fs_input_attr_indices[loc - VARYING_SLOT_VAR0] = input_idx / 4;
|
||||||
|
|
||||||
for (unsigned i = 0; i < attrib_count; i++) {
|
for (unsigned i = 0; i < attrib_count; i++) {
|
||||||
/* Packed components share the same location so skip
|
/* Packed components share the same location so skip
|
||||||
* them if we have already processed the location.
|
* them if we have already processed the location.
|
||||||
|
Reference in New Issue
Block a user