GL_ARB_enhanced_layouts, part 6: Numerical side of uniform offset and align semantics. Included

- moving offset calculations for std140/std430 from reflection to linkValidate.cpp
 - applying the offset/align rules on top of std140/std430
 - removing caching the structure's number of components (and correcting that this is components, not size)


git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@25174 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2014-01-31 02:40:19 +00:00
parent 04b1c6ed4c
commit ac1e188f3b
15 changed files with 367 additions and 219 deletions

View file

@ -82,7 +82,7 @@ bool TConstTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node)
if (flag) {
singleConstantParam = true;
constructorType = node->getOp();
size = node->getType().getObjectSize();
size = node->getType().computeNumComponents();
if (node->getType().isMatrix()) {
isMatrix = true;
@ -115,13 +115,13 @@ bool TConstTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node)
void TConstTraverser::visitConstantUnion(TIntermConstantUnion* node)
{
TConstUnionArray leftUnionArray(unionArray);
int instanceSize = type.getObjectSize();
int instanceSize = type.computeNumComponents();
if (index >= instanceSize)
return;
if (! singleConstantParam) {
int rightUnionSize = node->getType().getObjectSize();
int rightUnionSize = node->getType().computeNumComponents();
const TConstUnionArray& rightUnionArray = node->getConstArray();
for (int i = 0; i < rightUnionSize; i++) {
@ -136,6 +136,7 @@ void TConstTraverser::visitConstantUnion(TIntermConstantUnion* node)
const TConstUnionArray& rightUnionArray = node->getConstArray();
if (! isMatrix) {
int count = 0;
int nodeComps = node->getType().computeNumComponents();
for (int i = index; i < endIndex; i++) {
if (i >= instanceSize)
return;
@ -144,7 +145,7 @@ void TConstTraverser::visitConstantUnion(TIntermConstantUnion* node)
(index)++;
if (node->getType().getObjectSize() > 1)
if (nodeComps > 1)
count++;
}
} else {
@ -169,6 +170,7 @@ void TConstTraverser::visitConstantUnion(TIntermConstantUnion* node)
// matrix from vector
int count = 0;
const int startIndex = index;
int nodeComps = node->getType().computeNumComponents();
for (int i = startIndex; i < endIndex; i++) {
if (i >= instanceSize)
return;
@ -179,7 +181,7 @@ void TConstTraverser::visitConstantUnion(TIntermConstantUnion* node)
index++;
if (node->getType().getObjectSize() > 1)
if (nodeComps > 1)
count++;
}
}