Row major matrix packing fix
Row major matrix packing wasn't properly detected when the layout
qualifier was on the block member rather than on the block itself
or when a nested structure had a matrix packing qualifier.
Fixes all failing tests in:
deqp/functional/gles3/uniformbuffers*
No regressions in:
dEQP-GLES3.functional.ubo*
Change-Id: I1549a70c4286a8a84b695bc876d71d9cf636b306
Reviewed-on: https://swiftshader-review.googlesource.com/16588
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/OpenGL/compiler/OutputASM.cpp b/src/OpenGL/compiler/OutputASM.cpp
index 76a177a..4ef41be 100644
--- a/src/OpenGL/compiler/OutputASM.cpp
+++ b/src/OpenGL/compiler/OutputASM.cpp
@@ -285,8 +285,8 @@
{
}
- BlockLayoutEncoder::BlockLayoutEncoder(bool rowMajor)
- : mCurrentOffset(0), isRowMajor(rowMajor)
+ BlockLayoutEncoder::BlockLayoutEncoder()
+ : mCurrentOffset(0)
{
}
@@ -295,20 +295,15 @@
int arrayStride;
int matrixStride;
- bool isVariableRowMajor = isRowMajor;
- TLayoutMatrixPacking matrixPacking = type.getLayoutQualifier().matrixPacking;
- if(matrixPacking != EmpUnspecified)
- {
- isVariableRowMajor = (matrixPacking == EmpRowMajor);
- }
- getBlockLayoutInfo(type, type.getArraySize(), isVariableRowMajor, &arrayStride, &matrixStride);
+ bool isRowMajor = type.getLayoutQualifier().matrixPacking == EmpRowMajor;
+ getBlockLayoutInfo(type, type.getArraySize(), isRowMajor, &arrayStride, &matrixStride);
const BlockMemberInfo memberInfo(static_cast<int>(mCurrentOffset * BytesPerComponent),
static_cast<int>(arrayStride * BytesPerComponent),
static_cast<int>(matrixStride * BytesPerComponent),
- (matrixStride > 0) && isVariableRowMajor);
+ (matrixStride > 0) && isRowMajor);
- advanceOffset(type, type.getArraySize(), isVariableRowMajor, arrayStride, matrixStride);
+ advanceOffset(type, type.getArraySize(), isRowMajor, arrayStride, matrixStride);
return memberInfo;
}
@@ -330,7 +325,7 @@
mCurrentOffset = sw::align(mCurrentOffset, ComponentsPerRegister);
}
- Std140BlockEncoder::Std140BlockEncoder(bool rowMajor) : BlockLayoutEncoder(rowMajor)
+ Std140BlockEncoder::Std140BlockEncoder() : BlockLayoutEncoder()
{
}
@@ -2376,7 +2371,7 @@
arg = &unpackedUniform;
index = 0;
}
- else if((srcBlock->matrixPacking() == EmpRowMajor) && memberType.isMatrix())
+ else if((memberType.getLayoutQualifier().matrixPacking == EmpRowMajor) && memberType.isMatrix())
{
int numCols = memberType.getNominalSize();
int numRows = memberType.getSecondarySize();
@@ -3591,7 +3586,7 @@
block->blockStorage(), isRowMajor, registerIndex, blockId));
blockDefinitions.push_back(BlockDefinitionIndexMap());
- Std140BlockEncoder currentBlockEncoder(isRowMajor);
+ Std140BlockEncoder currentBlockEncoder;
currentBlockEncoder.enterAggregateType();
for(const auto &field : fields)
{