Revert "Fix error in mat4x2(scalar) construction."
This reverts commit bbe1b9965ad56e797f97081bf4a6e523dfb54308.
Reason for revert: breaks conformance test
Change-Id: I4f9579c10414b88646b4bda2449ac04e052ca162
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/54449
Tested-by: John Stiles <johnstiles@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
diff --git a/src/OpenGL/compiler/parseConst.cpp b/src/OpenGL/compiler/parseConst.cpp
index bfec15a..26af408 100644
--- a/src/OpenGL/compiler/parseConst.cpp
+++ b/src/OpenGL/compiler/parseConst.cpp
@@ -199,26 +199,19 @@
}
} else { // for matrix constructors
int count = 0;
- if (node->getType().getObjectSize() == 1) {
- // Synthesize a diagonal matrix from the provided scalar.
- int matrixCols = node->getType().getNominalSize();
- for (int c = 0; c < matrixCols; ++c) {
- for (int r = 0; r < matrixRows; ++r) {
- if (r == c)
- leftUnionArray[index].cast(basicType, rightUnionArray[0]);
- else
- leftUnionArray[index].setFConst(0.0);
- (index)++;
- }
- }
- } else {
- // Construct a matrix from the provided components.
- for (size_t i = index; i < totalSize; i++) {
- if (i >= instanceSize)
- return;
- leftUnionArray[i].cast(basicType, rightUnionArray[count]);
+ int element = index;
+ for(size_t i = index; i < totalSize; i++) {
+ if (i >= instanceSize)
+ return;
+ if (element - i == 0 || (i - element) % (matrixRows + 1) == 0 )
+ leftUnionArray[i].cast(basicType, rightUnionArray[0]);
+ else
+ leftUnionArray[i].setFConst(0.0f);
+
+ (index)++;
+
+ if (node->getType().getObjectSize() > 1)
count++;
- }
}
}
}