aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2010-06-28 12:48:47 -0700
committerEric Anholt <[email protected]>2010-06-28 12:49:28 -0700
commitd5a5df45a4af93bb845483bdeeae7c8e042b03d8 (patch)
tree6d5ee1745f85a11e602349a0df786964c7d4d7da /src
parent7dc1e0b3267f0bf4dc0ef015b972f7fa6c4c317a (diff)
ir_to_mesa: Fix indexes of temps used in expressions.
It looks like I managed to horribly mangle this in some rebase of the branch. Fixes: glsl-fs-fragcoord glsl-fs-mix
Diffstat (limited to 'src')
-rw-r--r--src/mesa/shader/ir_to_mesa.cpp59
1 files changed, 30 insertions, 29 deletions
diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp
index 90684ad5559..9cf78391484 100644
--- a/src/mesa/shader/ir_to_mesa.cpp
+++ b/src/mesa/shader/ir_to_mesa.cpp
@@ -385,35 +385,6 @@ ir_to_mesa_visitor::src_reg_for_float(float val)
return src_reg;
}
-/**
- * In the initial pass of codegen, we assign temporary numbers to
- * intermediate results. (not SSA -- variable assignments will reuse
- * storage). Actual register allocation for the Mesa VM occurs in a
- * pass over the Mesa IR later.
- */
-ir_to_mesa_src_reg
-ir_to_mesa_visitor::get_temp(const glsl_type *type)
-{
- ir_to_mesa_src_reg src_reg;
- int swizzle[4];
- int i;
-
- assert(!type->is_array());
-
- src_reg.file = PROGRAM_TEMPORARY;
- src_reg.index = type->matrix_columns;
- src_reg.reladdr = false;
-
- for (i = 0; i < type->vector_elements; i++)
- swizzle[i] = i;
- for (; i < 4; i++)
- swizzle[i] = type->vector_elements - 1;
- src_reg.swizzle = MAKE_SWIZZLE4(swizzle[0], swizzle[1],
- swizzle[2], swizzle[3]);
-
- return src_reg;
-}
-
static int
type_size(const struct glsl_type *type)
{
@@ -448,6 +419,36 @@ type_size(const struct glsl_type *type)
}
}
+/**
+ * In the initial pass of codegen, we assign temporary numbers to
+ * intermediate results. (not SSA -- variable assignments will reuse
+ * storage). Actual register allocation for the Mesa VM occurs in a
+ * pass over the Mesa IR later.
+ */
+ir_to_mesa_src_reg
+ir_to_mesa_visitor::get_temp(const glsl_type *type)
+{
+ ir_to_mesa_src_reg src_reg;
+ int swizzle[4];
+ int i;
+
+ assert(!type->is_array());
+
+ src_reg.file = PROGRAM_TEMPORARY;
+ src_reg.index = next_temp;
+ src_reg.reladdr = false;
+ next_temp += type_size(type);
+
+ for (i = 0; i < type->vector_elements; i++)
+ swizzle[i] = i;
+ for (; i < 4; i++)
+ swizzle[i] = type->vector_elements - 1;
+ src_reg.swizzle = MAKE_SWIZZLE4(swizzle[0], swizzle[1],
+ swizzle[2], swizzle[3]);
+
+ return src_reg;
+}
+
temp_entry *
ir_to_mesa_visitor::find_variable_storage(ir_variable *var)
{