mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 13:10:10 +01:00
nir/deref: don't replace casts with deref_struct if we'd lose the stride
The result might be used in a deref_ptr_as_array, which requires a proper
stride within lower_explicit_io. If we'd lose that information or end up
with a different stride don't execute this optimization.
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8289
Fixes: b779baa9bf ("nir/deref: fix struct wrapper casts. (v3)")
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21458>
This commit is contained in:
parent
fa9a8c85e2
commit
56a9aad401
1 changed files with 6 additions and 1 deletions
|
|
@ -1143,7 +1143,12 @@ opt_replace_struct_wrapper_cast(nir_builder *b, nir_deref_instr *cast)
|
|||
if (glsl_get_struct_field_offset(parent->type, 0) != 0)
|
||||
return false;
|
||||
|
||||
if (cast->type != glsl_get_struct_field(parent->type, 0))
|
||||
const struct glsl_type *field_type = glsl_get_struct_field(parent->type, 0);
|
||||
if (cast->type != field_type)
|
||||
return false;
|
||||
|
||||
/* we can't drop the stride information */
|
||||
if (cast->cast.ptr_stride != glsl_get_explicit_stride(field_type))
|
||||
return false;
|
||||
|
||||
nir_deref_instr *replace = nir_build_deref_struct(b, parent, 0);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue