Re: [Mesa-dev] [PATCH 07/22] glsl: Fix coding standards issues in lower_variable_index_to_cond_assign

2017-09-22 Thread Thomas Helland
2017-09-21 16:34 GMT+02:00 Ian Romanick :
> From: "\"Ian Romanick\"" 
>

^ Something weird going on here? Apart from that, patches 1 - 7 are:

Reviewed-by: Thomas Helland 

The regression from patch six I have no comments on.
Someone else than me should probably shed their idea.

> From: Ian Romanick 
>
> Mostly tabs-before-spaces, but there was some other trivium too.
>
> Signed-off-by: Ian Romanick 
> ---
>  .../lower_variable_index_to_cond_assign.cpp   | 154 +-
>  1 file changed, 76 insertions(+), 78 deletions(-)
>
> diff --git a/src/compiler/glsl/lower_variable_index_to_cond_assign.cpp 
> b/src/compiler/glsl/lower_variable_index_to_cond_assign.cpp
> index dd49272..9e2dd831 100644
> --- a/src/compiler/glsl/lower_variable_index_to_cond_assign.cpp
> +++ b/src/compiler/glsl/lower_variable_index_to_cond_assign.cpp
> @@ -71,12 +71,13 @@
>   */
>  ir_variable *
>  compare_index_block(exec_list *instructions, ir_variable *index,
> -   unsigned base, unsigned components, void *mem_ctx)
> +unsigned base, unsigned components, void *mem_ctx)
>  {
> ir_rvalue *broadcast_index = new(mem_ctx) ir_dereference_variable(index);
>
> assert(index->type->is_scalar());
> -   assert(index->type->base_type == GLSL_TYPE_INT || index->type->base_type 
> == GLSL_TYPE_UINT);
> +   assert(index->type->base_type == GLSL_TYPE_INT ||
> +  index->type->base_type == GLSL_TYPE_UINT);
> assert(components >= 1 && components <= 4);
>
> if (components > 1) {
> @@ -94,19 +95,18 @@ compare_index_block(exec_list *instructions, ir_variable 
> *index,
> test_indices_data.i[3] = base + 3;
>
> ir_constant *const test_indices =
> -  new(mem_ctx) ir_constant(broadcast_index->type,
> -  _indices_data);
> +  new(mem_ctx) ir_constant(broadcast_index->type, _indices_data);
>
> ir_rvalue *const condition_val =
>new(mem_ctx) ir_expression(ir_binop_equal,
> -glsl_type::bvec(components),
> -broadcast_index,
> -test_indices);
> + glsl_type::bvec(components),
> + broadcast_index,
> + test_indices);
>
> ir_variable *const condition =
>new(mem_ctx) ir_variable(condition_val->type,
> -  "dereference_condition",
> -  ir_var_temporary);
> +   "dereference_condition",
> +   ir_var_temporary);
> instructions->push_tail(condition);
>
> ir_rvalue *const cond_deref =
> @@ -133,7 +133,7 @@ class deref_replacer : public ir_rvalue_visitor {
>  public:
> deref_replacer(const ir_variable *variable_to_replace, ir_rvalue *value)
>: variable_to_replace(variable_to_replace), value(value),
> -   progress(false)
> +progress(false)
> {
>assert(this->variable_to_replace != NULL);
>assert(this->value != NULL);
> @@ -143,9 +143,9 @@ public:
> {
>ir_dereference_variable *const dv = 
> (*rvalue)->as_dereference_variable();
>
> -  if ((dv != NULL) && (dv->var == this->variable_to_replace)) {
> -this->progress = true;
> -*rvalue = this->value->clone(ralloc_parent(*rvalue), NULL);
> +  if (dv != NULL && dv->var == this->variable_to_replace) {
> + this->progress = true;
> + *rvalue = this->value->clone(ralloc_parent(*rvalue), NULL);
>}
> }
>
> @@ -167,10 +167,10 @@ public:
>
> virtual ir_visitor_status visit_enter(ir_dereference_array *ir)
> {
> -  if (is_array_or_matrix(ir->array)
> - && (ir->array_index->as_constant() == NULL)) {
> -this->deref = ir;
> -return visit_stop;
> +  if (is_array_or_matrix(ir->array) &&
> +  ir->array_index->as_constant() == NULL) {
> + this->deref = ir;
> + return visit_stop;
>}
>
>return visit_continue;
> @@ -222,8 +222,8 @@ struct assignment_generator
> */
>ir_rvalue *variable = new(mem_ctx) ir_dereference_variable(this->var);
>ir_assignment *const assignment = (is_write)
> -? new(mem_ctx) ir_assignment(element, variable, condition, 
> write_mask)
> -: new(mem_ctx) ir_assignment(variable, element, condition);
> + ? new(mem_ctx) ir_assignment(element, variable, condition, 
> write_mask)
> + : new(mem_ctx) ir_assignment(variable, element, condition);
>
>list->push_tail(assignment);
> }
> @@ -242,11 +242,11 @@ struct switch_generator
> void *mem_ctx;
>
> switch_generator(const TFunction& generator, ir_variable *index,
> -   unsigned linear_sequence_max_length,
> -   unsigned condition_components)
> +

[Mesa-dev] [PATCH 07/22] glsl: Fix coding standards issues in lower_variable_index_to_cond_assign

2017-09-21 Thread Ian Romanick
From: "\"Ian Romanick\"" 

From: Ian Romanick 

Mostly tabs-before-spaces, but there was some other trivium too.

Signed-off-by: Ian Romanick 
---
 .../lower_variable_index_to_cond_assign.cpp   | 154 +-
 1 file changed, 76 insertions(+), 78 deletions(-)

diff --git a/src/compiler/glsl/lower_variable_index_to_cond_assign.cpp 
b/src/compiler/glsl/lower_variable_index_to_cond_assign.cpp
index dd49272..9e2dd831 100644
--- a/src/compiler/glsl/lower_variable_index_to_cond_assign.cpp
+++ b/src/compiler/glsl/lower_variable_index_to_cond_assign.cpp
@@ -71,12 +71,13 @@
  */
 ir_variable *
 compare_index_block(exec_list *instructions, ir_variable *index,
-   unsigned base, unsigned components, void *mem_ctx)
+unsigned base, unsigned components, void *mem_ctx)
 {
ir_rvalue *broadcast_index = new(mem_ctx) ir_dereference_variable(index);
 
assert(index->type->is_scalar());
-   assert(index->type->base_type == GLSL_TYPE_INT || index->type->base_type == 
GLSL_TYPE_UINT);
+   assert(index->type->base_type == GLSL_TYPE_INT ||
+  index->type->base_type == GLSL_TYPE_UINT);
assert(components >= 1 && components <= 4);
 
if (components > 1) {
@@ -94,19 +95,18 @@ compare_index_block(exec_list *instructions, ir_variable 
*index,
test_indices_data.i[3] = base + 3;
 
ir_constant *const test_indices =
-  new(mem_ctx) ir_constant(broadcast_index->type,
-  _indices_data);
+  new(mem_ctx) ir_constant(broadcast_index->type, _indices_data);
 
ir_rvalue *const condition_val =
   new(mem_ctx) ir_expression(ir_binop_equal,
-glsl_type::bvec(components),
-broadcast_index,
-test_indices);
+ glsl_type::bvec(components),
+ broadcast_index,
+ test_indices);
 
ir_variable *const condition =
   new(mem_ctx) ir_variable(condition_val->type,
-  "dereference_condition",
-  ir_var_temporary);
+   "dereference_condition",
+   ir_var_temporary);
instructions->push_tail(condition);
 
ir_rvalue *const cond_deref =
@@ -133,7 +133,7 @@ class deref_replacer : public ir_rvalue_visitor {
 public:
deref_replacer(const ir_variable *variable_to_replace, ir_rvalue *value)
   : variable_to_replace(variable_to_replace), value(value),
-   progress(false)
+progress(false)
{
   assert(this->variable_to_replace != NULL);
   assert(this->value != NULL);
@@ -143,9 +143,9 @@ public:
{
   ir_dereference_variable *const dv = (*rvalue)->as_dereference_variable();
 
-  if ((dv != NULL) && (dv->var == this->variable_to_replace)) {
-this->progress = true;
-*rvalue = this->value->clone(ralloc_parent(*rvalue), NULL);
+  if (dv != NULL && dv->var == this->variable_to_replace) {
+ this->progress = true;
+ *rvalue = this->value->clone(ralloc_parent(*rvalue), NULL);
   }
}
 
@@ -167,10 +167,10 @@ public:
 
virtual ir_visitor_status visit_enter(ir_dereference_array *ir)
{
-  if (is_array_or_matrix(ir->array)
- && (ir->array_index->as_constant() == NULL)) {
-this->deref = ir;
-return visit_stop;
+  if (is_array_or_matrix(ir->array) &&
+  ir->array_index->as_constant() == NULL) {
+ this->deref = ir;
+ return visit_stop;
   }
 
   return visit_continue;
@@ -222,8 +222,8 @@ struct assignment_generator
*/
   ir_rvalue *variable = new(mem_ctx) ir_dereference_variable(this->var);
   ir_assignment *const assignment = (is_write)
-? new(mem_ctx) ir_assignment(element, variable, condition, write_mask)
-: new(mem_ctx) ir_assignment(variable, element, condition);
+ ? new(mem_ctx) ir_assignment(element, variable, condition, write_mask)
+ : new(mem_ctx) ir_assignment(variable, element, condition);
 
   list->push_tail(assignment);
}
@@ -242,11 +242,11 @@ struct switch_generator
void *mem_ctx;
 
switch_generator(const TFunction& generator, ir_variable *index,
-   unsigned linear_sequence_max_length,
-   unsigned condition_components)
+unsigned linear_sequence_max_length,
+unsigned condition_components)
   : generator(generator), index(index),
-   linear_sequence_max_length(linear_sequence_max_length),
-   condition_components(condition_components)
+linear_sequence_max_length(linear_sequence_max_length),
+condition_components(condition_components)
{
   this->mem_ctx = ralloc_parent(index);
}
@@ -266,10 +266,10 @@ struct switch_generator
*/