Fix #2191: Error check for indexing reference containing unsize array.
This commit is contained in:
parent
2ac3c5b6d6
commit
b5f003d7a3
3 changed files with 20 additions and 6 deletions
|
|
@ -428,8 +428,18 @@ TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIn
|
|||
#ifndef GLSLANG_WEB
|
||||
if (base->isReference() && ! base->isArray()) {
|
||||
requireExtensions(loc, 1, &E_GL_EXT_buffer_reference2, "buffer reference indexing");
|
||||
result = intermediate.addBinaryMath(EOpAdd, base, index, loc);
|
||||
result->setType(base->getType());
|
||||
if (base->getType().getReferentType()->containsUnsizedArray()) {
|
||||
error(loc, "cannot index reference to buffer containing an unsized array", "", "");
|
||||
result = nullptr;
|
||||
} else {
|
||||
result = intermediate.addBinaryMath(EOpAdd, base, index, loc);
|
||||
if (result != nullptr)
|
||||
result->setType(base->getType());
|
||||
}
|
||||
if (result == nullptr) {
|
||||
error(loc, "cannot index buffer reference", "", "");
|
||||
result = intermediate.addConstantUnion(0.0, EbtFloat, loc);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
if (base->getAsSymbolNode() && isIoResizeArray(base->getType()))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue