[Mesa-dev] [PATCH 2/3] glsl: tidy up get_num_operands()

Timothy Arceri tarceri at itsqueeze.com
Sun Jul 30 23:44:46 UTC 2017


On 31/07/17 08:51, Ilia Mirkin wrote:
> 
> 
> On Jul 30, 2017 5:38 PM, "Timothy Arceri" <tarceri at itsqueeze.com 
> <mailto:tarceri at itsqueeze.com>> wrote:
> 
>     Also add a comment that this should only be used by the ir_reader
>     interface for testing purposes.
>     ---
>       src/compiler/glsl/ir.cpp |  8 ++++++--
>       src/compiler/glsl/ir.h   | 14 +++-----------
>       2 files changed, 9 insertions(+), 13 deletions(-)
> 
>     diff --git a/src/compiler/glsl/ir.cpp b/src/compiler/glsl/ir.cpp
>     index d501e19c01..750582e40e 100644
>     --- a/src/compiler/glsl/ir.cpp
>     +++ b/src/compiler/glsl/ir.cpp
>     @@ -549,38 +549,42 @@ ir_expression::ir_expression(int op, ir_rvalue
>     *op0, ir_rvalue *op1,
>          case ir_triop_csel:
>             this->type = op1->type;
>             break;
> 
>          default:
>             assert(!"not reached: missing automatic type setup for
>     ir_expression");
>             this->type = glsl_type::float_type;
>          }
>       }
> 
>     -unsigned int
>     +/**
>     + * This is only here for ir_reader to used for testing purposes
>     please use
>     + * the precomputed num_operands field if you need the number of
>     operands.
>     + */
>     +unsigned
>       ir_expression::get_num_operands(ir_expression_operation op)
>       {
>          assert(op <= ir_last_opcode);
> 
>          if (op <= ir_last_unop)
>             return 1;
> 
>          if (op <= ir_last_binop)
>             return 2;
> 
>          if (op <= ir_last_triop)
>             return 3;
> 
>          if (op <= ir_last_quadop)
>             return 4;
> 
>     -   assert(false);
>     +   assert("!could not calculate number of operands");
> 
> 
> Assert(!"...")

Fixed. Thanks!



More information about the mesa-dev mailing list