dxil_nir_lower_int_cubemaps: When not lowering samplers, don't touch sampler types

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18025>
This commit is contained in:
Jesse Natalie 2022-08-11 18:47:33 -07:00 committed by Marge Bot
parent 34294bd9bb
commit f44ca247d4

View file

@ -27,7 +27,7 @@
#include "nir_builtin_builder.h"
static bool
type_needs_lowering(const struct glsl_type *type)
type_needs_lowering(const struct glsl_type *type, bool lower_samplers)
{
type = glsl_without_array(type);
if (!glsl_type_is_image(type) && !glsl_type_is_sampler(type))
@ -36,7 +36,7 @@ type_needs_lowering(const struct glsl_type *type)
return false;
if (glsl_type_is_image(type))
return true;
return glsl_base_type_is_integer(glsl_get_sampler_result_type(type));
return lower_samplers && glsl_base_type_is_integer(glsl_get_sampler_result_type(type));
}
static bool
@ -89,7 +89,7 @@ lower_int_cubmap_to_array_filter(const nir_instr *instr,
}
} else if (instr->type == nir_instr_type_deref) {
nir_deref_instr *deref = nir_instr_as_deref(instr);
return type_needs_lowering(deref->type);
return type_needs_lowering(deref->type, lower_samplers);
} else if (instr->type == nir_instr_type_tex && lower_samplers) {
nir_tex_instr *tex = nir_instr_as_tex(instr);
@ -570,7 +570,7 @@ dxil_nir_lower_int_cubemaps(nir_shader *s, bool lower_samplers)
if (result) {
nir_foreach_variable_with_modes_safe(var, s, nir_var_uniform | nir_var_image) {
if (!type_needs_lowering(var->type))
if (!type_needs_lowering(var->type, lower_samplers))
continue;
bool is_image = glsl_type_is_image(glsl_without_array(var->type));
var->type = make_2darray_from_cubemap_with_array(var->type, is_image);