nir_lower_readonly_images: Clear variable data when changing the type
For images, variable data includes the format. For samplers, variable
data is used for OpenCL inline samplers. When converting a variable
from one to the other, zero out the data so we don't accidentally
interpret a converted image as an inline sampler.
Fixes: fa677c86
("nir_lower_readonly_images_to_tex: Support non-CL semantics")
Acked-by: Enrico Galli <enrico.galli@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11674>
This commit is contained in:
parent
25ad69968b
commit
f8f2c3d835
|
@ -51,8 +51,10 @@ replace_image_type_with_sampler(nir_deref_instr *deref)
|
|||
deref->type = get_sampler_type_for_image(type);
|
||||
if (deref->deref_type == nir_deref_type_var) {
|
||||
type = deref->var->type;
|
||||
if (!glsl_type_is_sampler(glsl_without_array(type)))
|
||||
if (!glsl_type_is_sampler(glsl_without_array(type))) {
|
||||
deref->var->type = get_sampler_type_for_image(type);
|
||||
memset(&deref->var->data.sampler, 0, sizeof(deref->var->data.sampler));
|
||||
}
|
||||
} else {
|
||||
nir_deref_instr *parent = nir_deref_instr_parent(deref);
|
||||
if (parent)
|
||||
|
|
Loading…
Reference in New Issue