<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Aug 17, 2017 at 7:20 AM, Jason Ekstrand <span dir="ltr"><<a href="mailto:jason@jlekstrand.net" target="_blank">jason@jlekstrand.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div class="h5">On Thu, Aug 17, 2017 at 1:35 AM, Eduardo Lima Mitev <span dir="ltr"><<a href="mailto:elima@igalia.com" target="_blank">elima@igalia.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>On 08/15/2017 10:56 PM, Jason Ekstrand wrote:<br>
><br>
> On Thu, Jul 13, 2017 at 7:35 AM, Alejandro Piñeiro <<a href="mailto:apinheiro@igalia.com" target="_blank">apinheiro@igalia.com</a><br>
</span>> <mailto:<a href="mailto:apinheiro@igalia.com" target="_blank">apinheiro@igalia.com</a>>> wrote:<br>
><br>
> From: Eduardo Lima Mitev <<a href="mailto:elima@igalia.com" target="_blank">elima@igalia.com</a> <mailto:<a href="mailto:elima@igalia.com" target="_blank">elima@igalia.com</a>>><br>
<span>><br>
> Adds new INT16, UINT16 and HALF FLOAT base types.<br>
><br>
> The corresponding GL types for half floats were reused from the<br>
> AMD_gpu_shader_half_float extension. The int16 and uint16 types come<br>
> from<br>
> NV_gpu_shader_5 extension.<br>
><br>
> This adds the builtins and the lexer support.<br>
><br>
> To avoid a bunch of warnings due to cases not handled in switch, the<br>
> new types have been added to quite a few places using same behavior as<br>
> their 32-bit counterparts, except for a few trivial cases where they are<br>
> already handled properly. Subsequent patches in this set will provide<br>
> correct 16-bit implementations when needed.<br>
><br>
> Signed-off-by: Jose Maria Casanova Crespo <<a href="mailto:jmcasanova@igalia.com" target="_blank">jmcasanova@igalia.com</a><br>
</span>> <mailto:<a href="mailto:jmcasanova@igalia.com" target="_blank">jmcasanova@igalia.com</a><wbr>>><br>
> Signed-off-by: Eduardo Lima <<a href="mailto:elima@igalia.com" target="_blank">elima@igalia.com</a> <mailto:<a href="mailto:elima@igalia.com" target="_blank">elima@igalia.com</a>>><br>
> Signed-off-by: Alejandro Piñeiro <<a href="mailto:apinheiro@igalia.com" target="_blank">apinheiro@igalia.com</a><br>
> <mailto:<a href="mailto:apinheiro@igalia.com" target="_blank">apinheiro@igalia.com</a>><wbr>><br>
<div><div class="m_2470120782421798583h5">> ---<br>
> src/compiler/builtin_type_macr<wbr>os.h | 26 +++++++<br>
> src/compiler/glsl/ast_to_hir.c<wbr>pp | 3 +<br>
> src/compiler/glsl/builtin_type<wbr>s.cpp | 1 +<br>
> src/compiler/glsl/ir_clone.<wbr>cpp | 3 +<br>
> src/compiler/glsl/link_uniform<wbr>_initializers.cpp | 3 +<br>
> src/compiler/glsl/lower_buffer<wbr>_access.cpp | 16 ++++-<br>
> src/compiler/glsl_types.cpp | 93<br>
> ++++++++++++++++++++++++-<br>
> src/compiler/glsl_types.h | 10 ++-<br>
> src/mesa/program/ir_to_mesa.cp<wbr>p | 6 ++<br>
> 9 files changed, 155 insertions(+), 6 deletions(-)<br>
><br>
> diff --git a/src/compiler/builtin_type_ma<wbr>cros.h<br>
> b/src/compiler/builtin_type_m<wbr>acros.h<br>
> index a275617..52bae13 100644<br>
> --- a/src/compiler/builtin_type_ma<wbr>cros.h<br>
> +++ b/src/compiler/builtin_type_ma<wbr>cros.h<br>
> @@ -62,6 +62,22 @@ DECL_TYPE(mat3x4, GL_FLOAT_MAT3x4,<br>
> GLSL_TYPE_FLOAT, 4, 3)<br>
> DECL_TYPE(mat4x2, GL_FLOAT_MAT4x2, GLSL_TYPE_FLOAT, 2, 4)<br>
> DECL_TYPE(mat4x3, GL_FLOAT_MAT4x3, GLSL_TYPE_FLOAT, 3, 4)<br>
><br>
> +DECL_TYPE(float16_t, GL_HALF_FLOAT, GLSL_TYPE_HALF_FLOAT, 1, 1)<br>
> +DECL_TYPE(f16vec2, GL_FLOAT16_VEC2_NV, GLSL_TYPE_HALF_FLOAT, 2, 1)<br>
> +DECL_TYPE(f16vec3, GL_FLOAT16_VEC3_NV, GLSL_TYPE_HALF_FLOAT, 3, 1)<br>
> +DECL_TYPE(f16vec4, GL_FLOAT16_VEC4_NV, GLSL_TYPE_HALF_FLOAT, 4, 1)<br>
> +<br>
> +DECL_TYPE(f16mat2, GL_FLOAT16_MAT2_AMD, GLSL_TYPE_HALF_FLOAT, 2, 2)<br>
> +DECL_TYPE(f16mat3, GL_FLOAT16_MAT3_AMD, GLSL_TYPE_HALF_FLOAT, 3, 3)<br>
> +DECL_TYPE(f16mat4, GL_FLOAT16_MAT4_AMD, GLSL_TYPE_HALF_FLOAT, 4, 4)<br>
> +<br>
> +DECL_TYPE(f16mat2x3, GL_FLOAT16_MAT2x3_AMD, GLSL_TYPE_HALF_FLOAT, 3, 2)<br>
> +DECL_TYPE(f16mat2x4, GL_FLOAT16_MAT2x4_AMD, GLSL_TYPE_HALF_FLOAT, 4, 2)<br>
> +DECL_TYPE(f16mat3x2, GL_FLOAT16_MAT3x2_AMD, GLSL_TYPE_HALF_FLOAT, 2, 3)<br>
> +DECL_TYPE(f16mat3x4, GL_FLOAT16_MAT3x4_AMD, GLSL_TYPE_HALF_FLOAT, 4, 3)<br>
> +DECL_TYPE(f16mat4x2, GL_FLOAT16_MAT4x2_AMD, GLSL_TYPE_HALF_FLOAT, 2, 4)<br>
> +DECL_TYPE(f16mat4x3, GL_FLOAT16_MAT4x3_AMD, GLSL_TYPE_HALF_FLOAT, 3, 4)<br>
> +<br>
> DECL_TYPE(double, GL_DOUBLE, GLSL_TYPE_DOUBLE, 1, 1)<br>
> DECL_TYPE(dvec2, GL_DOUBLE_VEC2, GLSL_TYPE_DOUBLE, 2, 1)<br>
> DECL_TYPE(dvec3, GL_DOUBLE_VEC3, GLSL_TYPE_DOUBLE, 3, 1)<br>
> @@ -88,6 +104,16 @@ DECL_TYPE(u64vec2, GL_UNSIGNED_INT64_VEC2_ARB,<br>
> GLSL_TYPE_UINT64, 2, 1)<br>
> DECL_TYPE(u64vec3, GL_UNSIGNED_INT64_VEC3_ARB, GLSL_TYPE_UINT64, 3, 1)<br>
> DECL_TYPE(u64vec4, GL_UNSIGNED_INT64_VEC4_ARB, GLSL_TYPE_UINT64, 4, 1)<br>
><br>
> +DECL_TYPE(int16_t, GL_INT16_NV, GLSL_TYPE_INT16, 1, 1)<br>
> +DECL_TYPE(i16vec2, GL_INT16_VEC2_NV, GLSL_TYPE_INT16, 2, 1)<br>
> +DECL_TYPE(i16vec3, GL_INT16_VEC3_NV, GLSL_TYPE_INT16, 3, 1)<br>
> +DECL_TYPE(i16vec4, GL_INT16_VEC4_NV, GLSL_TYPE_INT16, 4, 1)<br>
> +<br>
> +DECL_TYPE(uint16_t, GL_UNSIGNED_INT16_NV, GLSL_TYPE_UINT16, 1, 1)<br>
> +DECL_TYPE(u16vec2, GL_UNSIGNED_INT16_VEC2_NV, GLSL_TYPE_UINT16, 2, 1)<br>
> +DECL_TYPE(u16vec3, GL_UNSIGNED_INT16_VEC3_NV, GLSL_TYPE_UINT16, 3, 1)<br>
> +DECL_TYPE(u16vec4, GL_UNSIGNED_INT16_VEC4_NV, GLSL_TYPE_UINT16, 4, 1)<br>
> +<br>
> DECL_TYPE(sampler, GL_SAMPLER_1D,<br>
> GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_1D, 0, 0, GLSL_TYPE_VOID)<br>
> DECL_TYPE(sampler1D, GL_SAMPLER_1D,<br>
> GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_1D, 0, 0, GLSL_TYPE_FLOAT)<br>
> DECL_TYPE(sampler2D, GL_SAMPLER_2D,<br>
> GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_2D, 0, 0, GLSL_TYPE_FLOAT)<br>
> diff --git a/src/compiler/glsl/ast_to_hir<wbr>.cpp<br>
> b/src/compiler/glsl/ast_to_hi<wbr>r.cpp<br>
> index c338ad7..4f6a324 100644<br>
> --- a/src/compiler/glsl/ast_to_hir<wbr>.cpp<br>
> +++ b/src/compiler/glsl/ast_to_hir<wbr>.cpp<br>
> @@ -1108,12 +1108,15 @@ do_comparison(void *mem_ctx, int operation,<br>
> ir_rvalue *op0, ir_rvalue *op1)<br>
><br>
> switch (op0->type->base_type) {<br>
> case GLSL_TYPE_FLOAT:<br>
> + case GLSL_TYPE_HALF_FLOAT:<br>
><br>
><br>
> How would you feel about calling this FLOAT16? That's more consistent<br>
> with the integer enums though it is a bit different than double. In<br>
> general, I'm a fan of base+bits naming.<br>
><br>
<br>
</div></div>I don't have a strong preference here. I chose HALF_FLOAT because that's<br>
how the GL(ES) specs refer to the type. I'm fine with FLOAT16, but I<br>
would like to hear more opinions since it will imply updating quite a<br>
few patches in this series.</blockquote><div><br></div></div></div><div>Understood. I'll see if I can dig up a few more opinions.<br></div></div></div></div></blockquote><div><br></div><div>FYI, there's a neat trick you can use for making these sorts of changes to a patch series:</div><div><br></div><div> 1) Use git format-patch to dump the series to a directory</div><div> 2) Use sed to do the search+replace operation on the patches</div><div> 3) Use git am to reapply the modified patches<br></div><div> </div><div>I've done that several times to do mass renames on a patch series and it usually works quite well.</div><div><br></div><div>--Jason<br></div><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div></div><div><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span><br>
><br>
> case GLSL_TYPE_UINT:<br>
> case GLSL_TYPE_INT:<br>
> case GLSL_TYPE_BOOL:<br>
> case GLSL_TYPE_DOUBLE:<br>
> case GLSL_TYPE_UINT64:<br>
> case GLSL_TYPE_INT64:<br>
> + case GLSL_TYPE_UINT16:<br>
> + case GLSL_TYPE_INT16:<br>
> return new(mem_ctx) ir_expression(operation, op0, op1);<br>
><br>
> case GLSL_TYPE_ARRAY: {<br>
> diff --git a/src/compiler/glsl/builtin_ty<wbr>pes.cpp<br>
> b/src/compiler/glsl/builtin_t<wbr>ypes.cpp<br>
> index cae972b..4071e31 100644<br>
> --- a/src/compiler/glsl/builtin_ty<wbr>pes.cpp<br>
> +++ b/src/compiler/glsl/builtin_ty<wbr>pes.cpp<br>
> @@ -144,6 +144,7 @@ static const struct builtin_type_versions {<br>
> T(uvec3, 130, 300)<br>
> T(uvec4, 130, 300)<br>
> T(float, 110, 100)<br>
> + T(float16_t, 330, 300)<br>
><br>
><br>
> I don't think float16_t is a builtin type in any version.<br>
><br>
<br>
</span>True, this is old boilerplate I somehow forgot to erase.<br>
<div><div class="m_2470120782421798583h5"><br>
><br>
> T(vec2, 110, 100)<br>
> T(vec3, 110, 100)<br>
> T(vec4, 110, 100)<br>
> diff --git a/src/compiler/glsl/ir_clone.c<wbr>pp<br>
> b/src/compiler/glsl/ir_clone.<wbr>cpp<br>
> index a64c7af..54421a3 100644<br>
> --- a/src/compiler/glsl/ir_clone.c<wbr>pp<br>
> +++ b/src/compiler/glsl/ir_clone.c<wbr>pp<br>
> @@ -335,10 +335,13 @@ ir_constant::clone(void *mem_ctx, struct<br>
> hash_table *ht) const<br>
> case GLSL_TYPE_UINT:<br>
> case GLSL_TYPE_INT:<br>
> case GLSL_TYPE_FLOAT:<br>
> + case GLSL_TYPE_HALF_FLOAT:<br>
> case GLSL_TYPE_DOUBLE:<br>
> case GLSL_TYPE_BOOL:<br>
> case GLSL_TYPE_UINT64:<br>
> case GLSL_TYPE_INT64:<br>
> + case GLSL_TYPE_UINT16:<br>
> + case GLSL_TYPE_INT16:<br>
> case GLSL_TYPE_SAMPLER:<br>
> case GLSL_TYPE_IMAGE:<br>
> return new(mem_ctx) ir_constant(this->type, &this->value);<br>
> diff --git a/src/compiler/glsl/link_unifo<wbr>rm_initializers.cpp<br>
> b/src/compiler/glsl/link_unif<wbr>orm_initializers.cpp<br>
> index e7f9c9d..448e31c 100644<br>
> --- a/src/compiler/glsl/link_unifo<wbr>rm_initializers.cpp<br>
> +++ b/src/compiler/glsl/link_unifo<wbr>rm_initializers.cpp<br>
> @@ -54,13 +54,16 @@ copy_constant_to_storage(union gl_constant_value<br>
> *storage,<br>
> for (unsigned int i = 0; i < elements; i++) {<br>
> switch (base_type) {<br>
> case GLSL_TYPE_UINT:<br>
> + case GLSL_TYPE_UINT16:<br>
> storage[i].u = val->value.u[i];<br>
> break;<br>
> case GLSL_TYPE_INT:<br>
> + case GLSL_TYPE_INT16:<br>
> case GLSL_TYPE_SAMPLER:<br>
> storage[i].i = val->value.i[i];<br>
> break;<br>
> case GLSL_TYPE_FLOAT:<br>
> + case GLSL_TYPE_HALF_FLOAT:<br>
><br>
><br>
> This doesn't look right. I think it's better to just let these hit the<br>
> unreachable().<br>
><br>
><br>
<br>
</div></div>Right, fixed locally.<br>
<br>
At the beginning I considered adding all the new base types to the<br>
default/unhandled case of the switches, then add correct implementations<br>
incrementally. But because there are many switches and the correct<br>
implementation of some of them were trivial, we decided to handle most<br>
of them already in this patch.<br>
<br>
It would be a bit of pain to revert that decision now, but if that will<br>
really help reviewing this rather long patch, we can consider doing that<br>
for its V2.<br></blockquote><div><br></div></div></div><div>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.<br></div><div><div class="h5"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div class="m_2470120782421798583h5"> > storage[i].f = val->value.f[i];<br>
> break;<br>
> case GLSL_TYPE_DOUBLE:<br>
> diff --git a/src/compiler/glsl/lower_buff<wbr>er_access.cpp<br>
> b/src/compiler/glsl/lower_buf<wbr>fer_access.cpp<br>
> index 24a96e2..51a540c 100644<br>
> --- a/src/compiler/glsl/lower_buff<wbr>er_access.cpp<br>
> +++ b/src/compiler/glsl/lower_buff<wbr>er_access.cpp<br>
> @@ -199,8 +199,20 @@ lower_buffer_access::emit_acce<wbr>ss(void *mem_ctx,<br>
> else<br>
> matrix_stride = glsl_align(matrix_columns * N, 16);<br>
><br>
> - const glsl_type *deref_type = deref->type->is_float() ?<br>
> - glsl_type::float_type : glsl_type::double_type;<br>
> + const glsl_type *deref_type;<br>
> + switch (deref->type->base_type) {<br>
> + case GLSL_TYPE_FLOAT:<br>
> + deref_type = glsl_type::float_type;<br>
> + break;<br>
> + case GLSL_TYPE_HALF_FLOAT:<br>
> + deref_type = glsl_type::float16_t_type;<br>
> + break;<br>
> + case GLSL_TYPE_DOUBLE:<br>
> + deref_type = glsl_type::double_type;<br>
> + break;<br>
> + default:<br>
> + assert(!"Invalid type");<br>
><br>
><br>
> Why not just make this deref->type->get_scalar_type() or get_base_type()?<br>
><br>
<br>
</div></div>Yes, get_scalar_type() it is. Fixed.<br>
<div><div class="m_2470120782421798583h5"><br>
><br>
> + }<br>
><br>
> for (unsigned i = 0; i < deref->type->vector_elements; i++) {<br>
> ir_rvalue *chan_offset =<br>
> diff --git a/src/compiler/glsl_types.cpp b/src/compiler/glsl_types.cpp<br>
> index 188b72f..8af0e25 100644<br>
> --- a/src/compiler/glsl_types.cpp<br>
> +++ b/src/compiler/glsl_types.cpp<br>
> @@ -355,10 +355,16 @@ const glsl_type *glsl_type::get_base_type() const<br>
> switch (base_type) {<br>
> case GLSL_TYPE_UINT:<br>
> return uint_type;<br>
> + case GLSL_TYPE_UINT16:<br>
> + return uint16_t_type;<br>
> case GLSL_TYPE_INT:<br>
> return int_type;<br>
> + case GLSL_TYPE_INT16:<br>
> + return int16_t_type;<br>
> case GLSL_TYPE_FLOAT:<br>
> return float_type;<br>
> + case GLSL_TYPE_HALF_FLOAT:<br>
> + return float16_t_type;<br>
> case GLSL_TYPE_DOUBLE:<br>
> return double_type;<br>
> case GLSL_TYPE_BOOL:<br>
> @@ -385,10 +391,16 @@ const glsl_type *glsl_type::get_scalar_type()<br>
> const<br>
> switch (type->base_type) {<br>
> case GLSL_TYPE_UINT:<br>
> return uint_type;<br>
> + case GLSL_TYPE_UINT16:<br>
> + return uint16_t_type;<br>
> case GLSL_TYPE_INT:<br>
> return int_type;<br>
> + case GLSL_TYPE_INT16:<br>
> + return int16_t_type;<br>
> case GLSL_TYPE_FLOAT:<br>
> return float_type;<br>
> + case GLSL_TYPE_HALF_FLOAT:<br>
> + return float16_t_type;<br>
> case GLSL_TYPE_DOUBLE:<br>
> return double_type;<br>
> case GLSL_TYPE_BOOL:<br>
> @@ -499,6 +511,18 @@ glsl_type::vec(unsigned components)<br>
> }<br>
><br>
> const glsl_type *<br>
> +glsl_type::f16vec(unsigned components)<br>
> +{<br>
> + if (components == 0 || components > 4)<br>
> + return error_type;<br>
> +<br>
> + static const glsl_type *const ts[] = {<br>
> + float16_t_type, f16vec2_type, f16vec3_type, f16vec4_type<br>
> + };<br>
> + return ts[components - 1];<br>
> +}<br>
> +<br>
> +const glsl_type *<br>
> glsl_type::dvec(unsigned components)<br>
> {<br>
> if (components == 0 || components > 4)<br>
> @@ -575,6 +599,31 @@ glsl_type::u64vec(unsigned components)<br>
> }<br>
><br>
> const glsl_type *<br>
> +glsl_type::i16vec(unsigned components)<br>
> +{<br>
> + if (components == 0 || components > 4)<br>
> + return error_type;<br>
> +<br>
> + static const glsl_type *const ts[] = {<br>
> + int16_t_type, i16vec2_type, i16vec3_type, i16vec4_type<br>
> + };<br>
> + return ts[components - 1];<br>
> +}<br>
> +<br>
> +<br>
> +const glsl_type *<br>
> +glsl_type::u16vec(unsigned components)<br>
> +{<br>
> + if (components == 0 || components > 4)<br>
> + return error_type;<br>
> +<br>
> + static const glsl_type *const ts[] = {<br>
> + uint16_t_type, u16vec2_type, u16vec3_type, u16vec4_type<br>
> + };<br>
> + return ts[components - 1];<br>
> +}<br>
> +<br>
> +const glsl_type *<br>
> glsl_type::get_instance(unsign<wbr>ed base_type, unsigned rows, unsigned<br>
> columns)<br>
> {<br>
> if (base_type == GLSL_TYPE_VOID)<br>
> @@ -593,6 +642,8 @@ glsl_type::get_instance(unsign<wbr>ed base_type,<br>
> unsigned rows, unsigned columns)<br>
> return ivec(rows);<br>
> case GLSL_TYPE_FLOAT:<br>
> return vec(rows);<br>
> + case GLSL_TYPE_HALF_FLOAT:<br>
> + return f16vec(rows);<br>
> case GLSL_TYPE_DOUBLE:<br>
> return dvec(rows);<br>
> case GLSL_TYPE_BOOL:<br>
> @@ -601,11 +652,17 @@ glsl_type::get_instance(unsign<wbr>ed base_type,<br>
> unsigned rows, unsigned columns)<br>
> return u64vec(rows);<br>
> case GLSL_TYPE_INT64:<br>
> return i64vec(rows);<br>
> + case GLSL_TYPE_UINT16:<br>
> + return u16vec(rows);<br>
> + case GLSL_TYPE_INT16:<br>
> + return i16vec(rows);<br>
> default:<br>
> return error_type;<br>
> }<br>
> } else {<br>
> - if ((base_type != GLSL_TYPE_FLOAT && base_type !=<br>
> GLSL_TYPE_DOUBLE) || (rows == 1))<br>
> + if ((base_type != GLSL_TYPE_FLOAT &&<br>
> + base_type != GLSL_TYPE_DOUBLE &&<br>
> + base_type != GLSL_TYPE_HALF_FLOAT) || (rows == 1))<br>
> return error_type;<br>
><br>
> /* GLSL matrix types are named mat{COLUMNS}x{ROWS}. Only the<br>
> following<br>
> @@ -619,7 +676,8 @@ glsl_type::get_instance(unsign<wbr>ed base_type,<br>
> unsigned rows, unsigned columns)<br>
> */<br>
> #define IDX(c,r) (((c-1)*3) + (r-1))<br>
><br>
> - if (base_type == GLSL_TYPE_DOUBLE) {<br>
> + switch (base_type) {<br>
> + case GLSL_TYPE_DOUBLE: {<br>
> switch (IDX(columns, rows)) {<br>
> case IDX(2,2): return dmat2_type;<br>
> case IDX(2,3): return dmat2x3_type;<br>
> @@ -632,7 +690,8 @@ glsl_type::get_instance(unsign<wbr>ed base_type,<br>
> unsigned rows, unsigned columns)<br>
> case IDX(4,4): return dmat4_type;<br>
> default: return error_type;<br>
> }<br>
> - } else {<br>
> + }<br>
> + case GLSL_TYPE_FLOAT: {<br>
> switch (IDX(columns, rows)) {<br>
> case IDX(2,2): return mat2_type;<br>
> case IDX(2,3): return mat2x3_type;<br>
> @@ -646,6 +705,22 @@ glsl_type::get_instance(unsign<wbr>ed base_type,<br>
> unsigned rows, unsigned columns)<br>
> default: return error_type;<br>
> }<br>
> }<br>
> + case GLSL_TYPE_HALF_FLOAT: {<br>
> + switch (IDX(columns, rows)) {<br>
> + case IDX(2,2): return f16mat2_type;<br>
> + case IDX(2,3): return f16mat2x3_type;<br>
> + case IDX(2,4): return f16mat2x4_type;<br>
> + case IDX(3,2): return f16mat3x2_type;<br>
> + case IDX(3,3): return f16mat3_type;<br>
> + case IDX(3,4): return f16mat3x4_type;<br>
> + case IDX(4,2): return f16mat4x2_type;<br>
> + case IDX(4,3): return f16mat4x3_type;<br>
> + case IDX(4,4): return f16mat4_type;<br>
> + default: return error_type;<br>
> + }<br>
> + }<br>
> + default: return error_type;<br>
> + }<br>
> }<br>
><br>
> assert(!"Should not get here.");<br>
> @@ -1282,7 +1357,10 @@ glsl_type::component_slots() const<br>
> switch (this->base_type) {<br>
> case GLSL_TYPE_UINT:<br>
> case GLSL_TYPE_INT:<br>
> + case GLSL_TYPE_UINT16:<br>
> + case GLSL_TYPE_INT16:<br>
> case GLSL_TYPE_FLOAT:<br>
> + case GLSL_TYPE_HALF_FLOAT:<br>
> case GLSL_TYPE_BOOL:<br>
> return this->components();<br>
><br>
> @@ -1371,7 +1449,10 @@ glsl_type::uniform_locations() const<br>
> case GLSL_TYPE_UINT:<br>
> case GLSL_TYPE_INT:<br>
> case GLSL_TYPE_FLOAT:<br>
> + case GLSL_TYPE_HALF_FLOAT:<br>
> case GLSL_TYPE_DOUBLE:<br>
> + case GLSL_TYPE_UINT16:<br>
> + case GLSL_TYPE_INT16:<br>
> case GLSL_TYPE_UINT64:<br>
> case GLSL_TYPE_INT64:<br>
> case GLSL_TYPE_BOOL:<br>
> @@ -1401,8 +1482,11 @@ glsl_type::varying_count() const<br>
> case GLSL_TYPE_UINT:<br>
> case GLSL_TYPE_INT:<br>
> case GLSL_TYPE_FLOAT:<br>
> + case GLSL_TYPE_HALF_FLOAT:<br>
> case GLSL_TYPE_DOUBLE:<br>
> case GLSL_TYPE_BOOL:<br>
> + case GLSL_TYPE_UINT16:<br>
> + case GLSL_TYPE_INT16:<br>
> case GLSL_TYPE_UINT64:<br>
> case GLSL_TYPE_INT64:<br>
> return 1;<br>
> @@ -1974,7 +2058,10 @@ glsl_type::count_attribute_slo<wbr>ts(bool<br>
> is_vertex_input) const<br>
> switch (this->base_type) {<br>
> case GLSL_TYPE_UINT:<br>
> case GLSL_TYPE_INT:<br>
> + case GLSL_TYPE_UINT16:<br>
> + case GLSL_TYPE_INT16:<br>
> case GLSL_TYPE_FLOAT:<br>
> + case GLSL_TYPE_HALF_FLOAT:<br>
> case GLSL_TYPE_BOOL:<br>
> case GLSL_TYPE_SAMPLER:<br>
> case GLSL_TYPE_IMAGE:<br>
> diff --git a/src/compiler/glsl_types.h b/src/compiler/glsl_types.h<br>
> index 2857dc9..8ebf2f4 100644<br>
> --- a/src/compiler/glsl_types.h<br>
> +++ b/src/compiler/glsl_types.h<br>
> @@ -52,7 +52,10 @@ enum glsl_base_type {<br>
> GLSL_TYPE_UINT = 0,<br>
> GLSL_TYPE_INT,<br>
> GLSL_TYPE_FLOAT,<br>
> + GLSL_TYPE_HALF_FLOAT,<br>
> GLSL_TYPE_DOUBLE,<br>
> + GLSL_TYPE_UINT16,<br>
> + GLSL_TYPE_INT16,<br>
> GLSL_TYPE_UINT64,<br>
> GLSL_TYPE_INT64,<br>
> GLSL_TYPE_BOOL,<br>
> @@ -237,12 +240,15 @@ struct glsl_type {<br>
> * @{<br>
> */<br>
> static const glsl_type *vec(unsigned components);<br>
> + static const glsl_type *f16vec(unsigned components);<br>
> static const glsl_type *dvec(unsigned components);<br>
> static const glsl_type *ivec(unsigned components);<br>
> static const glsl_type *uvec(unsigned components);<br>
> static const glsl_type *bvec(unsigned components);<br>
> static const glsl_type *i64vec(unsigned components);<br>
> static const glsl_type *u64vec(unsigned components);<br>
> + static const glsl_type *i16vec(unsigned components);<br>
> + static const glsl_type *u16vec(unsigned components);<br>
> /**@}*/<br>
><br>
> /**<br>
> @@ -472,7 +478,9 @@ struct glsl_type {<br>
> bool is_matrix() const<br>
> {<br>
> /* GLSL only has float matrices. */<br>
> - return (matrix_columns > 1) && (base_type == GLSL_TYPE_FLOAT<br>
> || base_type == GLSL_TYPE_DOUBLE);<br>
> + return (matrix_columns > 1) && (base_type == GLSL_TYPE_FLOAT<br>
> + || base_type == GLSL_TYPE_DOUBLE<br>
> + || base_type ==<br>
> GLSL_TYPE_HALF_FLOAT);<br>
> }<br>
><br>
> /**<br>
> diff --git a/src/mesa/program/ir_to_mesa.<wbr>cpp<br>
> b/src/mesa/program/ir_to_<wbr>mesa.cpp<br>
> index ac12b59..c92bdbf 100644<br>
> --- a/src/mesa/program/ir_to_mesa.<wbr>cpp<br>
> +++ b/src/mesa/program/ir_to_mesa.<wbr>cpp<br>
> @@ -507,7 +507,10 @@ type_size(const struct glsl_type *type)<br>
> switch (type->base_type) {<br>
> case GLSL_TYPE_UINT:<br>
> case GLSL_TYPE_INT:<br>
> + case GLSL_TYPE_UINT16:<br>
> + case GLSL_TYPE_INT16:<br>
> case GLSL_TYPE_FLOAT:<br>
> + case GLSL_TYPE_HALF_FLOAT:<br>
> case GLSL_TYPE_BOOL:<br>
> if (type->is_matrix()) {<br>
> return type->matrix_columns;<br>
> @@ -2536,6 +2539,7 @@ _mesa_associate_uniform_storag<wbr>e(struct<br>
> gl_context *ctx,<br>
> dmul *= 2;<br>
> /* fallthrough */<br>
> case GLSL_TYPE_UINT:<br>
> + case GLSL_TYPE_UINT16:<br>
> assert(ctx->Const.NativeIntege<wbr>rs);<br>
> format = uniform_native;<br>
> columns = 1;<br>
> @@ -2545,6 +2549,7 @@ _mesa_associate_uniform_storag<wbr>e(struct<br>
> gl_context *ctx,<br>
> dmul *= 2;<br>
> /* fallthrough */<br>
> case GLSL_TYPE_INT:<br>
> + case GLSL_TYPE_INT16:<br>
> format =<br>
> (ctx->Const.NativeIntegers) ? uniform_native :<br>
> uniform_int_float;<br>
> columns = 1;<br>
> @@ -2554,6 +2559,7 @@ _mesa_associate_uniform_storag<wbr>e(struct<br>
> gl_context *ctx,<br>
> dmul *= 2;<br>
> /* fallthrough */<br>
> case GLSL_TYPE_FLOAT:<br>
> + case GLSL_TYPE_HALF_FLOAT:<br>
> format = uniform_native;<br>
> columns = storage->type->matrix_columns;<br>
> break;<br>
> --<br>
> 2.9.3<br>
><br>
> _____________________________<wbr>__________________<br>
> mesa-dev mailing list<br>
</div></div>> <a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.<wbr>org</a> <mailto:<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedes<wbr>ktop.org</a>><br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.<wbr>org/mailman/listinfo/mesa-dev</a><br>
> <<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.or<wbr>g/mailman/listinfo/mesa-dev</a>><br>
<div class="m_2470120782421798583HOEnZb"><div class="m_2470120782421798583h5">><br>
><br>
><br>
><br>
> ______________________________<wbr>_________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
><br>
<br>
</div></div></blockquote></div></div></div><br></div></div>
</blockquote></div><br></div></div>