From 6604aa2606c8075ea5943cca043b7497eee6276b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Fri, 12 Feb 2021 08:14:07 -0500 Subject: [PATCH] glsl: pack 16-bit uniforms in the NIR linker Reviewed-by: Eric Anholt Part-of: --- src/compiler/glsl/gl_nir_link_uniforms.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/compiler/glsl/gl_nir_link_uniforms.c b/src/compiler/glsl/gl_nir_link_uniforms.c index 05bce275f79..4670b8520a9 100644 --- a/src/compiler/glsl/gl_nir_link_uniforms.c +++ b/src/compiler/glsl/gl_nir_link_uniforms.c @@ -672,6 +672,10 @@ add_parameter(struct gl_uniform_storage *uniform, comps = 4; } + /* TODO: This will waste space with 1 and 3 16-bit components. */ + if (glsl_type_is_16bit(glsl_without_array(type))) + comps = DIV_ROUND_UP(comps, 2); + _mesa_add_parameter(params, PROGRAM_UNIFORM, uniform->name, comps, glsl_get_gl_type(type), NULL, NULL, false); }