[Mesa-dev] [PATCH 02/45] glsl: Add 16-bit types
Jason Ekstrand
jason at jlekstrand.net
Thu Aug 17 18:19:35 UTC 2017
On Thu, Aug 17, 2017 at 7:20 AM, Jason Ekstrand <jason at jlekstrand.net>
wrote:
> On Thu, Aug 17, 2017 at 1:35 AM, Eduardo Lima Mitev <elima at igalia.com>
> wrote:
>
>> On 08/15/2017 10:56 PM, Jason Ekstrand wrote:
>> >
>> > On Thu, Jul 13, 2017 at 7:35 AM, Alejandro Piñeiro <
>> apinheiro at igalia.com
>> > <mailto:apinheiro at igalia.com>> wrote:
>> >
>> > From: Eduardo Lima Mitev <elima at igalia.com <mailto:elima at igalia.com
>> >>
>> >
>> > Adds new INT16, UINT16 and HALF FLOAT 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 quite 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.
>> >
>> > Signed-off-by: Jose Maria Casanova Crespo <jmcasanova at igalia.com
>> > <mailto:jmcasanova at igalia.com>>
>> > Signed-off-by: Eduardo Lima <elima at igalia.com <mailto:
>> elima at igalia.com>>
>> > Signed-off-by: Alejandro Piñeiro <apinheiro at igalia.com
>> > <mailto:apinheiro at igalia.com>>
>> > ---
>> > src/compiler/builtin_type_macros.h | 26 +++++++
>> > src/compiler/glsl/ast_to_hir.cpp | 3 +
>> > src/compiler/glsl/builtin_types.cpp | 1 +
>> > src/compiler/glsl/ir_clone.cpp | 3 +
>> > src/compiler/glsl/link_uniform_initializers.cpp | 3 +
>> > src/compiler/glsl/lower_buffer_access.cpp | 16 ++++-
>> > src/compiler/glsl_types.cpp | 93
>> > ++++++++++++++++++++++++-
>> > src/compiler/glsl_types.h | 10 ++-
>> > src/mesa/program/ir_to_mesa.cpp | 6 ++
>> > 9 files changed, 155 insertions(+), 6 deletions(-)
>> >
>> > diff --git a/src/compiler/builtin_type_macros.h
>> > b/src/compiler/builtin_type_macros.h
>> > index a275617..52bae13 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_HALF_FLOAT, 1, 1)
>> > +DECL_TYPE(f16vec2, GL_FLOAT16_VEC2_NV, GLSL_TYPE_HALF_FLOAT,
>> 2, 1)
>> > +DECL_TYPE(f16vec3, GL_FLOAT16_VEC3_NV, GLSL_TYPE_HALF_FLOAT,
>> 3, 1)
>> > +DECL_TYPE(f16vec4, GL_FLOAT16_VEC4_NV, GLSL_TYPE_HALF_FLOAT,
>> 4, 1)
>> > +
>> > +DECL_TYPE(f16mat2, GL_FLOAT16_MAT2_AMD, GLSL_TYPE_HALF_FLOAT,
>> 2, 2)
>> > +DECL_TYPE(f16mat3, GL_FLOAT16_MAT3_AMD, GLSL_TYPE_HALF_FLOAT,
>> 3, 3)
>> > +DECL_TYPE(f16mat4, GL_FLOAT16_MAT4_AMD, GLSL_TYPE_HALF_FLOAT,
>> 4, 4)
>> > +
>> > +DECL_TYPE(f16mat2x3, GL_FLOAT16_MAT2x3_AMD, GLSL_TYPE_HALF_FLOAT,
>> 3, 2)
>> > +DECL_TYPE(f16mat2x4, GL_FLOAT16_MAT2x4_AMD, GLSL_TYPE_HALF_FLOAT,
>> 4, 2)
>> > +DECL_TYPE(f16mat3x2, GL_FLOAT16_MAT3x2_AMD, GLSL_TYPE_HALF_FLOAT,
>> 2, 3)
>> > +DECL_TYPE(f16mat3x4, GL_FLOAT16_MAT3x4_AMD, GLSL_TYPE_HALF_FLOAT,
>> 4, 3)
>> > +DECL_TYPE(f16mat4x2, GL_FLOAT16_MAT4x2_AMD, GLSL_TYPE_HALF_FLOAT,
>> 2, 4)
>> > +DECL_TYPE(f16mat4x3, GL_FLOAT16_MAT4x3_AMD, GLSL_TYPE_HALF_FLOAT,
>> 3, 4)
>> > +
>> > DECL_TYPE(double, GL_DOUBLE, GLSL_TYPE_DOUBLE, 1, 1)
>> > DECL_TYPE(dvec2, GL_DOUBLE_VEC2, GLSL_TYPE_DOUBLE, 2, 1)
>> > DECL_TYPE(dvec3, GL_DOUBLE_VEC3, GLSL_TYPE_DOUBLE, 3, 1)
>> > @@ -88,6 +104,16 @@ DECL_TYPE(u64vec2, GL_UNSIGNED_INT64_VEC2_ARB,
>> > GLSL_TYPE_UINT64, 2, 1)
>> > DECL_TYPE(u64vec3, GL_UNSIGNED_INT64_VEC3_ARB, GLSL_TYPE_UINT64,
>> 3, 1)
>> > DECL_TYPE(u64vec4, GL_UNSIGNED_INT64_VEC4_ARB, GLSL_TYPE_UINT64,
>> 4, 1)
>> >
>> > +DECL_TYPE(int16_t, GL_INT16_NV, GLSL_TYPE_INT16, 1, 1)
>> > +DECL_TYPE(i16vec2, GL_INT16_VEC2_NV, GLSL_TYPE_INT16, 2, 1)
>> > +DECL_TYPE(i16vec3, GL_INT16_VEC3_NV, GLSL_TYPE_INT16, 3, 1)
>> > +DECL_TYPE(i16vec4, GL_INT16_VEC4_NV, GLSL_TYPE_INT16, 4, 1)
>> > +
>> > +DECL_TYPE(uint16_t, GL_UNSIGNED_INT16_NV, GLSL_TYPE_UINT16,
>> 1, 1)
>> > +DECL_TYPE(u16vec2, GL_UNSIGNED_INT16_VEC2_NV, GLSL_TYPE_UINT16,
>> 2, 1)
>> > +DECL_TYPE(u16vec3, GL_UNSIGNED_INT16_VEC3_NV, GLSL_TYPE_UINT16,
>> 3, 1)
>> > +DECL_TYPE(u16vec4, GL_UNSIGNED_INT16_VEC4_NV, GLSL_TYPE_UINT16,
>> 4, 1)
>> > +
>> > DECL_TYPE(sampler, GL_SAMPLER_1D,
>> > GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_1D, 0, 0, GLSL_TYPE_VOID)
>> > DECL_TYPE(sampler1D, GL_SAMPLER_1D,
>> > GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_1D, 0, 0, GLSL_TYPE_FLOAT)
>> > DECL_TYPE(sampler2D, GL_SAMPLER_2D,
>> > GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_2D, 0, 0, GLSL_TYPE_FLOAT)
>> > diff --git a/src/compiler/glsl/ast_to_hir.cpp
>> > b/src/compiler/glsl/ast_to_hir.cpp
>> > index c338ad7..4f6a324 100644
>> > --- a/src/compiler/glsl/ast_to_hir.cpp
>> > +++ b/src/compiler/glsl/ast_to_hir.cpp
>> > @@ -1108,12 +1108,15 @@ do_comparison(void *mem_ctx, int operation,
>> > ir_rvalue *op0, ir_rvalue *op1)
>> >
>> > switch (op0->type->base_type) {
>> > case GLSL_TYPE_FLOAT:
>> > + case GLSL_TYPE_HALF_FLOAT:
>> >
>> >
>> > How would you feel about calling this FLOAT16? That's more consistent
>> > with the integer enums though it is a bit different than double. In
>> > general, I'm a fan of base+bits naming.
>> >
>>
>> I don't have a strong preference here. I chose HALF_FLOAT because that's
>> how the GL(ES) specs refer to the type. I'm fine with FLOAT16, but I
>> would like to hear more opinions since it will imply updating quite a
>> few patches in this series.
>
>
> Understood. I'll see if I can dig up a few more opinions.
>
FYI, there's a neat trick you can use for making these sorts of changes to
a patch series:
1) Use git format-patch to dump the series to a directory
2) Use sed to do the search+replace operation on the patches
3) Use git am to reapply the modified patches
I've done that several times to do mass renames on a patch series and it
usually works quite well.
--Jason
>
>> >
>> > case GLSL_TYPE_UINT:
>> > case GLSL_TYPE_INT:
>> > case GLSL_TYPE_BOOL:
>> > case GLSL_TYPE_DOUBLE:
>> > case GLSL_TYPE_UINT64:
>> > case GLSL_TYPE_INT64:
>> > + case GLSL_TYPE_UINT16:
>> > + case GLSL_TYPE_INT16:
>> > return new(mem_ctx) ir_expression(operation, op0, op1);
>> >
>> > case GLSL_TYPE_ARRAY: {
>> > diff --git a/src/compiler/glsl/builtin_types.cpp
>> > b/src/compiler/glsl/builtin_types.cpp
>> > index cae972b..4071e31 100644
>> > --- a/src/compiler/glsl/builtin_types.cpp
>> > +++ b/src/compiler/glsl/builtin_types.cpp
>> > @@ -144,6 +144,7 @@ static const struct builtin_type_versions {
>> > T(uvec3, 130, 300)
>> > T(uvec4, 130, 300)
>> > T(float, 110, 100)
>> > + T(float16_t, 330, 300)
>> >
>> >
>> > I don't think float16_t is a builtin type in any version.
>> >
>>
>> True, this is old boilerplate I somehow forgot to erase.
>>
>> >
>> > T(vec2, 110, 100)
>> > T(vec3, 110, 100)
>> > T(vec4, 110, 100)
>> > diff --git a/src/compiler/glsl/ir_clone.cpp
>> > b/src/compiler/glsl/ir_clone.cpp
>> > index a64c7af..54421a3 100644
>> > --- a/src/compiler/glsl/ir_clone.cpp
>> > +++ b/src/compiler/glsl/ir_clone.cpp
>> > @@ -335,10 +335,13 @@ ir_constant::clone(void *mem_ctx, struct
>> > hash_table *ht) const
>> > case GLSL_TYPE_UINT:
>> > case GLSL_TYPE_INT:
>> > case GLSL_TYPE_FLOAT:
>> > + case GLSL_TYPE_HALF_FLOAT:
>> > case GLSL_TYPE_DOUBLE:
>> > case GLSL_TYPE_BOOL:
>> > case GLSL_TYPE_UINT64:
>> > case GLSL_TYPE_INT64:
>> > + case GLSL_TYPE_UINT16:
>> > + case GLSL_TYPE_INT16:
>> > case GLSL_TYPE_SAMPLER:
>> > case GLSL_TYPE_IMAGE:
>> > return new(mem_ctx) ir_constant(this->type, &this->value);
>> > diff --git a/src/compiler/glsl/link_uniform_initializers.cpp
>> > b/src/compiler/glsl/link_uniform_initializers.cpp
>> > index e7f9c9d..448e31c 100644
>> > --- a/src/compiler/glsl/link_uniform_initializers.cpp
>> > +++ b/src/compiler/glsl/link_uniform_initializers.cpp
>> > @@ -54,13 +54,16 @@ copy_constant_to_storage(union gl_constant_value
>> > *storage,
>> > for (unsigned int i = 0; i < elements; i++) {
>> > switch (base_type) {
>> > case GLSL_TYPE_UINT:
>> > + case GLSL_TYPE_UINT16:
>> > storage[i].u = val->value.u[i];
>> > break;
>> > case GLSL_TYPE_INT:
>> > + case GLSL_TYPE_INT16:
>> > case GLSL_TYPE_SAMPLER:
>> > storage[i].i = val->value.i[i];
>> > break;
>> > case GLSL_TYPE_FLOAT:
>> > + case GLSL_TYPE_HALF_FLOAT:
>> >
>> >
>> > This doesn't look right. I think it's better to just let these hit the
>> > unreachable().
>> >
>> >
>>
>> Right, fixed locally.
>>
>> At the beginning I considered adding all the new base types to the
>> default/unhandled case of the switches, then add correct implementations
>> incrementally. But because there are many switches and the correct
>> implementation of some of them were trivial, we decided to handle most
>> of them already in this patch.
>>
>> It would be a bit of pain to revert that decision now, but if that will
>> really help reviewing this rather long patch, we can consider doing that
>> for its V2.
>>
>
> I think that's probably fine. This is the only one I saw in this patch
> that looked like it was actually wrong. I'll just be careful while
> reviewing.
>
>
>> > storage[i].f = val->value.f[i];
>> > break;
>> > case GLSL_TYPE_DOUBLE:
>> > diff --git a/src/compiler/glsl/lower_buffer_access.cpp
>> > b/src/compiler/glsl/lower_buffer_access.cpp
>> > index 24a96e2..51a540c 100644
>> > --- a/src/compiler/glsl/lower_buffer_access.cpp
>> > +++ b/src/compiler/glsl/lower_buffer_access.cpp
>> > @@ -199,8 +199,20 @@ lower_buffer_access::emit_access(void
>> *mem_ctx,
>> > else
>> > matrix_stride = glsl_align(matrix_columns * N, 16);
>> >
>> > - const glsl_type *deref_type = deref->type->is_float() ?
>> > - glsl_type::float_type : glsl_type::double_type;
>> > + const glsl_type *deref_type;
>> > + switch (deref->type->base_type) {
>> > + case GLSL_TYPE_FLOAT:
>> > + deref_type = glsl_type::float_type;
>> > + break;
>> > + case GLSL_TYPE_HALF_FLOAT:
>> > + deref_type = glsl_type::float16_t_type;
>> > + break;
>> > + case GLSL_TYPE_DOUBLE:
>> > + deref_type = glsl_type::double_type;
>> > + break;
>> > + default:
>> > + assert(!"Invalid type");
>> >
>> >
>> > Why not just make this deref->type->get_scalar_type() or
>> get_base_type()?
>> >
>>
>> Yes, get_scalar_type() it is. Fixed.
>>
>> >
>> > + }
>> >
>> > for (unsigned i = 0; i < deref->type->vector_elements; i++) {
>> > ir_rvalue *chan_offset =
>> > diff --git a/src/compiler/glsl_types.cpp
>> b/src/compiler/glsl_types.cpp
>> > index 188b72f..8af0e25 100644
>> > --- a/src/compiler/glsl_types.cpp
>> > +++ b/src/compiler/glsl_types.cpp
>> > @@ -355,10 +355,16 @@ const glsl_type *glsl_type::get_base_type()
>> const
>> > switch (base_type) {
>> > case GLSL_TYPE_UINT:
>> > return uint_type;
>> > + case GLSL_TYPE_UINT16:
>> > + return uint16_t_type;
>> > case GLSL_TYPE_INT:
>> > return int_type;
>> > + case GLSL_TYPE_INT16:
>> > + return int16_t_type;
>> > case GLSL_TYPE_FLOAT:
>> > return float_type;
>> > + case GLSL_TYPE_HALF_FLOAT:
>> > + return float16_t_type;
>> > case GLSL_TYPE_DOUBLE:
>> > return double_type;
>> > case GLSL_TYPE_BOOL:
>> > @@ -385,10 +391,16 @@ const glsl_type *glsl_type::get_scalar_type()
>> > const
>> > switch (type->base_type) {
>> > case GLSL_TYPE_UINT:
>> > return uint_type;
>> > + case GLSL_TYPE_UINT16:
>> > + return uint16_t_type;
>> > case GLSL_TYPE_INT:
>> > return int_type;
>> > + case GLSL_TYPE_INT16:
>> > + return int16_t_type;
>> > case GLSL_TYPE_FLOAT:
>> > return float_type;
>> > + case GLSL_TYPE_HALF_FLOAT:
>> > + return float16_t_type;
>> > case GLSL_TYPE_DOUBLE:
>> > return double_type;
>> > case GLSL_TYPE_BOOL:
>> > @@ -499,6 +511,18 @@ glsl_type::vec(unsigned components)
>> > }
>> >
>> > const glsl_type *
>> > +glsl_type::f16vec(unsigned components)
>> > +{
>> > + if (components == 0 || components > 4)
>> > + return error_type;
>> > +
>> > + static const glsl_type *const ts[] = {
>> > + float16_t_type, f16vec2_type, f16vec3_type, f16vec4_type
>> > + };
>> > + return ts[components - 1];
>> > +}
>> > +
>> > +const glsl_type *
>> > glsl_type::dvec(unsigned components)
>> > {
>> > if (components == 0 || components > 4)
>> > @@ -575,6 +599,31 @@ glsl_type::u64vec(unsigned components)
>> > }
>> >
>> > const glsl_type *
>> > +glsl_type::i16vec(unsigned components)
>> > +{
>> > + if (components == 0 || components > 4)
>> > + return error_type;
>> > +
>> > + static const glsl_type *const ts[] = {
>> > + int16_t_type, i16vec2_type, i16vec3_type, i16vec4_type
>> > + };
>> > + return ts[components - 1];
>> > +}
>> > +
>> > +
>> > +const glsl_type *
>> > +glsl_type::u16vec(unsigned components)
>> > +{
>> > + if (components == 0 || components > 4)
>> > + return error_type;
>> > +
>> > + static const glsl_type *const ts[] = {
>> > + uint16_t_type, u16vec2_type, u16vec3_type, u16vec4_type
>> > + };
>> > + return ts[components - 1];
>> > +}
>> > +
>> > +const glsl_type *
>> > glsl_type::get_instance(unsigned base_type, unsigned rows,
>> unsigned
>> > columns)
>> > {
>> > if (base_type == GLSL_TYPE_VOID)
>> > @@ -593,6 +642,8 @@ glsl_type::get_instance(unsigned base_type,
>> > unsigned rows, unsigned columns)
>> > return ivec(rows);
>> > case GLSL_TYPE_FLOAT:
>> > return vec(rows);
>> > + case GLSL_TYPE_HALF_FLOAT:
>> > + return f16vec(rows);
>> > case GLSL_TYPE_DOUBLE:
>> > return dvec(rows);
>> > case GLSL_TYPE_BOOL:
>> > @@ -601,11 +652,17 @@ glsl_type::get_instance(unsigned base_type,
>> > unsigned rows, unsigned columns)
>> > return u64vec(rows);
>> > case GLSL_TYPE_INT64:
>> > return i64vec(rows);
>> > + case GLSL_TYPE_UINT16:
>> > + return u16vec(rows);
>> > + case GLSL_TYPE_INT16:
>> > + return i16vec(rows);
>> > default:
>> > return error_type;
>> > }
>> > } else {
>> > - if ((base_type != GLSL_TYPE_FLOAT && base_type !=
>> > GLSL_TYPE_DOUBLE) || (rows == 1))
>> > + if ((base_type != GLSL_TYPE_FLOAT &&
>> > + base_type != GLSL_TYPE_DOUBLE &&
>> > + base_type != GLSL_TYPE_HALF_FLOAT) || (rows == 1))
>> > return error_type;
>> >
>> > /* GLSL matrix types are named mat{COLUMNS}x{ROWS}. Only the
>> > following
>> > @@ -619,7 +676,8 @@ glsl_type::get_instance(unsigned base_type,
>> > unsigned rows, unsigned columns)
>> > */
>> > #define IDX(c,r) (((c-1)*3) + (r-1))
>> >
>> > - if (base_type == GLSL_TYPE_DOUBLE) {
>> > + switch (base_type) {
>> > + case GLSL_TYPE_DOUBLE: {
>> > switch (IDX(columns, rows)) {
>> > case IDX(2,2): return dmat2_type;
>> > case IDX(2,3): return dmat2x3_type;
>> > @@ -632,7 +690,8 @@ glsl_type::get_instance(unsigned base_type,
>> > unsigned rows, unsigned columns)
>> > case IDX(4,4): return dmat4_type;
>> > default: return error_type;
>> > }
>> > - } else {
>> > + }
>> > + case GLSL_TYPE_FLOAT: {
>> > switch (IDX(columns, rows)) {
>> > case IDX(2,2): return mat2_type;
>> > case IDX(2,3): return mat2x3_type;
>> > @@ -646,6 +705,22 @@ glsl_type::get_instance(unsigned base_type,
>> > unsigned rows, unsigned columns)
>> > default: return error_type;
>> > }
>> > }
>> > + case GLSL_TYPE_HALF_FLOAT: {
>> > + switch (IDX(columns, rows)) {
>> > + case IDX(2,2): return f16mat2_type;
>> > + case IDX(2,3): return f16mat2x3_type;
>> > + case IDX(2,4): return f16mat2x4_type;
>> > + case IDX(3,2): return f16mat3x2_type;
>> > + case IDX(3,3): return f16mat3_type;
>> > + case IDX(3,4): return f16mat3x4_type;
>> > + case IDX(4,2): return f16mat4x2_type;
>> > + case IDX(4,3): return f16mat4x3_type;
>> > + case IDX(4,4): return f16mat4_type;
>> > + default: return error_type;
>> > + }
>> > + }
>> > + default: return error_type;
>> > + }
>> > }
>> >
>> > assert(!"Should not get here.");
>> > @@ -1282,7 +1357,10 @@ glsl_type::component_slots() const
>> > switch (this->base_type) {
>> > case GLSL_TYPE_UINT:
>> > case GLSL_TYPE_INT:
>> > + case GLSL_TYPE_UINT16:
>> > + case GLSL_TYPE_INT16:
>> > case GLSL_TYPE_FLOAT:
>> > + case GLSL_TYPE_HALF_FLOAT:
>> > case GLSL_TYPE_BOOL:
>> > return this->components();
>> >
>> > @@ -1371,7 +1449,10 @@ glsl_type::uniform_locations() const
>> > case GLSL_TYPE_UINT:
>> > case GLSL_TYPE_INT:
>> > case GLSL_TYPE_FLOAT:
>> > + case GLSL_TYPE_HALF_FLOAT:
>> > case GLSL_TYPE_DOUBLE:
>> > + case GLSL_TYPE_UINT16:
>> > + case GLSL_TYPE_INT16:
>> > case GLSL_TYPE_UINT64:
>> > case GLSL_TYPE_INT64:
>> > case GLSL_TYPE_BOOL:
>> > @@ -1401,8 +1482,11 @@ glsl_type::varying_count() const
>> > case GLSL_TYPE_UINT:
>> > case GLSL_TYPE_INT:
>> > case GLSL_TYPE_FLOAT:
>> > + case GLSL_TYPE_HALF_FLOAT:
>> > case GLSL_TYPE_DOUBLE:
>> > case GLSL_TYPE_BOOL:
>> > + case GLSL_TYPE_UINT16:
>> > + case GLSL_TYPE_INT16:
>> > case GLSL_TYPE_UINT64:
>> > case GLSL_TYPE_INT64:
>> > return 1;
>> > @@ -1974,7 +2058,10 @@ glsl_type::count_attribute_slots(bool
>> > is_vertex_input) const
>> > switch (this->base_type) {
>> > case GLSL_TYPE_UINT:
>> > case GLSL_TYPE_INT:
>> > + case GLSL_TYPE_UINT16:
>> > + case GLSL_TYPE_INT16:
>> > case GLSL_TYPE_FLOAT:
>> > + case GLSL_TYPE_HALF_FLOAT:
>> > case GLSL_TYPE_BOOL:
>> > case GLSL_TYPE_SAMPLER:
>> > case GLSL_TYPE_IMAGE:
>> > diff --git a/src/compiler/glsl_types.h b/src/compiler/glsl_types.h
>> > index 2857dc9..8ebf2f4 100644
>> > --- a/src/compiler/glsl_types.h
>> > +++ b/src/compiler/glsl_types.h
>> > @@ -52,7 +52,10 @@ enum glsl_base_type {
>> > GLSL_TYPE_UINT = 0,
>> > GLSL_TYPE_INT,
>> > GLSL_TYPE_FLOAT,
>> > + GLSL_TYPE_HALF_FLOAT,
>> > GLSL_TYPE_DOUBLE,
>> > + GLSL_TYPE_UINT16,
>> > + GLSL_TYPE_INT16,
>> > GLSL_TYPE_UINT64,
>> > GLSL_TYPE_INT64,
>> > GLSL_TYPE_BOOL,
>> > @@ -237,12 +240,15 @@ struct glsl_type {
>> > * @{
>> > */
>> > static const glsl_type *vec(unsigned components);
>> > + static const glsl_type *f16vec(unsigned components);
>> > static const glsl_type *dvec(unsigned components);
>> > static const glsl_type *ivec(unsigned components);
>> > static const glsl_type *uvec(unsigned components);
>> > static const glsl_type *bvec(unsigned components);
>> > static const glsl_type *i64vec(unsigned components);
>> > static const glsl_type *u64vec(unsigned components);
>> > + static const glsl_type *i16vec(unsigned components);
>> > + static const glsl_type *u16vec(unsigned components);
>> > /**@}*/
>> >
>> > /**
>> > @@ -472,7 +478,9 @@ struct glsl_type {
>> > bool is_matrix() const
>> > {
>> > /* GLSL only has float matrices. */
>> > - return (matrix_columns > 1) && (base_type == GLSL_TYPE_FLOAT
>> > || base_type == GLSL_TYPE_DOUBLE);
>> > + return (matrix_columns > 1) && (base_type == GLSL_TYPE_FLOAT
>> > + || base_type ==
>> GLSL_TYPE_DOUBLE
>> > + || base_type ==
>> > GLSL_TYPE_HALF_FLOAT);
>> > }
>> >
>> > /**
>> > diff --git a/src/mesa/program/ir_to_mesa.cpp
>> > b/src/mesa/program/ir_to_mesa.cpp
>> > index ac12b59..c92bdbf 100644
>> > --- a/src/mesa/program/ir_to_mesa.cpp
>> > +++ b/src/mesa/program/ir_to_mesa.cpp
>> > @@ -507,7 +507,10 @@ type_size(const struct glsl_type *type)
>> > switch (type->base_type) {
>> > case GLSL_TYPE_UINT:
>> > case GLSL_TYPE_INT:
>> > + case GLSL_TYPE_UINT16:
>> > + case GLSL_TYPE_INT16:
>> > case GLSL_TYPE_FLOAT:
>> > + case GLSL_TYPE_HALF_FLOAT:
>> > case GLSL_TYPE_BOOL:
>> > if (type->is_matrix()) {
>> > return type->matrix_columns;
>> > @@ -2536,6 +2539,7 @@ _mesa_associate_uniform_storage(struct
>> > gl_context *ctx,
>> > dmul *= 2;
>> > /* fallthrough */
>> > case GLSL_TYPE_UINT:
>> > + case GLSL_TYPE_UINT16:
>> > assert(ctx->Const.NativeIntegers);
>> > format = uniform_native;
>> > columns = 1;
>> > @@ -2545,6 +2549,7 @@ _mesa_associate_uniform_storage(struct
>> > gl_context *ctx,
>> > dmul *= 2;
>> > /* fallthrough */
>> > case GLSL_TYPE_INT:
>> > + case GLSL_TYPE_INT16:
>> > format =
>> > (ctx->Const.NativeIntegers) ? uniform_native :
>> > uniform_int_float;
>> > columns = 1;
>> > @@ -2554,6 +2559,7 @@ _mesa_associate_uniform_storage(struct
>> > gl_context *ctx,
>> > dmul *= 2;
>> > /* fallthrough */
>> > case GLSL_TYPE_FLOAT:
>> > + case GLSL_TYPE_HALF_FLOAT:
>> > format = uniform_native;
>> > columns = storage->type->matrix_columns;
>> > break;
>> > --
>> > 2.9.3
>> >
>> > _______________________________________________
>> > mesa-dev mailing list
>> > mesa-dev at lists.freedesktop.org <mailto:mesa-dev at lists.freedes
>> ktop.org>
>> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>> > <https://lists.freedesktop.org/mailman/listinfo/mesa-dev>
>> >
>> >
>> >
>> >
>> > _______________________________________________
>> > mesa-dev mailing list
>> > mesa-dev at lists.freedesktop.org
>> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>> >
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170817/ad2a65e2/attachment-0001.html>
More information about the mesa-dev
mailing list