Front end: Prevent use of a block name, which has no other use in a shader.
This commit is contained in:
parent
68965c0fa9
commit
78a5a0d7d8
@ -448,8 +448,16 @@ TIntermTyped* TParseContext::handleVariable(TSourceLoc loc, TSymbol* symbol, con
|
|||||||
// The symbol table search was done in the lexical phase.
|
// The symbol table search was done in the lexical phase.
|
||||||
// See if it was a variable.
|
// See if it was a variable.
|
||||||
variable = symbol ? symbol->getAsVariable() : 0;
|
variable = symbol ? symbol->getAsVariable() : 0;
|
||||||
if (symbol && ! variable)
|
if (variable) {
|
||||||
|
if ((variable->getType().getBasicType() == EbtBlock ||
|
||||||
|
variable->getType().getBasicType() == EbtStruct) && variable->getType().getStruct() == nullptr) {
|
||||||
|
error(loc, "cannot be used (maybe an instance name is needed)", string->c_str(), "");
|
||||||
|
variable = nullptr;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (symbol)
|
||||||
error(loc, "variable name expected", string->c_str(), "");
|
error(loc, "variable name expected", string->c_str(), "");
|
||||||
|
}
|
||||||
|
|
||||||
// Recovery, if it wasn't found or was not a variable.
|
// Recovery, if it wasn't found or was not a variable.
|
||||||
if (! variable)
|
if (! variable)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user