glsl: Uniform linking support for doubles
authorDave Airlie <airlied@gmail.com>
Thu, 5 Feb 2015 09:44:02 +0000 (11:44 +0200)
committerIlia Mirkin <imirkin@alum.mit.edu>
Thu, 19 Feb 2015 05:28:34 +0000 (00:28 -0500)
Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
src/glsl/link_uniforms.cpp

index de2f6c9ac994b5a57f1fe9f29cfda3c978cedd19..3aa6e0a9c7475bf3cc528182052a542109265e5d 100644 (file)
@@ -608,7 +608,12 @@ private:
         }
 
         if (type->without_array()->is_matrix()) {
-           this->uniforms[id].matrix_stride = 16;
+            const glsl_type *matrix = type->without_array();
+            const unsigned N = matrix->base_type == GLSL_TYPE_DOUBLE ? 8 : 4;
+            const unsigned items = row_major ? matrix->matrix_columns : matrix->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;