HLSL: Fix #1815: Don't constant fold spec-constant array indexing.
This commit is contained in:
parent
22683b409e
commit
4b4b41a634
4 changed files with 248 additions and 1 deletions
|
|
@ -816,7 +816,8 @@ TIntermTyped* HlslParseContext::handleBracketDereference(const TSourceLoc& loc,
|
|||
base->getAsSymbolNode()->getName().c_str(), "");
|
||||
else
|
||||
error(loc, " left of '[' is not of type array, matrix, or vector ", "expression", "");
|
||||
} else if (base->getType().getQualifier().storage == EvqConst && index->getQualifier().storage == EvqConst) {
|
||||
} else if (base->getType().getQualifier().isFrontEndConstant() &&
|
||||
index->getQualifier().isFrontEndConstant()) {
|
||||
// both base and index are front-end constants
|
||||
checkIndex(loc, base->getType(), indexValue);
|
||||
return intermediate.foldDereference(base, indexValue, loc);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue