spirv: Add a debug option to force non uniform texture sampling
authorKonstantin Seurer <konstantin.seurer@gmail.com>
Sat, 10 Dec 2022 11:36:57 +0000 (12:36 +0100)
committerMarge Bot <emma+marge@anholt.net>
Mon, 12 Dec 2022 18:18:32 +0000 (18:18 +0000)
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20243>

src/compiler/spirv/nir_spirv.h
src/compiler/spirv/spirv_to_nir.c

index 765a005..5c28bc2 100644 (file)
@@ -110,6 +110,9 @@ struct spirv_to_nir_options {
                    const char *message);
       void *private_data;
    } debug;
+
+   /* Force texture sampling to be non-uniform. */
+   bool force_tex_non_uniform;
 };
 
 bool gl_spirv_validation(const uint32_t *words, size_t word_count,
index 41adaa1..5f60227 100644 (file)
@@ -3104,6 +3104,9 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode,
    if (operands & SpvImageOperandsNontemporalMask)
       access |= ACCESS_STREAM_CACHE_POLICY;
 
+   if (sampler && b->options->force_tex_non_uniform)
+      access |= ACCESS_NON_UNIFORM;
+
    if (sampled_val->propagated_non_uniform)
       access |= ACCESS_NON_UNIFORM;