summaryrefslogtreecommitdiffstats
path: root/src/mesa/program
diff options
context:
space:
mode:
authorEduardo Lima Mitev <[email protected]>2017-07-01 07:46:41 +0200
committerJose Maria Casanova Crespo <[email protected]>2017-12-06 08:57:18 +0100
commit59f458cd8703b97b31b826499f01fcc9a30cd606 (patch)
tree73319583582ec9d3830da2c32f554816a7c86e67 /src/mesa/program
parent8761a04d0d9332d9c0c99164faf855fc3c741f7c (diff)
glsl: Add 16-bit types
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) v3: Use GL_FLOAT16_NV instead of GL_HALF_FLOAT for consistency (Ilia Mirkin) v4: Add missing 16-bit base types support in glsl_to_nir (Eduardo Lima). v5: Fix coding style (Topi Poholainen). Signed-off-by: Jose Maria Casanova Crespo <[email protected]> Signed-off-by: Eduardo Lima <[email protected]> Signed-off-by: Alejandro Piñeiro <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/mesa/program')
-rw-r--r--src/mesa/program/ir_to_mesa.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index aa8b6d7084b..ea74539cd76 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -507,7 +507,10 @@ storage_type_size(const struct glsl_type *type, bool bindless)
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_FLOAT16:
case GLSL_TYPE_BOOL:
if (type->is_matrix()) {
return type->matrix_columns;
@@ -2531,6 +2534,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;
@@ -2540,6 +2544,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;
@@ -2549,6 +2554,7 @@ _mesa_associate_uniform_storage(struct gl_context *ctx,
dmul *= 2;
/* fallthrough */
case GLSL_TYPE_FLOAT:
+ case GLSL_TYPE_FLOAT16:
format = uniform_native;
columns = storage->type->matrix_columns;
break;