Re: [Mesa-dev] [PATCH v2 3/3] glsl: Use array deref for access to vector components

2015-11-12 Thread Jordan Justen
On 2015-11-11 20:57:55, Matt Turner wrote:
> On Wed, Nov 11, 2015 at 8:47 PM, Ilia Mirkin  wrote:
> > On Nov 11, 2015 9:10 PM, "Matt Turner"  wrote:
> >>
> >> On Thu, Nov 5, 2015 at 9:44 PM, Kristian Høgsberg Kristensen
> >>  wrote:
> >> > diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp
> >> > index e4e4a3f..5584470 100644
> >> > --- a/src/glsl/ast_function.cpp
> >> > +++ b/src/glsl/ast_function.cpp
> >> > @@ -376,12 +368,8 @@ fix_parameter(void *mem_ctx, ir_rvalue *actual,
> >> > const glsl_type *formal_type,
> >> >
> >> > ir_rvalue *lhs = actual;
> >> > if (expr != NULL && expr->operation == ir_binop_vector_extract) {
> >> > -  rhs = new(mem_ctx) ir_expression(ir_triop_vector_insert,
> >> > -   expr->operands[0]->type,
> >> > -
> >> > expr->operands[0]->clone(mem_ctx, NULL),
> >> > -   rhs,
> >> > -
> >> > expr->operands[1]->clone(mem_ctx, NULL));
> >> > -  lhs = expr->operands[0]->clone(mem_ctx, NULL);
> >> > +  lhs == new(mem_ctx)
> >> > ir_dereference_array(expr->operands[0]->clone(mem_ctx, NULL),
> >> > +
> >> > expr->operands[1]->clone(mem_ctx, NULL));
> >>
> >>
> >> I'm getting
> >>
> >> ../../../mesa/src/glsl/ast_function.cpp: In function ‘void
> >> fix_parameter(void*, ir_rvalue*, const glsl_type*, exec_list*,
> >> exec_list*, bool)’:
> >> ../../../mesa/src/glsl/ast_function.cpp:372:88: warning: right operand
> >> of comma operator has no effect [-Wunused-value]
> >>
> >> expr->operands[1]->clone(mem_ctx, NULL));
> >>
> >> from this, but I can't interpret the warning.
> >>
> >
> > Probably one equal sign too many...
> 
> Wow! How it this working?!

It looks like the affected scenario would be calling a function with
an out parameter where the call param is a vector extract.

-Jordan
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2 3/3] glsl: Use array deref for access to vector components

2015-11-11 Thread Matt Turner
On Wed, Nov 11, 2015 at 8:47 PM, Ilia Mirkin  wrote:
> On Nov 11, 2015 9:10 PM, "Matt Turner"  wrote:
>>
>> On Thu, Nov 5, 2015 at 9:44 PM, Kristian Høgsberg Kristensen
>>  wrote:
>> > diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp
>> > index e4e4a3f..5584470 100644
>> > --- a/src/glsl/ast_function.cpp
>> > +++ b/src/glsl/ast_function.cpp
>> > @@ -376,12 +368,8 @@ fix_parameter(void *mem_ctx, ir_rvalue *actual,
>> > const glsl_type *formal_type,
>> >
>> > ir_rvalue *lhs = actual;
>> > if (expr != NULL && expr->operation == ir_binop_vector_extract) {
>> > -  rhs = new(mem_ctx) ir_expression(ir_triop_vector_insert,
>> > -   expr->operands[0]->type,
>> > -
>> > expr->operands[0]->clone(mem_ctx, NULL),
>> > -   rhs,
>> > -
>> > expr->operands[1]->clone(mem_ctx, NULL));
>> > -  lhs = expr->operands[0]->clone(mem_ctx, NULL);
>> > +  lhs == new(mem_ctx)
>> > ir_dereference_array(expr->operands[0]->clone(mem_ctx, NULL),
>> > +
>> > expr->operands[1]->clone(mem_ctx, NULL));
>>
>>
>> I'm getting
>>
>> ../../../mesa/src/glsl/ast_function.cpp: In function ‘void
>> fix_parameter(void*, ir_rvalue*, const glsl_type*, exec_list*,
>> exec_list*, bool)’:
>> ../../../mesa/src/glsl/ast_function.cpp:372:88: warning: right operand
>> of comma operator has no effect [-Wunused-value]
>>
>> expr->operands[1]->clone(mem_ctx, NULL));
>>
>> from this, but I can't interpret the warning.
>>
>
> Probably one equal sign too many...

Wow! How it this working?!
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2 3/3] glsl: Use array deref for access to vector components

