ir_to_mesa.cpp: Fix missing types on some ir_swizzles.
authorEric Anholt <eric@anholt.net>
Tue, 4 May 2010 00:08:01 +0000 (17:08 -0700)
committerEric Anholt <eric@anholt.net>
Tue, 4 May 2010 00:09:31 +0000 (17:09 -0700)
Debugging this took forever as I only looked at constructors in ir.cpp
to find who wasn't setting up ->type.  I dislike hiding code (as
opposed to prototypes and definitions) in C++ header files, but in
this case I have only myself to blame.

ir.cpp
ir.h

diff --git a/ir.cpp b/ir.cpp
index 6778997ac837fe43f617c96bfc37c465c399df2f..d2d8b4015b753be18e8ab5ab6302c93b0a875191 100644 (file)
--- a/ir.cpp
+++ b/ir.cpp
@@ -307,6 +307,14 @@ ir_swizzle::ir_swizzle(ir_rvalue *val, unsigned x, unsigned y, unsigned z,
    type = glsl_type::get_instance(val->type->base_type, mask.num_components, 1);
 }
 
+ir_swizzle::ir_swizzle(ir_rvalue *val, ir_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
diff --git a/ir.h b/ir.h
index b3fb06d2c7b8fb3bf1b9560e71e9dfa31b68371d..ce924206f8a294ca4e9840205011e3856c2a09f7 100644 (file)
--- a/ir.h
+++ b/ir.h
@@ -707,11 +707,7 @@ class ir_swizzle : public ir_rvalue {
 public:
    ir_swizzle(ir_rvalue *, unsigned x, unsigned y, unsigned z, unsigned w,
               unsigned count);
-   ir_swizzle(ir_rvalue *val, ir_swizzle_mask mask)
-      : val(val), mask(mask)
-   {
-      /* empty */
-   }
+   ir_swizzle(ir_rvalue *val, ir_swizzle_mask mask);
 
    virtual ir_swizzle *as_swizzle()
    {