Mesa (master): spirv/nir: Refactor type handling in handle_texture

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


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

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

spirv/nir: Refactor type handling 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 | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c
index a0aeadf..284a2c8 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -1335,6 +1335,9 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode,
    } else {
       image_type = sampled.sampler->var->var->interface_type;
    }
+   const enum glsl_sampler_dim sampler_dim = glsl_get_sampler_dim(image_type);
+   const bool is_array = glsl_sampler_type_is_array(image_type);
+   const bool is_shadow = glsl_sampler_type_is_shadow(image_type);
 
    /* Figure out the base texture operation */
    nir_texop texop;
@@ -1485,11 +1488,11 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode,
 
    memcpy(instr->src, srcs, instr->num_srcs * sizeof(*instr->src));
 
-   instr->sampler_dim = glsl_get_sampler_dim(image_type);
-   instr->is_array = glsl_sampler_type_is_array(image_type);
-   instr->is_shadow = glsl_sampler_type_is_shadow(image_type);
-   instr->is_new_style_shadow = instr->is_shadow &&
-                                glsl_get_components(ret_type->type) == 1;
+   instr->sampler_dim = sampler_dim;
+   instr->is_array = is_array;
+   instr->is_shadow = is_shadow;
+   instr->is_new_style_shadow =
+      is_shadow && glsl_get_components(ret_type->type) == 1;
    instr->component = gather_component;
 
    if (has_coord) {




More information about the mesa-commit mailing list