nir/spirv: tg4 requires a sampler
authorAlex Smith <asmith@feralinteractive.com>
Tue, 7 Nov 2017 10:52:48 +0000 (10:52 +0000)
committerAlex Smith <asmith@feralinteractive.com>
Mon, 13 Nov 2017 13:38:18 +0000 (13:38 +0000)
Gather operations in both GLSL and SPIR-V require a sampler. Fixes
gathers returning garbage when using separate texture/samplers (on AMD,
was using an invalid sampler descriptor).

Signed-off-by: Alex Smith <asmith@feralinteractive.com>
Cc: "17.2 17.3" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/compiler/nir/nir.h
src/compiler/spirv/spirv_to_nir.c

index c055d300b666e2cb35eda0725622fc92edd13744..f46f6147110acbffec5cbfe2b5cd12fa6d4604ba 100644 (file)
@@ -1222,7 +1222,6 @@ typedef struct {
     *    - nir_texop_txf_ms
     *    - nir_texop_txs
     *    - nir_texop_lod
-    *    - nir_texop_tg4
     *    - nir_texop_query_levels
     *    - nir_texop_texture_samples
     *    - nir_texop_samples_identical
index 93a515d731e0cf7a5976b4023442e7981fec1a89..027efab88d7091b3f07d37b80da8b95cfdd4124f 100644 (file)
@@ -1755,6 +1755,7 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode,
    case nir_texop_txb:
    case nir_texop_txl:
    case nir_texop_txd:
+   case nir_texop_tg4:
       /* These operations require a sampler */
       instr->sampler = nir_deref_var_clone(sampler, instr);
       break;
@@ -1762,7 +1763,6 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode,
    case nir_texop_txf_ms:
    case nir_texop_txs:
    case nir_texop_lod:
-   case nir_texop_tg4:
    case nir_texop_query_levels:
    case nir_texop_texture_samples:
    case nir_texop_samples_identical: