nir/fold_16bit_sampler_conversions: add a mask for supported sampler dims

AMD might not support cubes, but that doesn't mean cubes can't be used
on other drivers

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15852>
This commit is contained in:
Mike Blumenkrantz
2022-04-11 08:52:24 -04:00
committed by Marge Bot
parent 324b2ae5f2
commit 27a43b531b
4 changed files with 13 additions and 6 deletions

View File

@@ -5219,7 +5219,7 @@ bool nir_force_mediump_io(nir_shader *nir, nir_variable_mode modes,
nir_alu_type types);
bool nir_unpack_16bit_varying_slots(nir_shader *nir, nir_variable_mode modes);
bool nir_fold_16bit_sampler_conversions(nir_shader *nir,
unsigned tex_src_types);
unsigned tex_src_types, uint32_t sampler_dims);
typedef struct {
bool legalize_type; /* whether this src should be legalized */

View File

@@ -422,7 +422,8 @@ replace_with_mov(nir_builder *b, nir_instr *instr, nir_src *src,
*/
bool
nir_fold_16bit_sampler_conversions(nir_shader *nir,
unsigned tex_src_types)
unsigned tex_src_types,
uint32_t sampler_dims)
{
bool changed = false;
nir_function_impl *impl = nir_shader_get_entrypoint(nir);
@@ -444,10 +445,9 @@ nir_fold_16bit_sampler_conversions(nir_shader *nir,
if (tex->is_sparse)
continue;
/* Skip because AMD doesn't support 16-bit types with these. */
if ((tex->op == nir_texop_txs ||
tex->op == nir_texop_query_levels) ||
tex->sampler_dim == GLSL_SAMPLER_DIM_CUBE)
!(sampler_dims & BITFIELD_BIT(tex->sampler_dim)))
continue;
/* Optimize source operands. */