[Piglit] [PATCH 01/11] shader_runner: Fix packing matrix data in UBOs
Ian Romanick
idr at freedesktop.org
Mon Sep 8 14:34:46 PDT 2014
From: Ian Romanick <ian.d.romanick at intel.com>
The indices were all confused, and it wasn't obvious which order the
parser expected the data. The old code worked with square matrices,
it either didn't upload enough data or wrote outside the UBO for non-
square matrices.
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
tests/shaders/shader_runner.c | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 82b834d..897edec 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -1336,14 +1336,18 @@ set_ubo_uniform(const char *name, const char *type, const char *line, int ubo_ar
matrix_stride /= sizeof(float);
+ /* Expect the data in the .shader_test file to be listed in
+ * column-major order no matter what the layout of the data in
+ * the UBO will be.
+ */
for (c = 0; c < cols; c++) {
for (r = 0; r < rows; r++) {
if (row_major) {
- matrixdata[matrix_stride * c + r] =
- f[r * rows + c];
- } else {
matrixdata[matrix_stride * r + c] =
- f[r * rows + c];
+ f[c * rows + r];
+ } else {
+ matrixdata[matrix_stride * c + r] =
+ f[c * rows + r];
}
}
}
@@ -1366,14 +1370,18 @@ set_ubo_uniform(const char *name, const char *type, const char *line, int ubo_ar
matrix_stride /= sizeof(double);
+ /* Expect the data in the .shader_test file to be listed in
+ * column-major order no matter what the layout of the data in
+ * the UBO will be.
+ */
for (c = 0; c < cols; c++) {
for (r = 0; r < rows; r++) {
if (row_major) {
- matrixdata[matrix_stride * c + r] =
- d[r * rows + c];
- } else {
matrixdata[matrix_stride * r + c] =
- d[r * rows + c];
+ d[c * rows + r];
+ } else {
+ matrixdata[matrix_stride * c + r] =
+ d[c * rows + r];
}
}
}
--
1.8.1.4
More information about the Piglit
mailing list