class ir_vec_index_to_cond_assign_visitor : public ir_hierarchical_visitor {
public:
ir_vec_index_to_cond_assign_visitor()
+ : progress(false)
{
- progress = false;
+ /* empty */
}
ir_rvalue *convert_vec_index_to_cond_assign(void *mem_ctx,
assert(orig_index->type == glsl_type::int_type ||
orig_index->type == glsl_type::uint_type);
index = new(base_ir) ir_variable(orig_index->type,
- "vec_index_tmp_i",
- ir_var_temporary);
+ "vec_index_tmp_i",
+ ir_var_temporary);
list.push_tail(index);
deref = new(base_ir) ir_dereference_variable(index);
assign = new(base_ir) ir_assignment(deref, orig_index, NULL);
/* Temporary where we store whichever value we swizzle out. */
var = new(base_ir) ir_variable(type, "vec_index_tmp_v",
- ir_var_temporary);
+ ir_var_temporary);
list.push_tail(var);
/* Generate a single comparison condition "mask" for all of the components
ir_rvalue *const cond_deref =
compare_index_block(&list, index, 0,
orig_vector->type->vector_elements,
- mem_ctx);
+ mem_ctx);
/* Generate a conditional move of each vector element to the temp. */
for (i = 0; i < orig_vector->type->vector_elements; i++) {
* underlying variable.
*/
ir_rvalue *swizzle =
- new(base_ir) ir_swizzle(deref_value->clone(mem_ctx, NULL),
- i, 0, 0, 0, 1);
+ new(base_ir) ir_swizzle(deref_value->clone(mem_ctx, NULL),
+ i, 0, 0, 0, 1);
deref = new(base_ir) ir_dereference_variable(var);
assign = new(base_ir) ir_assignment(deref, swizzle, condition_swizzle);
ir_visitor_status
ir_vec_index_to_cond_assign_visitor::visit_enter(ir_expression *ir)
{
- unsigned int i;
-
- for (i = 0; i < ir->num_operands; i++) {
+ for (unsigned i = 0; i < ir->num_operands; i++)
ir->operands[i] = convert_vector_extract_to_cond_assign(ir->operands[i]);
- }
return visit_continue;
}
{
ir->rhs = convert_vector_extract_to_cond_assign(ir->rhs);
- if (ir->condition) {
+ if (ir->condition)
ir->condition = convert_vector_extract_to_cond_assign(ir->condition);
- }
return visit_continue;
}
ir_rvalue *new_param = convert_vector_extract_to_cond_assign(param);
if (new_param != param) {
- param->replace_with(new_param);
+ param->replace_with(new_param);
}
}
ir_visitor_status
ir_vec_index_to_cond_assign_visitor::visit_enter(ir_return *ir)
{
- if (ir->value) {
+ if (ir->value)
ir->value = convert_vector_extract_to_cond_assign(ir->value);
- }
return visit_continue;
}