[Mesa-dev] [PATCH 01/47] glsl: Add 16-bit types

Eduardo Lima Mitev elima at igalia.com
Fri Aug 25 07:22:44 UTC 2017


On 08/24/2017 04:24 PM, Ilia Mirkin wrote:
> On Thu, Aug 24, 2017 at 9:54 AM, Alejandro Piñeiro <apinheiro at igalia.com> wrote:
>> From: Eduardo Lima Mitev <elima at igalia.com>
>>
>> Adds new INT16, UINT16 and FLOAT16 base types.
>>
>> The corresponding GL types for half floats were reused from the
>> AMD_gpu_shader_half_float extension. The int16 and uint16 types come from
>> NV_gpu_shader_5 extension.
>>
>> This adds the builtins and the lexer support.
>>
>> To avoid a bunch of warnings due to cases not handled in switch, the
>> new types have been added to a few places using same behavior as
>> their 32-bit counterparts, except for a few trivial cases where they are
>> already handled properly. Subsequent patches in this set will provide
>> correct 16-bit implementations when needed.
>>
>> v2: * Use FLOAT16 instead of HALF_FLOAT as name of the base type.
>>     * Removed float16_t from builtin types.
>>     * Don't copy 16-bit types as if they were 32-bit values in
>>       copy_constant_to_storage().
>>     * Use get_scalar_type() instead of adding a new custom switch
>>       statement.
>>     (Jason Ekstrand)
>>
>> Signed-off-by: Jose Maria Casanova Crespo <jmcasanova at igalia.com>
>> Signed-off-by: Eduardo Lima <elima at igalia.com>
>> Signed-off-by: Alejandro Piñeiro <apinheiro at igalia.com>
>> ---
>>  src/compiler/builtin_type_macros.h              | 26 +++++++
>>  src/compiler/glsl/ast_to_hir.cpp                |  3 +
>>  src/compiler/glsl/ir_clone.cpp                  |  3 +
>>  src/compiler/glsl/link_uniform_initializers.cpp |  3 +
>>  src/compiler/glsl/lower_buffer_access.cpp       |  3 +-
>>  src/compiler/glsl_types.cpp                     | 93 ++++++++++++++++++++++++-
>>  src/compiler/glsl_types.h                       | 10 ++-
>>  src/mesa/program/ir_to_mesa.cpp                 |  6 ++
>>  8 files changed, 141 insertions(+), 6 deletions(-)
>>
>> diff --git a/src/compiler/builtin_type_macros.h b/src/compiler/builtin_type_macros.h
>> index a275617b343..801602c6905 100644
>> --- a/src/compiler/builtin_type_macros.h
>> +++ b/src/compiler/builtin_type_macros.h
>> @@ -62,6 +62,22 @@ DECL_TYPE(mat3x4, GL_FLOAT_MAT3x4, GLSL_TYPE_FLOAT, 4, 3)
>>  DECL_TYPE(mat4x2, GL_FLOAT_MAT4x2, GLSL_TYPE_FLOAT, 2, 4)
>>  DECL_TYPE(mat4x3, GL_FLOAT_MAT4x3, GLSL_TYPE_FLOAT, 3, 4)
>>
>> +DECL_TYPE(float16_t, GL_HALF_FLOAT,        GLSL_TYPE_FLOAT16, 1, 1)
> 
> GL_AMD_gpu_shader_half_float defines this as GL_FLOAT16_NV, not
> GL_HALF_FLOAT. That's also consistent with the vec2+ types...
> 

True. It is more consistent that way, and it is not too important
whether we use one or the other. I will change it.

Thanks, Ilia.

Eduardo

>   -ilia
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
> 



More information about the mesa-dev mailing list