mirror of
https://github.com/KhronosGroup/glslang
synced 2024-11-09 12:00:05 +00:00
Fix #2191: Error check for indexing reference containing unsize array.
This commit is contained in:
parent
2ac3c5b6d6
commit
b5f003d7a3
@ -14,12 +14,15 @@ ERROR: 0:14: 'buffer_reference' : can only be used with buffer
|
||||
ERROR: 0:14: 'buffer_reference' : can only be used with buffer
|
||||
ERROR: 0:30: 'length' : array must be declared with a size before using this method
|
||||
ERROR: 0:31: 'length' : array must be declared with a size before using this method
|
||||
ERROR: 0:35: '=' : cannot convert from 'layout( column_major std430) buffer reference' to ' temp reference'
|
||||
ERROR: 0:40: 'assign' : cannot convert from 'layout( column_major std430) buffer reference' to 'layout( column_major std430) buffer reference'
|
||||
ERROR: 0:32: 'buffer reference indexing' : required extension not requested: GL_EXT_buffer_reference2
|
||||
ERROR: 0:32: '' : cannot index reference to buffer containing an unsized array
|
||||
ERROR: 0:32: '' : cannot index buffer reference
|
||||
ERROR: 0:36: '=' : cannot convert from 'layout( column_major std430) buffer reference' to ' temp reference'
|
||||
ERROR: 0:41: 'assign' : cannot convert from 'layout( column_major std430) buffer reference' to 'layout( column_major std430) buffer reference'
|
||||
ERROR: 0:42: 'assign' : cannot convert from 'layout( column_major std430) buffer reference' to 'layout( column_major std430) buffer reference'
|
||||
ERROR: 0:45: '' : syntax error, unexpected LEFT_BRACE, expecting COMMA or SEMICOLON
|
||||
ERROR: 20 compilation errors. No code generated.
|
||||
ERROR: 0:43: 'assign' : cannot convert from 'layout( column_major std430) buffer reference' to 'layout( column_major std430) buffer reference'
|
||||
ERROR: 0:46: '' : syntax error, unexpected LEFT_BRACE, expecting COMMA or SEMICOLON
|
||||
ERROR: 23 compilation errors. No code generated.
|
||||
|
||||
|
||||
SPIR-V is not generated for failed compile or link
|
||||
|
@ -29,6 +29,7 @@ void f()
|
||||
bufType6 b;
|
||||
b.x.length();
|
||||
b4.b6.x.length();
|
||||
b[2]; // ERROR, can't index due to unsized array
|
||||
}
|
||||
|
||||
void main() {
|
||||
|
@ -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…
Reference in New Issue
Block a user