mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 22:38:05 +02:00
nir/opt_access: fix getting variables in presence of similar bindings/desc
It's perfectly legal to declare multiple SSBOs that point to the same
binding/descriptor_set with different access mask. Currently, it will
always get the first one in the list that matches binding/desc_set
regardless of the access mask, but other variables might have different
access mask.
Fix this by being conservative if another variable uses the same
binding/desc_set because we can't get it reliably without adding
a new field to vulkan_resource_index.
This fixes rendering issues in Resident Evil Village with vkd3d-proton.
This bug has been uncovered by ("spirv: Don't remove variables used by
resource indexing intrinsics") because variables are no longer removed
No fossils-db changes.
Cc: 21.1 mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10692>
This commit is contained in:
parent
6eff881097
commit
1b1c726ca9
1 changed files with 14 additions and 3 deletions
|
|
@ -2411,6 +2411,9 @@ nir_binding nir_chase_binding(nir_src rsrc)
|
|||
|
||||
nir_variable *nir_get_binding_variable(nir_shader *shader, nir_binding binding)
|
||||
{
|
||||
nir_variable *binding_var = NULL;
|
||||
unsigned count = 0;
|
||||
|
||||
if (!binding.success)
|
||||
return NULL;
|
||||
|
||||
|
|
@ -2418,9 +2421,17 @@ nir_variable *nir_get_binding_variable(nir_shader *shader, nir_binding binding)
|
|||
return binding.var;
|
||||
|
||||
nir_foreach_variable_with_modes(var, shader, nir_var_mem_ubo | nir_var_mem_ssbo) {
|
||||
if (var->data.descriptor_set == binding.desc_set && var->data.binding == binding.binding)
|
||||
return var;
|
||||
if (var->data.descriptor_set == binding.desc_set && var->data.binding == binding.binding) {
|
||||
binding_var = var;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
/* Be conservative if another variable is using the same binding/desc_set
|
||||
* because the access mask might be different and we can't get it reliably.
|
||||
*/
|
||||
if (count > 1)
|
||||
return NULL;
|
||||
|
||||
return binding_var;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue