[Mesa-dev] [PATCH 08/12] glsl: Generate ir_binop_vector_extract for indexing of vectors

Eric Anholt eric at anholt.net
Tue Apr 9 10:38:34 PDT 2013


Ian Romanick <idr at freedesktop.org> writes:

> From: Ian Romanick <ian.d.romanick at intel.com>
>
> Now ir_dereference_array of a vector will never occur in the RHS of an
> expression.
>
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> ---
>  src/glsl/ast_array_index.cpp | 23 +++++++++++++++++------
>  1 file changed, 17 insertions(+), 6 deletions(-)
>
> diff --git a/src/glsl/ast_array_index.cpp b/src/glsl/ast_array_index.cpp
> index 862f64c..e7bc299 100644
> --- a/src/glsl/ast_array_index.cpp
> +++ b/src/glsl/ast_array_index.cpp
> @@ -31,17 +31,13 @@ _mesa_ast_array_index_to_hir(void *mem_ctx,
>  			     ir_rvalue *array, ir_rvalue *idx,
>  			     YYLTYPE &loc, YYLTYPE &idx_loc)
>  {
> -   ir_rvalue *result = new(mem_ctx) ir_dereference_array(array, idx);
> -
>     if (!array->type->is_error()
>         && !array->type->is_array()
>         && !array->type->is_matrix()
> -       && !array->type->is_vector()) {
> +       && !array->type->is_vector())
>        _mesa_glsl_error(& idx_loc, state,
>  		       "cannot dereference non-array / non-matrix / "
>  		       "non-vector");
> -      result->type = glsl_type::error_type;
> -   }

Style-wise, I'd prefer those curly braces stay -- there's very little
distinguishing the if condition from the body, already.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20130409/9f8f520f/attachment.pgp>


More information about the mesa-dev mailing list