glsl: Return ir_variable from compare_index_block
This is basically a wash now, but it simplifies later patches that convert to using ir_builder. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com> Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
This commit is contained in:
@@ -170,9 +170,9 @@ bool lower_blend_equation_advanced(gl_linked_shader *shader);
|
|||||||
bool lower_subroutine(exec_list *instructions, struct _mesa_glsl_parse_state *state);
|
bool lower_subroutine(exec_list *instructions, struct _mesa_glsl_parse_state *state);
|
||||||
void propagate_invariance(exec_list *instructions);
|
void propagate_invariance(exec_list *instructions);
|
||||||
|
|
||||||
ir_rvalue *
|
ir_variable *compare_index_block(exec_list *instructions, ir_variable *index,
|
||||||
compare_index_block(exec_list *instructions, ir_variable *index,
|
unsigned base, unsigned components,
|
||||||
unsigned base, unsigned components, void *mem_ctx);
|
void *mem_ctx);
|
||||||
|
|
||||||
bool lower_64bit_integer_instructions(exec_list *instructions,
|
bool lower_64bit_integer_instructions(exec_list *instructions,
|
||||||
unsigned what_to_lower);
|
unsigned what_to_lower);
|
||||||
|
@@ -66,10 +66,10 @@
|
|||||||
* \param mem_ctx ralloc memory context to be used for all allocations.
|
* \param mem_ctx ralloc memory context to be used for all allocations.
|
||||||
*
|
*
|
||||||
* \returns
|
* \returns
|
||||||
* An \c ir_rvalue that \b must be cloned for each use in conditional
|
* An \c ir_variable containing the per-component comparison results. This
|
||||||
* assignments, etc.
|
* must be dereferenced per use.
|
||||||
*/
|
*/
|
||||||
ir_rvalue *
|
ir_variable *
|
||||||
compare_index_block(exec_list *instructions, ir_variable *index,
|
compare_index_block(exec_list *instructions, ir_variable *index,
|
||||||
unsigned base, unsigned components, void *mem_ctx)
|
unsigned base, unsigned components, void *mem_ctx)
|
||||||
{
|
{
|
||||||
@@ -113,7 +113,7 @@ compare_index_block(exec_list *instructions, ir_variable *index,
|
|||||||
new(mem_ctx) ir_dereference_variable(condition);
|
new(mem_ctx) ir_dereference_variable(condition);
|
||||||
instructions->push_tail(new(mem_ctx) ir_assignment(cond_deref, condition_val, 0));
|
instructions->push_tail(new(mem_ctx) ir_assignment(cond_deref, condition_val, 0));
|
||||||
|
|
||||||
return cond_deref;
|
return condition;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool
|
static inline bool
|
||||||
@@ -275,17 +275,21 @@ struct switch_generator
|
|||||||
for (unsigned i = first; i < end; i += 4) {
|
for (unsigned i = first; i < end; i += 4) {
|
||||||
const unsigned comps = MIN2(condition_components, end - i);
|
const unsigned comps = MIN2(condition_components, end - i);
|
||||||
|
|
||||||
ir_rvalue *const cond_deref =
|
ir_variable *const cond =
|
||||||
compare_index_block(list, index, i, comps, this->mem_ctx);
|
compare_index_block(list, index, i, comps, this->mem_ctx);
|
||||||
|
|
||||||
if (comps == 1) {
|
if (comps == 1) {
|
||||||
this->generator.generate(i, cond_deref->clone(this->mem_ctx, NULL),
|
ir_rvalue *const cond_deref =
|
||||||
list);
|
new(mem_ctx) ir_dereference_variable(cond);
|
||||||
|
|
||||||
|
this->generator.generate(i, cond_deref, list);
|
||||||
} else {
|
} else {
|
||||||
for (unsigned j = 0; j < comps; j++) {
|
for (unsigned j = 0; j < comps; j++) {
|
||||||
ir_rvalue *const cond_swiz =
|
ir_rvalue *const cond_deref =
|
||||||
new(this->mem_ctx) ir_swizzle(cond_deref->clone(this->mem_ctx, NULL),
|
new(mem_ctx) ir_dereference_variable(cond);
|
||||||
j, 0, 0, 0, 1);
|
ir_rvalue *const cond_swiz =
|
||||||
|
new(this->mem_ctx) ir_swizzle(cond_deref,
|
||||||
|
j, 0, 0, 0, 1);
|
||||||
|
|
||||||
this->generator.generate(i + j, cond_swiz, list);
|
this->generator.generate(i + j, cond_swiz, list);
|
||||||
}
|
}
|
||||||
|
@@ -115,7 +115,7 @@ ir_vec_index_to_cond_assign_visitor::convert_vec_index_to_cond_assign(void *mem_
|
|||||||
/* Generate a single comparison condition "mask" for all of the components
|
/* Generate a single comparison condition "mask" for all of the components
|
||||||
* in the vector.
|
* in the vector.
|
||||||
*/
|
*/
|
||||||
ir_rvalue *const cond_deref =
|
ir_variable *const cond =
|
||||||
compare_index_block(&list, index, 0,
|
compare_index_block(&list, index, 0,
|
||||||
orig_vector->type->vector_elements,
|
orig_vector->type->vector_elements,
|
||||||
mem_ctx);
|
mem_ctx);
|
||||||
@@ -123,7 +123,7 @@ ir_vec_index_to_cond_assign_visitor::convert_vec_index_to_cond_assign(void *mem_
|
|||||||
/* Generate a conditional move of each vector element to the temp. */
|
/* Generate a conditional move of each vector element to the temp. */
|
||||||
for (i = 0; i < orig_vector->type->vector_elements; i++) {
|
for (i = 0; i < orig_vector->type->vector_elements; i++) {
|
||||||
ir_rvalue *condition_swizzle =
|
ir_rvalue *condition_swizzle =
|
||||||
new(base_ir) ir_swizzle(cond_deref->clone(mem_ctx, NULL),
|
new(base_ir) ir_swizzle(new(mem_ctx) ir_dereference_variable(cond),
|
||||||
i, 0, 0, 0, 1);
|
i, 0, 0, 0, 1);
|
||||||
|
|
||||||
/* Just clone the rest of the deref chain when trying to get at the
|
/* Just clone the rest of the deref chain when trying to get at the
|
||||||
|
Reference in New Issue
Block a user