Commit 576aea5c by Alexis Hetu Committed by Alexis Hétu

Uniform block related fixes

- The rowMajor qualifier should only be set for matrices - Shared and std140 layouts are always considered active - Fixed registerSize() for uniform blocks Change-Id: Id0ccd4f1f1c3342915643d87e166234e61b83f4f Reviewed-on: https://swiftshader-review.googlesource.com/4631Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com>
parent 2c2a7b29
...@@ -103,7 +103,7 @@ namespace glsl ...@@ -103,7 +103,7 @@ namespace glsl
const BlockMemberInfo memberInfo(static_cast<int>(mCurrentOffset * BytesPerComponent), const BlockMemberInfo memberInfo(static_cast<int>(mCurrentOffset * BytesPerComponent),
static_cast<int>(arrayStride * BytesPerComponent), static_cast<int>(arrayStride * BytesPerComponent),
static_cast<int>(matrixStride * BytesPerComponent), static_cast<int>(matrixStride * BytesPerComponent),
isRowMajor); (matrixStride > 0) && isRowMajor);
advanceOffset(type, type.getArraySize(), isRowMajor, arrayStride, matrixStride); advanceOffset(type, type.getArraySize(), isRowMajor, arrayStride, matrixStride);
...@@ -451,6 +451,16 @@ namespace glsl ...@@ -451,6 +451,16 @@ namespace glsl
declareVarying(symbol, -1); declareVarying(symbol, -1);
} }
} }
TInterfaceBlock* block = symbol->getType().getInterfaceBlock();
// OpenGL ES 3.0.4 spec, section 2.12.6 Uniform Variables:
// "All members of a named uniform block declared with a shared or std140 layout qualifier
// are considered active, even if they are not referenced in any shader in the program.
// The uniform block itself is also considered active, even if no member of the block is referenced."
if(block && ((block->blockStorage() == EbsShared) || (block->blockStorage() == EbsStd140)))
{
uniformRegister(symbol);
}
} }
bool OutputASM::visitBinary(Visit visit, TIntermBinary *node) bool OutputASM::visitBinary(Visit visit, TIntermBinary *node)
...@@ -2012,6 +2022,10 @@ namespace glsl ...@@ -2012,6 +2022,10 @@ namespace glsl
{ {
return registerSize(*((*(type.getStruct()->fields().begin()))->type()), 0); return registerSize(*((*(type.getStruct()->fields().begin()))->type()), 0);
} }
else if(type.isInterfaceBlock())
{
return registerSize(*((*(type.getInterfaceBlock()->fields().begin()))->type()), 0);
}
return type.registerSize(); return type.registerSize();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment