[Mesa-dev] [PATCH 09/21] glsl: Add missing type inference support for ARB_gpu_shader5 unops.

Kenneth Graunke kenneth at whitecape.org
Wed Sep 4 20:05:56 PDT 2013


On 09/04/2013 07:11 PM, Matt Turner wrote:
> On Wed, Sep 4, 2013 at 3:22 PM, Kenneth Graunke <kenneth at whitecape.org> wrote:
>> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
>> ---
>>   src/glsl/ir.cpp | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp
>> index e9317f8..4abadd8 100644
>> --- a/src/glsl/ir.cpp
>> +++ b/src/glsl/ir.cpp
>> @@ -250,6 +250,7 @@ ir_expression::ir_expression(int op, ir_rvalue *op0)
>>      case ir_unop_cos_reduced:
>>      case ir_unop_dFdx:
>>      case ir_unop_dFdy:
>> +   case ir_unop_bitfield_reverse:
>>         this->type = op0->type;
>>         break;
>>
>> @@ -257,6 +258,9 @@ ir_expression::ir_expression(int op, ir_rvalue *op0)
>>      case ir_unop_b2i:
>>      case ir_unop_u2i:
>>      case ir_unop_bitcast_f2i:
>> +   case ir_unop_bit_count:
>> +   case ir_unop_find_msb:
>> +   case ir_unop_find_lsb:
>>         this->type = glsl_type::get_instance(GLSL_TYPE_INT,
>>                                             op0->type->vector_elements, 1);
>>         break;
>> --
>> 1.8.3.4
>
> ir_binop_bfm, ir_triop_bfi, ir_triop_bitfield_extract, and
> ir_quadop_bitfield_insert too?

Adding ir_binop_bfm makes sense.

The next patch adds triop support.

I didn't add an ir_expression constructor with type inference for 
quadops since I wasn't sure how to handle ir_quadop_vector (and it's the 
only other quadop).  But I guess it can be handled as:

glsl_type::get_instance(operands[0]->type->base_type,
                         operands[0] != NULL +
                         operands[1] != NULL +
                         operands[2] != NULL +
                         operands[3] != NULL,
                         1);

Then ir_builder::bitfield_extract() could use it.

--Ken


More information about the mesa-dev mailing list