summaryrefslogtreecommitdiff
path: root/src/mesa/shader/shader_api.c
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2008-09-18 19:06:20 +0100
committerKeith Whitwell <keith@tungstengraphics.com>2008-09-18 19:07:33 +0100
commita8d1521f30766b6a4707aa9966e1f2f9c0b3ac00 (patch)
tree3d457d02a4d6167c2b720f8b55a59a32f33aaed9 /src/mesa/shader/shader_api.c
parent89ab66448e1bcd78caab6678261c2885dcff741c (diff)
parent0b8e19ffc51c29543796d4f1e3243e97d8c32671 (diff)
Merge commit 'origin/gallium-0.1' into gallium-0.2
Conflicts: src/mesa/shader/slang/slang_link.c
Diffstat (limited to 'src/mesa/shader/shader_api.c')
-rw-r--r--src/mesa/shader/shader_api.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c
index 0d65af9738..decdec53ed 100644
--- a/src/mesa/shader/shader_api.c
+++ b/src/mesa/shader/shader_api.c
@@ -1112,7 +1112,8 @@ get_matrix_dims(GLenum type, GLint *rows, GLint *cols)
/**
* Determine the number of rows and columns occupied by a uniform
- * according to its datatype.
+ * according to its datatype. For non-matrix types (such as GL_FLOAT_VEC4),
+ * the number of rows = 1 and cols = number of elements in the vector.
*/
static void
get_uniform_rows_cols(const struct gl_program_parameter *p,
@@ -1121,11 +1122,17 @@ get_uniform_rows_cols(const struct gl_program_parameter *p,
get_matrix_dims(p->DataType, rows, cols);
if (*rows == 0 && *cols == 0) {
/* not a matrix type, probably a float or vector */
- *rows = p->Size / 4 + 1;
- if (p->Size % 4 == 0)
- *cols = 4;
- else
- *cols = p->Size % 4;
+ if (p->Size <= 4) {
+ *rows = 1;
+ *cols = p->Size;
+ }
+ else {
+ *rows = p->Size / 4 + 1;
+ if (p->Size % 4 == 0)
+ *cols = 4;
+ else
+ *cols = p->Size % 4;
+ }
}
}