Module: Mesa
Branch: master
Commit: 6604aa2606c8075ea5943cca043b7497eee6276b
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6604aa2606c8075ea5943cca043b7497eee6276b

Author: Marek Olšák <marek.ol...@amd.com>
Date:   Fri Feb 12 08:14:07 2021 -0500

glsl: pack 16-bit uniforms in the NIR linker

Reviewed-by: Eric Anholt <e...@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9050>

---

 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);
       }

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to