i965/vs: Fix up swizzle for dereference_array of matrices.
authorEric Anholt <eric@anholt.net>
Thu, 10 May 2012 22:38:11 +0000 (15:38 -0700)
committerEric Anholt <eric@anholt.net>
Thu, 17 May 2012 17:05:23 +0000 (10:05 -0700)
Fixes assertion failure in piglit:
vs-mat2-struct-assignment.shader_test
vs-mat2-array-assignment.shader_test

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp

index a7d71b3b5ff06ad0c78098b1dac18dc6a551df6d..c2b103331aa5f04e61a92e52228a9d40c9f37ff8 100644 (file)
@@ -1454,7 +1454,7 @@ vec4_visitor::visit(ir_dereference_array *ir)
    }
 
    /* If the type is smaller than a vec4, replicate the last channel out. */
-   if (ir->type->is_scalar() || ir->type->is_vector())
+   if (ir->type->is_scalar() || ir->type->is_vector() || ir->type->is_matrix())
       src.swizzle = swizzle_for_size(ir->type->vector_elements);
    else
       src.swizzle = BRW_SWIZZLE_NOOP;
@@ -1479,7 +1479,7 @@ vec4_visitor::visit(ir_dereference_record *ir)
    }
 
    /* If the type is smaller than a vec4, replicate the last channel out. */
-   if (ir->type->is_scalar() || ir->type->is_vector())
+   if (ir->type->is_scalar() || ir->type->is_vector() || ir->type->is_matrix())
       this->result.swizzle = swizzle_for_size(ir->type->vector_elements);
    else
       this->result.swizzle = BRW_SWIZZLE_NOOP;