Merge pull request #1739 from jeffbolznv/buffer_reference2

Add support for GL_EXT_buffer_reference2
This commit is contained in:
John Kessenich 2019-05-08 17:12:52 +07:00 committed by GitHub
commit e291f7a09f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 553 additions and 61 deletions

View file

@ -377,7 +377,8 @@ TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIn
// basic type checks...
variableCheck(base);
if (! base->isArray() && ! base->isMatrix() && ! base->isVector() && ! base->getType().isCoopMat()) {
if (! base->isArray() && ! base->isMatrix() && ! base->isVector() && ! base->getType().isCoopMat() &&
base->getBasicType() != EbtReference) {
if (base->getAsSymbolNode())
error(loc, " left of '[' is not of type array, matrix, or vector ", base->getAsSymbolNode()->getName().c_str(), "");
else
@ -405,6 +406,14 @@ TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIn
// at least one of base and index is not a front-end constant variable...
TIntermTyped* result = nullptr;
if (base->getBasicType() == EbtReference && ! base->isArray()) {
requireExtensions(loc, 1, &E_GL_EXT_buffer_reference2, "buffer reference indexing");
result = intermediate.addBinaryMath(EOpAdd, base, index, loc);
result->setType(base->getType());
return result;
}
if (index->getQualifier().isFrontEndConstant())
checkIndex(loc, base->getType(), indexValue);