<div dir="ltr">Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Sep 2, 2017 at 12:10 AM, Alejandro Piñeiro <span dir="ltr"><<a href="mailto:apinheiro@igalia.com" target="_blank">apinheiro@igalia.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Eduardo Lima Mitev <<a href="mailto:elima@igalia.com">elima@igalia.com</a>><br>
<br>
Adds new INT16, UINT16 and FLOAT16 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 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 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>
v2: * Use FLOAT16 instead of HALF_FLOAT as name of the base type.<br>
* Removed float16_t from builtin types.<br>
* Don't copy 16-bit types as if they were 32-bit values in<br>
copy_constant_to_storage().<br>
* Use get_scalar_type() instead of adding a new custom switch<br>
statement.<br>
(Jason Ekstrand)<br>
v3: Use GL_FLOAT16_NV instead of GL_HALF_FLOAT for consistency<br>
(Ilia Mirkin)<br>
v4: Add missing 16-bit base types support in glsl_to_nir (Eduardo Lima).<br>
<br>
Signed-off-by: Jose Maria Casanova Crespo <<a href="mailto:jmcasanova@igalia.com">jmcasanova@igalia.com</a>><br>
Signed-off-by: Eduardo Lima <<a href="mailto:elima@igalia.com">elima@igalia.com</a>><br>
Signed-off-by: Alejandro Piñeiro <<a href="mailto:apinheiro@igalia.com">apinheiro@igalia.com</a>><br>
---<br>
src/compiler/builtin_type_<wbr>macros.h | 26 +++++++<br>
src/compiler/glsl/ast_to_hir.<wbr>cpp | 3 +<br>
src/compiler/glsl/glsl_to_nir.<wbr>cpp | 6 +-<br>
src/compiler/glsl/ir_clone.cpp | 3 +<br>
src/compiler/glsl/link_<wbr>uniform_initializers.cpp | 3 +<br>
src/compiler/glsl/lower_<wbr>buffer_access.cpp | 3 +-<br>
src/compiler/glsl_types.cpp | 93 ++++++++++++++++++++++++-<br>
src/compiler/glsl_types.h | 10 ++-<br>
src/mesa/program/ir_to_mesa.<wbr>cpp | 6 ++<br>
9 files changed, 145 insertions(+), 8 deletions(-)<br>
<br>
diff --git a/src/compiler/builtin_type_<wbr>macros.h b/src/compiler/builtin_type_<wbr>macros.h<br>
index a275617b343..e3a1cd29c87 100644<br>
--- a/src/compiler/builtin_type_<wbr>macros.h<br>
+++ b/src/compiler/builtin_type_<wbr>macros.h<br>
@@ -62,6 +62,22 @@ DECL_TYPE(mat3x4, GL_FLOAT_MAT3x4, 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_FLOAT16_NV, GLSL_TYPE_FLOAT16, 1, 1)<br>
+DECL_TYPE(f16vec2, GL_FLOAT16_VEC2_NV, GLSL_TYPE_FLOAT16, 2, 1)<br>
+DECL_TYPE(f16vec3, GL_FLOAT16_VEC3_NV, GLSL_TYPE_FLOAT16, 3, 1)<br>
+DECL_TYPE(f16vec4, GL_FLOAT16_VEC4_NV, GLSL_TYPE_FLOAT16, 4, 1)<br>
+<br>
+DECL_TYPE(f16mat2, GL_FLOAT16_MAT2_AMD, GLSL_TYPE_FLOAT16, 2, 2)<br>
+DECL_TYPE(f16mat3, GL_FLOAT16_MAT3_AMD, GLSL_TYPE_FLOAT16, 3, 3)<br>
+DECL_TYPE(f16mat4, GL_FLOAT16_MAT4_AMD, GLSL_TYPE_FLOAT16, 4, 4)<br>
+<br>
+DECL_TYPE(f16mat2x3, GL_FLOAT16_MAT2x3_AMD, GLSL_TYPE_FLOAT16, 3, 2)<br>
+DECL_TYPE(f16mat2x4, GL_FLOAT16_MAT2x4_AMD, GLSL_TYPE_FLOAT16, 4, 2)<br>
+DECL_TYPE(f16mat3x2, GL_FLOAT16_MAT3x2_AMD, GLSL_TYPE_FLOAT16, 2, 3)<br>
+DECL_TYPE(f16mat3x4, GL_FLOAT16_MAT3x4_AMD, GLSL_TYPE_FLOAT16, 4, 3)<br>
+DECL_TYPE(f16mat4x2, GL_FLOAT16_MAT4x2_AMD, GLSL_TYPE_FLOAT16, 2, 4)<br>
+DECL_TYPE(f16mat4x3, GL_FLOAT16_MAT4x3_AMD, GLSL_TYPE_FLOAT16, 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, 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, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_1D, 0, 0, GLSL_TYPE_VOID)<br>
DECL_TYPE(sampler1D, GL_SAMPLER_1D, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_1D, 0, 0, GLSL_TYPE_FLOAT)<br>
DECL_TYPE(sampler2D, GL_SAMPLER_2D, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_2D, 0, 0, GLSL_TYPE_FLOAT)<br>
diff --git a/src/compiler/glsl/ast_to_<wbr>hir.cpp b/src/compiler/glsl/ast_to_<wbr>hir.cpp<br>
index 98d2f94e129..9b8acfd780e 100644<br>
--- a/src/compiler/glsl/ast_to_<wbr>hir.cpp<br>
+++ b/src/compiler/glsl/ast_to_<wbr>hir.cpp<br>
@@ -1108,12 +1108,15 @@ do_comparison(void *mem_ctx, int operation, ir_rvalue *op0, ir_rvalue *op1)<br>
<br>
switch (op0->type->base_type) {<br>
case GLSL_TYPE_FLOAT:<br>
+ case GLSL_TYPE_FLOAT16:<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/glsl_to_<wbr>nir.cpp b/src/compiler/glsl/glsl_to_<wbr>nir.cpp<br>
index bb2ba17b220..a956a0ae2b8 100644<br>
--- a/src/compiler/glsl/glsl_to_<wbr>nir.cpp<br>
+++ b/src/compiler/glsl/glsl_to_<wbr>nir.cpp<br>
@@ -1388,13 +1388,15 @@ nir_visitor::evaluate_rvalue(<wbr>ir_rvalue* ir)<br>
static bool<br>
type_is_float(glsl_base_type type)<br>
{<br>
- return type == GLSL_TYPE_FLOAT || type == GLSL_TYPE_DOUBLE;<br>
+ return type == GLSL_TYPE_FLOAT || type == GLSL_TYPE_DOUBLE<br>
+ || type == GLSL_TYPE_FLOAT16;<br>
}<br>
<br>
static bool<br>
type_is_signed(glsl_base_type type)<br>
{<br>
- return type == GLSL_TYPE_INT || type == GLSL_TYPE_INT64;<br>
+ return type == GLSL_TYPE_INT || type == GLSL_TYPE_INT64 ||<br>
+ type == GLSL_TYPE_INT16;<br>
}<br>
<br>
void<br>
diff --git a/src/compiler/glsl/ir_clone.<wbr>cpp b/src/compiler/glsl/ir_clone.<wbr>cpp<br>
index 4fb9fa31f9b..79805e3fdb6 100644<br>
--- a/src/compiler/glsl/ir_clone.<wbr>cpp<br>
+++ b/src/compiler/glsl/ir_clone.<wbr>cpp<br>
@@ -337,10 +337,13 @@ ir_constant::clone(void *mem_ctx, struct hash_table *ht) const<br>
case GLSL_TYPE_UINT:<br>
case GLSL_TYPE_INT:<br>
case GLSL_TYPE_FLOAT:<br>
+ case GLSL_TYPE_FLOAT16:<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_<wbr>uniform_initializers.cpp b/src/compiler/glsl/link_<wbr>uniform_initializers.cpp<br>
index 01754cd3daf..346e7204f8c 100644<br>
--- a/src/compiler/glsl/link_<wbr>uniform_initializers.cpp<br>
+++ b/src/compiler/glsl/link_<wbr>uniform_initializers.cpp<br>
@@ -81,6 +81,9 @@ copy_constant_to_storage(union gl_constant_value *storage,<br>
case GLSL_TYPE_SUBROUTINE:<br>
case GLSL_TYPE_FUNCTION:<br>
case GLSL_TYPE_ERROR:<br>
+ case GLSL_TYPE_UINT16:<br>
+ case GLSL_TYPE_INT16:<br>
+ case GLSL_TYPE_FLOAT16:<br>
/* All other types should have already been filtered by other<br>
* paths in the caller.<br>
*/<br>
diff --git a/src/compiler/glsl/lower_<wbr>buffer_access.cpp b/src/compiler/glsl/lower_<wbr>buffer_access.cpp<br>
index caffaf9bfb2..27c0d961147 100644<br>
--- a/src/compiler/glsl/lower_<wbr>buffer_access.cpp<br>
+++ b/src/compiler/glsl/lower_<wbr>buffer_access.cpp<br>
@@ -199,8 +199,7 @@ lower_buffer_access::emit_<wbr>access(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 = deref->type->get_scalar_type()<wbr>;<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 99cc696c19b..f913d9a672e 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_FLOAT16:<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() 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_FLOAT16:<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(<wbr>unsigned base_type, unsigned rows, unsigned columns)<br>
{<br>
if (base_type == GLSL_TYPE_VOID)<br>
@@ -593,6 +642,8 @@ glsl_type::get_instance(<wbr>unsigned base_type, unsigned rows, unsigned columns)<br>
return ivec(rows);<br>
case GLSL_TYPE_FLOAT:<br>
return vec(rows);<br>
+ case GLSL_TYPE_FLOAT16:<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(<wbr>unsigned base_type, 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 != GLSL_TYPE_DOUBLE) || (rows == 1))<br>
+ if ((base_type != GLSL_TYPE_FLOAT &&<br>
+ base_type != GLSL_TYPE_DOUBLE &&<br>
+ base_type != GLSL_TYPE_FLOAT16) || (rows == 1))<br>
return error_type;<br>
<br>
/* GLSL matrix types are named mat{COLUMNS}x{ROWS}. Only the following<br>
@@ -619,7 +676,8 @@ glsl_type::get_instance(<wbr>unsigned base_type, 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(<wbr>unsigned base_type, 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(<wbr>unsigned base_type, unsigned rows, unsigned columns)<br>
default: return error_type;<br>
}<br>
}<br>
+ case GLSL_TYPE_FLOAT16: {<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_FLOAT16:<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_FLOAT16:<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_FLOAT16:<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_<wbr>slots(bool 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_FLOAT16:<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 3c18f6cce5b..32399df3510 100644<br>
--- a/src/compiler/glsl_types.h<br>
+++ b/src/compiler/glsl_types.h<br>
@@ -54,7 +54,10 @@ enum glsl_base_type {<br>
GLSL_TYPE_UINT = 0,<br>
GLSL_TYPE_INT,<br>
GLSL_TYPE_FLOAT,<br>
+ GLSL_TYPE_FLOAT16,<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>
@@ -232,12 +235,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>
@@ -467,7 +473,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 || base_type == GLSL_TYPE_DOUBLE);<br>
+ return (matrix_columns > 1) && (base_type == GLSL_TYPE_FLOAT<br>
+ || base_type == GLSL_TYPE_DOUBLE<br>
+ || base_type == GLSL_TYPE_FLOAT16);<br>
}<br>
<br>
/**<br>
diff --git a/src/mesa/program/ir_to_mesa.<wbr>cpp b/src/mesa/program/ir_to_mesa.<wbr>cpp<br>
index 11207dd8289..8399952731f 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 @@ storage_type_size(const struct glsl_type *type, bool bindless)<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_FLOAT16:<br>
case GLSL_TYPE_BOOL:<br>
if (type->is_matrix()) {<br>
return type->matrix_columns;<br>
@@ -2547,6 +2550,7 @@ _mesa_associate_uniform_<wbr>storage(struct gl_context *ctx,<br>
dmul *= 2;<br>
/* fallthrough */<br>
case GLSL_TYPE_UINT:<br>
+ case GLSL_TYPE_UINT16:<br>
assert(ctx->Const.<wbr>NativeIntegers);<br>
format = uniform_native;<br>
columns = 1;<br>
@@ -2556,6 +2560,7 @@ _mesa_associate_uniform_<wbr>storage(struct 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 : uniform_int_float;<br>
columns = 1;<br>
@@ -2565,6 +2570,7 @@ _mesa_associate_uniform_<wbr>storage(struct gl_context *ctx,<br>
dmul *= 2;<br>
/* fallthrough */<br>
case GLSL_TYPE_FLOAT:<br>
+ case GLSL_TYPE_FLOAT16:<br>
format = uniform_native;<br>
columns = storage->type->matrix_columns;<br>
break;<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.11.0<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">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>
</font></span></blockquote></div><br></div>