mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-25 07:00:45 +02:00
nir/deref: Also optimize samplerND -> textureND casts
Reviewed-by: Jesse Natalie <jenatali@microsoft.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13389>
This commit is contained in:
parent
2ab5546a96
commit
b8a0bf2343
1 changed files with 7 additions and 4 deletions
|
|
@ -1012,14 +1012,17 @@ opt_remove_sampler_cast(nir_deref_instr *cast)
|
|||
cast_type = glsl_get_array_element(cast_type);
|
||||
}
|
||||
|
||||
if (glsl_type_is_array(parent_type) || glsl_type_is_array(cast_type))
|
||||
if (!glsl_type_is_sampler(parent_type))
|
||||
return false;
|
||||
|
||||
if (!glsl_type_is_sampler(parent_type) ||
|
||||
cast_type != glsl_bare_sampler_type())
|
||||
if (cast_type != glsl_bare_sampler_type() &&
|
||||
(glsl_type_is_bare_sampler(parent_type) ||
|
||||
cast_type != glsl_sampler_type_to_texture(parent_type)))
|
||||
return false;
|
||||
|
||||
/* We're a cast from a more detailed sampler type to a bare sampler */
|
||||
/* We're a cast from a more detailed sampler type to a bare sampler or a
|
||||
* texture type with the same dimensionality.
|
||||
*/
|
||||
nir_ssa_def_rewrite_uses(&cast->dest.ssa,
|
||||
&parent->dest.ssa);
|
||||
nir_instr_remove(&cast->instr);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue