* pass over the Mesa IR later.
*/
void
-ir_to_mesa_visitor::get_temp(struct mbtree *tree)
+ir_to_mesa_visitor::get_temp(struct mbtree *tree, int size)
{
+ int swizzle = 0;
+ int i;
+
ir_to_mesa_set_tree_reg(tree, PROGRAM_TEMPORARY, this->next_temp++);
+
+ for (i = 0; i < size; i++)
+ swizzle |= 1 << i;
+ for (; i < 4; i++)
+ swizzle |= 1 << (size - 1);
+ tree->src_reg.swizzle = swizzle;
+ tree->dst_reg.writemask = (1 << size) - 1;
}
void
}
/* Allocate a temporary for the result. */
- this->get_temp(this->result);
+ this->get_temp(this->result, ir->type->vector_elements);
}
assert(this->result);
tree = this->create_tree(MB_TERM_swizzle_vec4, ir, this->result, NULL);
- this->get_temp(tree);
+ this->get_temp(tree, 4);
for (i = 0; i < 4; i++) {
if (i < ir->type->vector_elements) {
int next_temp;
int next_constant;
- void get_temp(struct mbtree *tree);
+ void get_temp(struct mbtree *tree, int size);
void get_temp_for_var(ir_variable *var, struct mbtree *tree);