radv: fix gathering XFB info if there is dead outputs
The driver should still gather XFB info even if all XFB outputs are dead, otherwise the pipeline can't find the streamout shader. RADV should use vk_spirv_to_nir() at some point to reduce code duplication during SPIRV->NIR compilation. This fixes new dEQP-VK.transform_feedback.simple.*. Cc: mesa-stable Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17939>
This commit is contained in:
committed by
Marge Bot
parent
a35742c434
commit
e95531e101
@@ -654,6 +654,16 @@ lower_sincos(struct nir_builder *b, nir_instr *instr, void *_)
|
||||
return sincos->op == nir_op_fsin ? nir_fsin_amd(b, src) : nir_fcos_amd(b, src);
|
||||
}
|
||||
|
||||
static bool
|
||||
is_not_xfb_output(nir_variable *var, void *data)
|
||||
{
|
||||
if (var->data.mode != nir_var_shader_out)
|
||||
return true;
|
||||
|
||||
return !var->data.explicit_xfb_buffer &&
|
||||
!var->data.explicit_xfb_stride;
|
||||
}
|
||||
|
||||
nir_shader *
|
||||
radv_shader_spirv_to_nir(struct radv_device *device, const struct radv_pipeline_stage *stage,
|
||||
const struct radv_pipeline_key *key)
|
||||
@@ -837,9 +847,12 @@ radv_shader_spirv_to_nir(struct radv_device *device, const struct radv_pipeline_
|
||||
.use_layer_id_sysval = false,
|
||||
});
|
||||
|
||||
nir_remove_dead_variables_options dead_vars_opts = {
|
||||
.can_remove_var = is_not_xfb_output,
|
||||
};
|
||||
NIR_PASS(_, nir, nir_remove_dead_variables,
|
||||
nir_var_shader_in | nir_var_shader_out | nir_var_system_value | nir_var_mem_shared,
|
||||
NULL);
|
||||
&dead_vars_opts);
|
||||
|
||||
/* Variables can make nir_propagate_invariant more conservative
|
||||
* than it needs to be.
|
||||
@@ -851,6 +864,11 @@ radv_shader_spirv_to_nir(struct radv_device *device, const struct radv_pipeline_
|
||||
|
||||
NIR_PASS(_, nir, nir_lower_clip_cull_distance_arrays);
|
||||
|
||||
if (nir->info.stage == MESA_SHADER_VERTEX ||
|
||||
nir->info.stage == MESA_SHADER_TESS_EVAL ||
|
||||
nir->info.stage == MESA_SHADER_GEOMETRY)
|
||||
NIR_PASS_V(nir, nir_shader_gather_xfb_info);
|
||||
|
||||
NIR_PASS(_, nir, nir_lower_discard_or_demote, key->ps.lower_discard_to_demote);
|
||||
|
||||
nir_lower_doubles_options lower_doubles = nir->options->lower_doubles_options;
|
||||
@@ -1038,10 +1056,6 @@ radv_shader_spirv_to_nir(struct radv_device *device, const struct radv_pipeline_
|
||||
radv_optimize_nir(nir, false, false);
|
||||
}
|
||||
|
||||
if (nir->info.stage == MESA_SHADER_VERTEX ||
|
||||
nir->info.stage == MESA_SHADER_TESS_EVAL ||
|
||||
nir->info.stage == MESA_SHADER_GEOMETRY)
|
||||
NIR_PASS_V(nir, nir_shader_gather_xfb_info);
|
||||
|
||||
return nir;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user