Commit 919b066a by Jamie Madill Committed by Shannon Woods

For the reported std140 layout to be consistent with the spec.

TRAC #23083 Signed-off-by: Nicolas Capens Signed-off-by: Shannon Woods Authored-by: Jamie Madill
parent 440dc749
......@@ -83,26 +83,30 @@ void Std140BlockEncoder::getBlockLayoutInfo(const Uniform &uniform, int *arraySt
ASSERT(gl::UniformComponentSize(gl::UniformComponentType(uniform.type)) == ComponentSize);
int numComponents = gl::UniformComponentCount(uniform.type);
size_t baseAlignment = (numComponents == 3 ? 4u : static_cast<size_t>(numComponents));
size_t baseAlignment = 0;
int matrixStride = 0;
int arrayStride = 0;
if (gl::IsMatrixType(uniform.type))
{
numComponents = gl::MatrixComponentCount(uniform.type, uniform.isRowMajorMatrix);
baseAlignment = rx::roundUp(baseAlignment, RegisterSize);
matrixStride = baseAlignment;
baseAlignment = RegisterSize;
matrixStride = RegisterSize;
if (uniform.arraySize > 0)
{
const int numRegisters = gl::MatrixRegisterCount(uniform.type, uniform.isRowMajorMatrix);
arrayStride = matrixStride * numRegisters;
arrayStride = RegisterSize * numRegisters;
}
}
else if (uniform.arraySize > 0)
{
baseAlignment = rx::roundUp(baseAlignment, RegisterSize);
arrayStride = baseAlignment;
baseAlignment = RegisterSize;
arrayStride = RegisterSize;
}
else
{
const int numComponents = gl::UniformComponentCount(uniform.type);
baseAlignment = (numComponents == 3 ? 4u : static_cast<size_t>(numComponents));
}
mCurrentOffset = rx::roundUp(mCurrentOffset, baseAlignment);
......
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