panvk: Wire robustness2 buffer info down to pan/bi

Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Christoph Pillmayer <christoph.pillmayer@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36198>
This commit is contained in:
Mary Guillemard 2025-07-17 13:57:42 +00:00 committed by Marge Bot
parent af5fb42080
commit 621f334a4c
3 changed files with 13 additions and 2 deletions

View file

@ -5437,7 +5437,7 @@ mem_vectorize_cb(unsigned align_mul, unsigned align_offset, unsigned bit_size,
}
static void
bi_optimize_nir(nir_shader *nir, unsigned gpu_id, bool is_blend)
bi_optimize_nir(nir_shader *nir, unsigned gpu_id, nir_variable_mode robust2_modes)
{
NIR_PASS(_, nir, nir_opt_shrink_stores, true);
@ -5474,6 +5474,7 @@ bi_optimize_nir(nir_shader *nir, unsigned gpu_id, bool is_blend)
progress, nir, nir_opt_load_store_vectorize,
&(const nir_load_store_vectorize_options){
.modes = nir_var_mem_global | nir_var_mem_shared | nir_var_shader_temp,
.robust_modes = robust2_modes,
.callback = mem_vectorize_cb,
});
NIR_PASS(progress, nir, nir_lower_pack);
@ -6472,7 +6473,7 @@ bifrost_compile_shader_nir(nir_shader *nir,
NIR_PASS(_, nir, bifrost_nir_lower_shader_output);
}
bi_optimize_nir(nir, inputs->gpu_id, inputs->is_blend);
bi_optimize_nir(nir, inputs->gpu_id, inputs->robust2_modes);
info->tls_size = nir->scratch_size;

View file

@ -105,6 +105,8 @@ struct pan_compile_inputs {
bool no_idvs;
uint32_t view_mask;
nir_variable_mode robust2_modes;
/* Mask of UBOs that may be moved to push constants */
uint32_t pushable_ubos;

View file

@ -1281,9 +1281,17 @@ panvk_compile_shader(struct panvk_device *dev,
return panvk_error(dev, VK_ERROR_OUT_OF_HOST_MEMORY);
shader->own_bin = true;
nir_variable_mode robust2_modes = 0;
if (info->robustness->uniform_buffers == VK_PIPELINE_ROBUSTNESS_BUFFER_BEHAVIOR_ROBUST_BUFFER_ACCESS_2_EXT)
robust2_modes |= nir_var_mem_ubo;
if (info->robustness->storage_buffers == VK_PIPELINE_ROBUSTNESS_BUFFER_BEHAVIOR_ROBUST_BUFFER_ACCESS_2_EXT)
robust2_modes |= nir_var_mem_ssbo;
struct pan_compile_inputs inputs = {
.gpu_id = phys_dev->kmod.props.gpu_id,
.view_mask = (state && state->rp) ? state->rp->view_mask : 0,
.robust2_modes = robust2_modes,
};
if (info->stage == MESA_SHADER_FRAGMENT && state != NULL &&