ir_to_mesa: Replace open-coded swizzle_for_size()
authorEric Anholt <eric@anholt.net>
Mon, 2 May 2011 23:27:46 +0000 (16:27 -0700)
committerEric Anholt <eric@anholt.net>
Fri, 5 Aug 2011 17:37:15 +0000 (10:37 -0700)
src/mesa/program/ir_to_mesa.cpp

index 9b615b68a23e3ee9c101f1ecb4c910e4f2a43feb..1ef609fe15d7f03498e13123a7ac57ca8c2ab3c1 100644 (file)
@@ -641,8 +641,6 @@ src_reg
 ir_to_mesa_visitor::get_temp(const glsl_type *type)
 {
    src_reg src;
-   int swizzle[4];
-   int i;
 
    src.file = PROGRAM_TEMPORARY;
    src.index = next_temp;
@@ -652,12 +650,7 @@ ir_to_mesa_visitor::get_temp(const glsl_type *type)
    if (type->is_array() || type->is_record()) {
       src.swizzle = SWIZZLE_NOOP;
    } else {
-      for (i = 0; i < type->vector_elements; i++)
-        swizzle[i] = i;
-      for (; i < 4; i++)
-        swizzle[i] = type->vector_elements - 1;
-      src.swizzle = MAKE_SWIZZLE4(swizzle[0], swizzle[1],
-                                 swizzle[2], swizzle[3]);
+      src.swizzle = swizzle_for_size(type->vector_elements);
    }
    src.negate = 0;