[Mesa-dev] [PATCH] glsl: set mask via initialization list rather than in constructor body

Timothy Arceri tarceri at itsqueeze.com
Sat May 20 05:05:51 UTC 2017


Potentially more efficient as is may avoid the struct being initialised
twice.
---
 src/compiler/glsl/ir.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/compiler/glsl/ir.cpp b/src/compiler/glsl/ir.cpp
index 123de99..e55635b 100644
--- a/src/compiler/glsl/ir.cpp
+++ b/src/compiler/glsl/ir.cpp
@@ -1583,24 +1583,23 @@ ir_swizzle::ir_swizzle(ir_rvalue *val, unsigned x, unsigned y, unsigned z,
 }
 
 ir_swizzle::ir_swizzle(ir_rvalue *val, const unsigned *comp,
 		       unsigned count)
    : ir_rvalue(ir_type_swizzle), val(val)
 {
    this->init_mask(comp, count);
 }
 
 ir_swizzle::ir_swizzle(ir_rvalue *val, ir_swizzle_mask mask)
-   : ir_rvalue(ir_type_swizzle)
+   : ir_rvalue(ir_type_swizzle), mask(mask)
 {
    this->val = val;
-   this->mask = mask;
    this->type = glsl_type::get_instance(val->type->base_type,
 					mask.num_components, 1);
 }
 
 #define X 1
 #define R 5
 #define S 9
 #define I 13
 
 ir_swizzle *
-- 
2.9.4



More information about the mesa-dev mailing list