2015-11-11 Thread Matt Turner
On Thu, Nov 5, 2015 at 9:44 PM, Kristian Høgsberg Kristensen
 wrote:
> diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp
> index e4e4a3f..5584470 100644
> --- a/src/glsl/ast_function.cpp
> +++ b/src/glsl/ast_function.cpp
> @@ -376,12 +368,8 @@ fix_parameter(void *mem_ctx, ir_rvalue *actual, const 
> glsl_type *formal_type,
>
> ir_rvalue *lhs = actual;
> if (expr != NULL && expr->operation == ir_binop_vector_extract) {
> -  rhs = new(mem_ctx) ir_expression(ir_triop_vector_insert,
> -   expr->operands[0]->type,
> -   expr->operands[0]->clone(mem_ctx, 
> NULL),
> -   rhs,
> -   expr->operands[1]->clone(mem_ctx, 
> NULL));
> -  lhs = expr->operands[0]->clone(mem_ctx, NULL);
> +  lhs == new(mem_ctx) 
> ir_dereference_array(expr->operands[0]->clone(mem_ctx, NULL),
> +   
> expr->operands[1]->clone(mem_ctx, NULL));


I'm getting

../../../mesa/src/glsl/ast_function.cpp: In function ‘void
fix_parameter(void*, ir_rvalue*, const glsl_type*, exec_list*,
exec_list*, bool)’:
../../../mesa/src/glsl/ast_function.cpp:372:88: warning: right operand
of comma operator has no effect [-Wunused-value]

expr->operands[1]->clone(mem_ctx, NULL));

from this, but I can't interpret the warning.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2 3/3] glsl: Use array deref for access to vector components

2015-11-11 Thread Ilia Mirkin
On Nov 11, 2015 9:10 PM, "Matt Turner"  wrote:
>
> On Thu, Nov 5, 2015 at 9:44 PM, Kristian Høgsberg Kristensen
>  wrote:
> > diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp
> > index e4e4a3f..5584470 100644
> > --- a/src/glsl/ast_function.cpp
> > +++ b/src/glsl/ast_function.cpp
> > @@ -376,12 +368,8 @@ fix_parameter(void *mem_ctx, ir_rvalue *actual,
const glsl_type *formal_type,
> >
> > ir_rvalue *lhs = actual;
> > if (expr != NULL && expr->operation == ir_binop_vector_extract) {
> > -  rhs = new(mem_ctx) ir_expression(ir_triop_vector_insert,
> > -   expr->operands[0]->type,
> > -
 expr->operands[0]->clone(mem_ctx, NULL),
> > -   rhs,
> > -
 expr->operands[1]->clone(mem_ctx, NULL));
> > -  lhs = expr->operands[0]->clone(mem_ctx, NULL);
> > +  lhs == new(mem_ctx)
ir_dereference_array(expr->operands[0]->clone(mem_ctx, NULL),
> > +
 expr->operands[1]->clone(mem_ctx, NULL));
>
>
> I'm getting
>
> ../../../mesa/src/glsl/ast_function.cpp: In function ‘void
> fix_parameter(void*, ir_rvalue*, const glsl_type*, exec_list*,
> exec_list*, bool)’:
> ../../../mesa/src/glsl/ast_function.cpp:372:88: warning: right operand
> of comma operator has no effect [-Wunused-value]
>
> expr->operands[1]->clone(mem_ctx, NULL));
>
> from this, but I can't interpret the warning.
>

Probably one equal sign too many...

  -ilia
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev