HLSL: Fix #1257: layout float1, int1, etc., as scalars.
This commit is contained in:
@@ -358,8 +358,8 @@ gl_FragCoord origin is upper left
|
|||||||
Name 138 "@entryPointOutput"
|
Name 138 "@entryPointOutput"
|
||||||
MemberDecorate 16($Global) 0 Offset 0
|
MemberDecorate 16($Global) 0 Offset 0
|
||||||
MemberDecorate 16($Global) 1 Offset 4
|
MemberDecorate 16($Global) 1 Offset 4
|
||||||
MemberDecorate 16($Global) 2 Offset 16
|
MemberDecorate 16($Global) 2 Offset 8
|
||||||
MemberDecorate 16($Global) 3 Offset 32
|
MemberDecorate 16($Global) 3 Offset 12
|
||||||
Decorate 16($Global) Block
|
Decorate 16($Global) Block
|
||||||
Decorate 18 DescriptorSet 0
|
Decorate 18 DescriptorSet 0
|
||||||
Decorate 138(@entryPointOutput) Location 0
|
Decorate 138(@entryPointOutput) Location 0
|
||||||
|
|||||||
@@ -1197,6 +1197,8 @@ int TIntermediate::getBaseAlignment(const TType& type, int& size, int& stride, b
|
|||||||
if (type.isVector()) {
|
if (type.isVector()) {
|
||||||
int scalarAlign = getBaseAlignmentScalar(type, size);
|
int scalarAlign = getBaseAlignmentScalar(type, size);
|
||||||
switch (type.getVectorSize()) {
|
switch (type.getVectorSize()) {
|
||||||
|
case 1: // HLSL has this, GLSL does not
|
||||||
|
return scalarAlign;
|
||||||
case 2:
|
case 2:
|
||||||
size *= 2;
|
size *= 2;
|
||||||
return 2 * scalarAlign;
|
return 2 * scalarAlign;
|
||||||
|
|||||||
@@ -829,7 +829,9 @@ TIntermTyped* HlslParseContext::handleBracketDereference(const TSourceLoc& loc,
|
|||||||
} else {
|
} else {
|
||||||
// at least one of base and index is variable...
|
// at least one of base and index is variable...
|
||||||
|
|
||||||
if (base->getAsSymbolNode() && wasFlattened(base)) {
|
if (base->getType().isScalarOrVec1())
|
||||||
|
result = base;
|
||||||
|
else if (base->getAsSymbolNode() && wasFlattened(base)) {
|
||||||
if (index->getQualifier().storage != EvqConst)
|
if (index->getQualifier().storage != EvqConst)
|
||||||
error(loc, "Invalid variable index to flattened array", base->getAsSymbolNode()->getName().c_str(), "");
|
error(loc, "Invalid variable index to flattened array", base->getAsSymbolNode()->getName().c_str(), "");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user