Merge pull request #2032 from ShchchowAMD/atomic-uint-binding

Modify max binding checks for atomic_uint
This commit is contained in:
John Kessenich 2020-01-06 23:49:23 -07:00 committed by GitHub
commit 1d258ac346
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 9 deletions

View File

@ -1,5 +1,8 @@
#version 450 core #version 450 core
layout(local_size_x = 0) in; // ERROR, 0 not allowed layout(local_size_x = 0) in; // ERROR, 0 not allowed
layout(binding=10000) uniform atomic_uint; // ERROR
void main() void main()
{ {
shared float f; // ERROR shared must be global shared float f; // ERROR shared must be global

View File

@ -1,14 +1,15 @@
450.comp 450.comp
ERROR: 0:2: 'local_size_x' : must be at least 1 ERROR: 0:2: 'local_size_x' : must be at least 1
ERROR: 0:5: 'shared' : not allowed in nested scope ERROR: 0:4: 'binding' : atomic_uint binding is too large
ERROR: 2 compilation errors. No code generated. ERROR: 0:8: 'shared' : not allowed in nested scope
ERROR: 3 compilation errors. No code generated.
Shader version: 450 Shader version: 450
local_size = (1, 1, 1) local_size = (1, 1, 1)
ERROR: node is still EOpNull! ERROR: node is still EOpNull!
0:3 Function Definition: main( ( global void) 0:6 Function Definition: main( ( global void)
0:3 Function Parameters: 0:6 Function Parameters:
0:? Linker Objects 0:? Linker Objects
@ -18,7 +19,7 @@ Linked compute stage:
Shader version: 450 Shader version: 450
local_size = (1, 1, 1) local_size = (1, 1, 1)
ERROR: node is still EOpNull! ERROR: node is still EOpNull!
0:3 Function Definition: main( ( global void) 0:6 Function Definition: main( ( global void)
0:3 Function Parameters: 0:6 Function Parameters:
0:? Linker Objects 0:? Linker Objects

View File

@ -6384,13 +6384,15 @@ const TFunction* TParseContext::findFunctionExplicitTypes(const TSourceLoc& loc,
void TParseContext::declareTypeDefaults(const TSourceLoc& loc, const TPublicType& publicType) void TParseContext::declareTypeDefaults(const TSourceLoc& loc, const TPublicType& publicType)
{ {
#ifndef GLSLANG_WEB #ifndef GLSLANG_WEB
if (publicType.basicType == EbtAtomicUint && publicType.qualifier.hasBinding() && if (publicType.basicType == EbtAtomicUint && publicType.qualifier.hasBinding()) {
publicType.qualifier.hasOffset()) {
if (publicType.qualifier.layoutBinding >= (unsigned int)resources.maxAtomicCounterBindings) { if (publicType.qualifier.layoutBinding >= (unsigned int)resources.maxAtomicCounterBindings) {
error(loc, "atomic_uint binding is too large", "binding", ""); error(loc, "atomic_uint binding is too large", "binding", "");
return; return;
} }
atomicUintOffsets[publicType.qualifier.layoutBinding] = publicType.qualifier.layoutOffset;
if(publicType.qualifier.hasOffset()) {
atomicUintOffsets[publicType.qualifier.layoutBinding] = publicType.qualifier.layoutOffset;
}
return; return;
} }