[Mesa-dev] [PATCH 02/12] nir: Refactor tex_instr_dest_size to use a switch statement

Jason Ekstrand jason at jlekstrand.net
Fri Apr 10 17:48:45 PDT 2015


---
 src/glsl/nir/nir.h | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h
index f9ca0f7..9e62f13 100644
--- a/src/glsl/nir/nir.h
+++ b/src/glsl/nir/nir.h
@@ -959,7 +959,8 @@ typedef struct {
 static inline unsigned
 nir_tex_instr_dest_size(nir_tex_instr *instr)
 {
-   if (instr->op == nir_texop_txs) {
+   switch (instr->op) {
+   case nir_texop_txs: {
       unsigned ret;
       switch (instr->sampler_dim) {
          case GLSL_SAMPLER_DIM_1D:
@@ -984,13 +985,15 @@ nir_tex_instr_dest_size(nir_tex_instr *instr)
       return ret;
    }
 
-   if (instr->op == nir_texop_query_levels)
+   case nir_texop_query_levels:
       return 2;
 
-   if (instr->is_shadow && instr->is_new_style_shadow)
-      return 1;
+   default:
+      if (instr->is_shadow && instr->is_new_style_shadow)
+         return 1;
 
-   return 4;
+      return 4;
+   }
 }
 
 static inline unsigned
-- 
2.3.5



More information about the mesa-dev mailing list