[Mesa-dev] [PATCH (gles3) 15/20] glsl: Add lowering pass for GLSL ES 3.00 pack/unpack operations (v2)

Chad Versace chad.versace at linux.intel.com
Wed Jan 23 12:34:32 PST 2013


On 01/22/2013 07:36 PM, Matt Turner wrote:
> On Mon, Jan 21, 2013 at 12:49 AM, Chad Versace
> <chad.versace at linux.intel.com> wrote:
>> Lower them to arithmetic and bit manipulation expressions.
>>
>> v2:
>>   - Rewrite using ir_builder. [for idr]
>>   - In lowering packHalf2x16, don't truncate subnormal float16 values to zero.
>>     And round to even rather than to zero.  [for stereotype441]
>>
>> CC: Ian Romanick <idr at freedesktop.org>
>> CC: Paul Berry <stereotype441 at gmail.com>
>> Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
>> ---
>>  src/glsl/Makefile.sources           |    1 +
>>  src/glsl/ir_optimization.h          |   20 +
>>  src/glsl/lower_packing_builtins.cpp | 1043 +++++++++++++++++++++++++++++++++++
>>  3 files changed, 1064 insertions(+)
>>  create mode 100644 src/glsl/lower_packing_builtins.cpp
>>


>> +      /* From page 88 (94 of pdf) of the GLSL ES 3.00 spec:
>> +       *
>> +       *    hihgp uint packSnorm2x16(vec2 v)
> 
> high.

Fixed.


>> +      ir_rvalue *result =
>> +        clamp(div(i2f(rshift(lshift(u2i(unpack_uint_to_uvec2(uint_rval)),
>> +                                    constant(16)),
> 
> constant(16u) instead of constant(16)? All other cases use 16u.

constant() has several overloaded variants where signedness is significant.

I chose a signed 16 so that the two arguments to lshift would have matching
types. That's the same reason I chose unsigned everywhere else.


>> +   /**
>> +    * \brief Lower a packUnorm2x16 expression.
>> +    *
>> +    * \param vec2_rval is packUnorm2x16's input
>> +    * \return packUnorm2x16's as a uint rvalue
> 
> Missing the word 'output'.

Fixed.


More information about the mesa-dev mailing list