Merge pull request #2646 from johnstiles-google/parseconst
Fix mat4x2(scalar) constructor.
This commit is contained in:
commit
e71278cc92
@ -242,6 +242,36 @@ Shader version: 130
|
||||
0:54 'un34' ( uniform 4X4 matrix of float)
|
||||
0:54 'um43' ( uniform 4X4 matrix of float)
|
||||
0:54 'v' ( smooth in 4-component vector of float)
|
||||
0:56 Sequence
|
||||
0:56 move second child to first child ( temp 4X2 matrix of float)
|
||||
0:56 'm42' ( temp 4X2 matrix of float)
|
||||
0:56 Constant:
|
||||
0:56 42.000000
|
||||
0:56 0.000000
|
||||
0:56 0.000000
|
||||
0:56 42.000000
|
||||
0:56 0.000000
|
||||
0:56 0.000000
|
||||
0:56 0.000000
|
||||
0:56 0.000000
|
||||
0:57 Test condition and select ( temp void)
|
||||
0:57 Condition
|
||||
0:57 Compare Equal ( temp bool)
|
||||
0:57 'm42' ( temp 4X2 matrix of float)
|
||||
0:57 Constant:
|
||||
0:57 42.000000
|
||||
0:57 0.000000
|
||||
0:57 0.000000
|
||||
0:57 42.000000
|
||||
0:57 0.000000
|
||||
0:57 0.000000
|
||||
0:57 0.000000
|
||||
0:57 0.000000
|
||||
0:57 true case
|
||||
0:58 Sequence
|
||||
0:58 add second child into first child ( temp 4-component vector of float)
|
||||
0:58 'gl_FragColor' ( fragColor 4-component vector of float FragColor)
|
||||
0:58 'v' ( smooth in 4-component vector of float)
|
||||
0:? Linker Objects
|
||||
0:? 'colorTransform' ( uniform 3X3 matrix of float)
|
||||
0:? 'Color' ( smooth in 3-component vector of float)
|
||||
@ -495,6 +525,36 @@ Shader version: 130
|
||||
0:54 'un34' ( uniform 4X4 matrix of float)
|
||||
0:54 'um43' ( uniform 4X4 matrix of float)
|
||||
0:54 'v' ( smooth in 4-component vector of float)
|
||||
0:56 Sequence
|
||||
0:56 move second child to first child ( temp 4X2 matrix of float)
|
||||
0:56 'm42' ( temp 4X2 matrix of float)
|
||||
0:56 Constant:
|
||||
0:56 42.000000
|
||||
0:56 0.000000
|
||||
0:56 0.000000
|
||||
0:56 42.000000
|
||||
0:56 0.000000
|
||||
0:56 0.000000
|
||||
0:56 0.000000
|
||||
0:56 0.000000
|
||||
0:57 Test condition and select ( temp void)
|
||||
0:57 Condition
|
||||
0:57 Compare Equal ( temp bool)
|
||||
0:57 'm42' ( temp 4X2 matrix of float)
|
||||
0:57 Constant:
|
||||
0:57 42.000000
|
||||
0:57 0.000000
|
||||
0:57 0.000000
|
||||
0:57 42.000000
|
||||
0:57 0.000000
|
||||
0:57 0.000000
|
||||
0:57 0.000000
|
||||
0:57 0.000000
|
||||
0:57 true case
|
||||
0:58 Sequence
|
||||
0:58 add second child into first child ( temp 4-component vector of float)
|
||||
0:58 'gl_FragColor' ( fragColor 4-component vector of float FragColor)
|
||||
0:58 'v' ( smooth in 4-component vector of float)
|
||||
0:? Linker Objects
|
||||
0:? 'colorTransform' ( uniform 3X3 matrix of float)
|
||||
0:? 'Color' ( smooth in 3-component vector of float)
|
||||
|
@ -52,4 +52,9 @@ void main()
|
||||
gl_FragColor += m34 * u;
|
||||
else
|
||||
gl_FragColor += (un34 * um43) * v;
|
||||
|
||||
mat4x2 m42 = mat4x2(42);
|
||||
if (m42 == mat4x2(42, 0, 0, 42, 0, 0, 0, 0)) {
|
||||
gl_FragColor += v;
|
||||
}
|
||||
}
|
||||
|
@ -166,35 +166,34 @@ void TConstTraverser::visitConstantUnion(TIntermConstantUnion* node)
|
||||
}
|
||||
} else {
|
||||
// matrix from vector or scalar
|
||||
int count = 0;
|
||||
const int startIndex = index;
|
||||
int nodeComps = node->getType().computeNumComponents();
|
||||
for (int i = startIndex; i < endIndex; i++) {
|
||||
if (nodeComps == 1) {
|
||||
for (int c = 0; c < matrixCols; ++c) {
|
||||
for (int r = 0; r < matrixRows; ++r) {
|
||||
if (r == c)
|
||||
leftUnionArray[index] = rightUnionArray[0];
|
||||
else
|
||||
leftUnionArray[index].setDConst(0.0);
|
||||
index++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int count = 0;
|
||||
for (int i = index; i < endIndex; i++) {
|
||||
if (i >= instanceSize)
|
||||
return;
|
||||
if (nodeComps == 1) {
|
||||
// If there is a single scalar parameter to a matrix
|
||||
// constructor, it is used to initialize all the
|
||||
// components on the matrix's diagonal, with the
|
||||
// remaining components initialized to 0.0.
|
||||
if (i == startIndex || (i - startIndex) % (matrixRows + 1) == 0 )
|
||||
leftUnionArray[i] = rightUnionArray[count];
|
||||
else
|
||||
leftUnionArray[i].setDConst(0.0);
|
||||
} else {
|
||||
|
||||
// construct the matrix in column-major order, from
|
||||
// the components provided, in order
|
||||
leftUnionArray[i] = rightUnionArray[count];
|
||||
}
|
||||
|
||||
index++;
|
||||
|
||||
if (nodeComps > 1)
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool TIntermediate::parseConstTree(TIntermNode* root, TConstUnionArray unionArray, TOperator constructorType, const TType& t, bool singleConstantParam)
|
||||
|
Loading…
x
Reference in New Issue
Block a user