From 59f458cd8703b97b31b826499f01fcc9a30cd606 Mon Sep 17 00:00:00 2001 From: Eduardo Lima Mitev Date: Sat, 1 Jul 2017 07:46:41 +0200 Subject: glsl: Add 16-bit types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Eduardo Lima Signed-off-by: Alejandro Piñeiro Reviewed-by: Jason Ekstrand Reviewed-by: Nicolai Hähnle --- src/compiler/glsl/link_uniform_initializers.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/compiler/glsl/link_uniform_initializers.cpp') diff --git a/src/compiler/glsl/link_uniform_initializers.cpp b/src/compiler/glsl/link_uniform_initializers.cpp index f70d9100e12..be3715cc1a3 100644 --- a/src/compiler/glsl/link_uniform_initializers.cpp +++ b/src/compiler/glsl/link_uniform_initializers.cpp @@ -81,6 +81,9 @@ copy_constant_to_storage(union gl_constant_value *storage, case GLSL_TYPE_SUBROUTINE: case GLSL_TYPE_FUNCTION: case GLSL_TYPE_ERROR: + case GLSL_TYPE_UINT16: + case GLSL_TYPE_INT16: + case GLSL_TYPE_FLOAT16: /* All other types should have already been filtered by other * paths in the caller. */ -- cgit v1.2.3