[Mesa-dev] [PATCH 06/13] i965/vec4: remove the explicitly sized vec4_visitor src_reg ctor

Emil Velikov emil.l.velikov at gmail.com
Thu Nov 5 08:17:54 PST 2015


From: Emil Velikov <emil.velikov at collabora.co.uk>

Just default the size to 1, and let the compiler do its magic.

XXX: Not 100% sure this is correct.

Signed-off-by: Emil Velikov <emil.velikov at collabora.co.uk>
---
 src/mesa/drivers/dri/i965/brw_ir_vec4.h        |  3 +--
 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 19 +++----------------
 2 files changed, 4 insertions(+), 18 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_ir_vec4.h b/src/mesa/drivers/dri/i965/brw_ir_vec4.h
index b7a9004..e10c440 100644
--- a/src/mesa/drivers/dri/i965/brw_ir_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_ir_vec4.h
@@ -45,8 +45,7 @@ public:
 
    bool equals(const src_reg &r) const;
 
-   src_reg(class vec4_visitor *v, const struct glsl_type *type);
-   src_reg(class vec4_visitor *v, const struct glsl_type *type, int size);
+   src_reg(class vec4_visitor *v, const struct glsl_type *type, int size = 1);
 
    explicit src_reg(const dst_reg &reg);
 
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index 63455e8..debe1ed 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -628,12 +628,13 @@ type_size_vec4(const struct glsl_type *type)
    return 0;
 }
 
-src_reg::src_reg(class vec4_visitor *v, const struct glsl_type *type)
+src_reg::src_reg(class vec4_visitor *v, const struct glsl_type *type, int size)
 {
+   assert(size > 0);
    init();
 
    this->file = VGRF;
-   this->nr = v->alloc.allocate(type_size_vec4(type));
+   this->nr = v->alloc.allocate(type_size_vec4(type) * size);
 
    if (type->is_array() || type->is_record()) {
       this->swizzle = BRW_SWIZZLE_NOOP;
@@ -644,20 +645,6 @@ src_reg::src_reg(class vec4_visitor *v, const struct glsl_type *type)
    this->type = brw_type_for_base_type(type);
 }
 
-src_reg::src_reg(class vec4_visitor *v, const struct glsl_type *type, int size)
-{
-   assert(size > 0);
-
-   init();
-
-   this->file = VGRF;
-   this->nr = v->alloc.allocate(type_size_vec4(type) * size);
-
-   this->swizzle = BRW_SWIZZLE_NOOP;
-
-   this->type = brw_type_for_base_type(type);
-}
-
 dst_reg::dst_reg(class vec4_visitor *v, const struct glsl_type *type)
 {
    init();
-- 
2.6.2



More information about the mesa-dev mailing list