From: Emil Velikov <emil.veli...@collabora.co.uk> Just fold the brw_type_for_base_type() and use a delegated constructor.
Note this is a c++11 feature and the compiler will warn us if it's set/defaults to an earlier version of the standard. XXX: Should we just toggle c++11 on ? We seem to be using some of its functionality already (anonymous unions) and we could even simplify gallium/nouveau a bit. Signed-off-by: Emil Velikov <emil.veli...@collabora.co.uk> --- src/mesa/drivers/dri/i965/brw_ir_vec4.h | 8 ++++++-- src/mesa/drivers/dri/i965/brw_vec4.cpp | 11 ----------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_ir_vec4.h b/src/mesa/drivers/dri/i965/brw_ir_vec4.h index 8d3efea..b7a9004 100644 --- a/src/mesa/drivers/dri/i965/brw_ir_vec4.h +++ b/src/mesa/drivers/dri/i965/brw_ir_vec4.h @@ -103,11 +103,15 @@ public: void init(); dst_reg(); - dst_reg(enum brw_reg_file file, int nr, const glsl_type *type, - unsigned writemask); + dst_reg(enum brw_reg_file file, int nr, brw_reg_type type = BRW_REGISTER_TYPE_UD, unsigned writemask = WRITEMASK_XYZW); + + dst_reg(enum brw_reg_file file, int nr, const glsl_type *type, + unsigned writemask) : + dst_reg(file, nr, brw_type_for_base_type(type), writemask) {} + dst_reg(struct brw_reg reg); dst_reg(class vec4_visitor *v, const struct glsl_type *type); diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp index 39d4a68..e348f17 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp @@ -99,17 +99,6 @@ dst_reg::dst_reg() init(); } -dst_reg::dst_reg(enum brw_reg_file file, int nr, const glsl_type *type, - unsigned writemask) -{ - init(); - - this->file = file; - this->nr = nr; - this->type = brw_type_for_base_type(type); - this->writemask = writemask; -} - dst_reg::dst_reg(enum brw_reg_file file, int nr, brw_reg_type type, unsigned writemask) { -- 2.6.2 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev