[Mesa-dev] [PATCH v4] glsl: Uniform linking support for doubles

Ilia Mirkin imirkin at alum.mit.edu
Mon Feb 9 00:59:00 PST 2015


From: Dave Airlie <airlied at gmail.com>

Signed-off-by: Dave Airlie <airlied at redhat.com>
---

Removed now-unnecessary component_slots multiplication, check the base
type without array.

 src/glsl/link_uniforms.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp
index de2f6c9..88d9b74 100644
--- a/src/glsl/link_uniforms.cpp
+++ b/src/glsl/link_uniforms.cpp
@@ -608,7 +608,11 @@ private:
 	 }
 
 	 if (type->without_array()->is_matrix()) {
-	    this->uniforms[id].matrix_stride = 16;
+            const unsigned N = type->without_array()->base_type == GLSL_TYPE_DOUBLE ? 8 : 4;
+            const unsigned items = row_major ? type->matrix_columns : type->vector_elements;
+
+            assert(items <= 4);
+            this->uniforms[id].matrix_stride = glsl_align(items * N, 16);
 	    this->uniforms[id].row_major = row_major;
 	 } else {
 	    this->uniforms[id].matrix_stride = 0;
-- 
2.0.5



More information about the mesa-dev mailing list