nir: Refactor tex_instr_dest_size to use a switch statement
authorJason Ekstrand <jason.ekstrand@intel.com>
Fri, 10 Apr 2015 04:03:02 +0000 (21:03 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 23 Apr 2015 01:10:40 +0000 (18:10 -0700)
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
src/glsl/nir/nir.h

index 74772c798256dc0f7e9b78a490b9da9467e4fabe..c07a95552cd66247f5dfe0bfec5efcab7e6005ef 100644 (file)
@@ -960,7 +960,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:
@@ -985,13 +986,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