Mesa (master): spirv/nir: Move opcode selection higher up in handle_texture

Jason Ekstrand jekstrand at kemper.freedesktop.org
Fri Jul 22 23:33:09 UTC 2016


Module: Mesa
Branch: master
Commit: 561be50a1ac63cd2f157cf6d305569e5a33f12da
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=561be50a1ac63cd2f157cf6d305569e5a33f12da

Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date:   Thu Jul 21 11:47:44 2016 -0700

spirv/nir: Move opcode selection higher up in handle_texture

Signed-off-by: Jason Ekstrand <jason at jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Cc: "12.0" <mesa-dev at lists.freedesktop.org>

---

 src/compiler/spirv/spirv_to_nir.c | 96 +++++++++++++++++++--------------------
 1 file changed, 48 insertions(+), 48 deletions(-)

diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c
index 6654f5f..a0aeadf 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -1336,6 +1336,54 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode,
       image_type = sampled.sampler->var->var->interface_type;
    }
 
+   /* Figure out the base texture operation */
+   nir_texop texop;
+   switch (opcode) {
+   case SpvOpImageSampleImplicitLod:
+   case SpvOpImageSampleDrefImplicitLod:
+   case SpvOpImageSampleProjImplicitLod:
+   case SpvOpImageSampleProjDrefImplicitLod:
+      texop = nir_texop_tex;
+      break;
+
+   case SpvOpImageSampleExplicitLod:
+   case SpvOpImageSampleDrefExplicitLod:
+   case SpvOpImageSampleProjExplicitLod:
+   case SpvOpImageSampleProjDrefExplicitLod:
+      texop = nir_texop_txl;
+      break;
+
+   case SpvOpImageFetch:
+      if (glsl_get_sampler_dim(image_type) == GLSL_SAMPLER_DIM_MS) {
+         texop = nir_texop_txf_ms;
+      } else {
+         texop = nir_texop_txf;
+      }
+      break;
+
+   case SpvOpImageGather:
+   case SpvOpImageDrefGather:
+      texop = nir_texop_tg4;
+      break;
+
+   case SpvOpImageQuerySizeLod:
+   case SpvOpImageQuerySize:
+      texop = nir_texop_txs;
+      break;
+
+   case SpvOpImageQueryLod:
+      texop = nir_texop_lod;
+      break;
+
+   case SpvOpImageQueryLevels:
+      texop = nir_texop_query_levels;
+      break;
+
+   case SpvOpImageQuerySamples:
+   default:
+      unreachable("Unhandled opcode");
+   }
+
    nir_tex_src srcs[8]; /* 8 should be enough */
    nir_tex_src *p = srcs;
 
@@ -1393,54 +1441,6 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode,
    if (opcode == SpvOpImageQuerySizeLod)
       (*p++) = vtn_tex_src(b, w[idx++], nir_tex_src_lod);
 
-   /* Figure out the base texture operation */
-   nir_texop texop;
-   switch (opcode) {
-   case SpvOpImageSampleImplicitLod:
-   case SpvOpImageSampleDrefImplicitLod:
-   case SpvOpImageSampleProjImplicitLod:
-   case SpvOpImageSampleProjDrefImplicitLod:
-      texop = nir_texop_tex;
-      break;
-
-   case SpvOpImageSampleExplicitLod:
-   case SpvOpImageSampleDrefExplicitLod:
-   case SpvOpImageSampleProjExplicitLod:
-   case SpvOpImageSampleProjDrefExplicitLod:
-      texop = nir_texop_txl;
-      break;
-
-   case SpvOpImageFetch:
-      if (glsl_get_sampler_dim(image_type) == GLSL_SAMPLER_DIM_MS) {
-         texop = nir_texop_txf_ms;
-      } else {
-         texop = nir_texop_txf;
-      }
-      break;
-
-   case SpvOpImageGather:
-   case SpvOpImageDrefGather:
-      texop = nir_texop_tg4;
-      break;
-
-   case SpvOpImageQuerySizeLod:
-   case SpvOpImageQuerySize:
-      texop = nir_texop_txs;
-      break;
-
-   case SpvOpImageQueryLod:
-      texop = nir_texop_lod;
-      break;
-
-   case SpvOpImageQueryLevels:
-      texop = nir_texop_query_levels;
-      break;
-
-   case SpvOpImageQuerySamples:
-   default:
-      unreachable("Unhandled opcode");
-   }
-
    /* Now we need to handle some number of optional arguments */
    if (idx < count) {
       uint32_t operands = w[idx++];




More information about the mesa-commit mailing list