GLSL: Fix #1193: no 'location' on uniform/buffer block.

This commit is contained in:
John Kessenich 2017-12-16 10:07:22 -07:00
parent a0d60f2bea
commit e1ff231235
6 changed files with 25 additions and 7 deletions

View File

@ -1,5 +1,5 @@
#version 310 es
layout (location=0) uniform Block {
layout (binding=0) uniform Block {
highp int a[];
} uni;
layout (location=0) out highp int o;

View File

@ -46,3 +46,11 @@ void foo()
allInvocationsEqual(b1); // ERROR, need 4.6
}
; // ERROR: no extraneous semicolons
layout(location = 0) uniform locBlock { // ERROR, no location uniform block
int a;
};
layout(location = 0) buffer locBuffBlock { // ERROR, no location on buffer block
int b;
};

View File

@ -12,13 +12,13 @@ ERROR: node is still EOpNull!
0:7 'o' (layout( location=0) smooth out highp int)
0:7 direct index (layout( column_major shared) temp highp int)
0:7 a: direct index for structure (layout( column_major shared) uniform implicitly-sized array of highp int)
0:7 'uni' (layout( location=0 column_major shared) uniform block{layout( column_major shared) uniform implicitly-sized array of highp int a})
0:7 'uni' (layout( binding=0 column_major shared) uniform block{layout( column_major shared) uniform implicitly-sized array of highp int a})
0:7 Constant:
0:7 0 (const int)
0:7 Constant:
0:7 2 (const int)
0:? Linker Objects
0:? 'uni' (layout( location=0 column_major shared) uniform block{layout( column_major shared) uniform implicitly-sized array of highp int a})
0:? 'uni' (layout( binding=0 column_major shared) uniform block{layout( column_major shared) uniform implicitly-sized array of highp int a})
0:? 'o' (layout( location=0) smooth out highp int)
0:? 'gl_VertexID' ( gl_VertexId highp int VertexId)
0:? 'gl_InstanceID' ( gl_InstanceId highp int InstanceId)
@ -36,13 +36,13 @@ ERROR: node is still EOpNull!
0:7 'o' (layout( location=0) smooth out highp int)
0:7 direct index (layout( column_major shared) temp highp int)
0:7 a: direct index for structure (layout( column_major shared) uniform 1-element array of highp int)
0:7 'uni' (layout( location=0 column_major shared) uniform block{layout( column_major shared) uniform 1-element array of highp int a})
0:7 'uni' (layout( binding=0 column_major shared) uniform block{layout( column_major shared) uniform 1-element array of highp int a})
0:7 Constant:
0:7 0 (const int)
0:7 Constant:
0:7 2 (const int)
0:? Linker Objects
0:? 'uni' (layout( location=0 column_major shared) uniform block{layout( column_major shared) uniform 1-element array of highp int a})
0:? 'uni' (layout( binding=0 column_major shared) uniform block{layout( column_major shared) uniform 1-element array of highp int a})
0:? 'o' (layout( location=0) smooth out highp int)
0:? 'gl_VertexID' ( gl_VertexId highp int VertexId)
0:? 'gl_InstanceID' ( gl_InstanceId highp int InstanceId)

View File

@ -16,6 +16,7 @@ ERROR: 0:57: 'location on block member' : not supported for this version or the
ERROR: 0:62: 'location on block member' : can only use in an in/out block
ERROR: 0:62: 'location qualifier on uniform or buffer' : not supported for this version or the enabled extensions
ERROR: 0:60: 'location qualifier on uniform or buffer' : not supported for this version or the enabled extensions
ERROR: 0:60: 'location' : cannot apply to uniform or buffer block
ERROR: 0:68: 'layout-id value' : cannot be negative
ERROR: 0:69: 'layout-id value' : cannot be negative
ERROR: 0:76: 'f2' : cannot use layout qualifiers on structure members
@ -23,6 +24,7 @@ ERROR: 0:91: 'location on block member' : can only use in an in/out block
ERROR: 0:91: 'location qualifier on uniform or buffer' : not supported for this version or the enabled extensions
ERROR: 0:91: 'location' : overlapping use of location 3
ERROR: 0:89: 'location qualifier on uniform or buffer' : not supported for this version or the enabled extensions
ERROR: 0:89: 'location' : cannot apply to uniform or buffer block
ERROR: 0:94: 'location' : either the block needs a location, or all members need a location, or no members have a location
ERROR: 0:108: 'A' : cannot use layout qualifiers on structure members
ERROR: 0:119: 'location' : overlapping use of location 44
@ -38,7 +40,7 @@ ERROR: 0:140: 'assign' : cannot convert from ' const float' to ' temp 2-compone
ERROR: 0:141: 'textureQueryLod' : no matching overloaded function found
ERROR: 0:141: 'assign' : cannot convert from ' const float' to ' temp 2-component vector of float'
ERROR: 0:152: 'index' : value must be 0 or 1
ERROR: 39 compilation errors. No code generated.
ERROR: 41 compilation errors. No code generated.
Shader version: 330

View File

@ -19,7 +19,9 @@ ERROR: 0:44: 'anyInvocation' : no matching overloaded function found
ERROR: 0:45: 'allInvocations' : no matching overloaded function found
ERROR: 0:46: 'allInvocationsEqual' : no matching overloaded function found
ERROR: 0:48: 'extraneous semicolon' : not supported for this version or the enabled extensions
ERROR: 20 compilation errors. No code generated.
ERROR: 0:50: 'location' : cannot apply to uniform or buffer block
ERROR: 0:54: 'location' : cannot apply to uniform or buffer block
ERROR: 22 compilation errors. No code generated.
Shader version: 450
@ -77,6 +79,8 @@ ERROR: node is still EOpNull!
0:? 'outSS' ( smooth out structure{ global float f, global structure{ global float f} s})
0:? 'aui' (layout( binding=0 offset=0) uniform atomic_uint)
0:? 'ui' ( global uint)
0:? 'anon@1' (layout( location=0 column_major shared) uniform block{layout( column_major shared) uniform int a})
0:? 'anon@2' (layout( location=0 column_major shared) buffer block{layout( column_major shared) buffer int b})
0:? 'gl_VertexID' ( gl_VertexId int VertexId)
0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId)
@ -112,6 +116,8 @@ ERROR: node is still EOpNull!
0:? 'outSS' ( smooth out structure{ global float f, global structure{ global float f} s})
0:? 'aui' (layout( binding=0 offset=0) uniform atomic_uint)
0:? 'ui' ( global uint)
0:? 'anon@1' (layout( location=0 column_major shared) uniform block{layout( column_major shared) uniform int a})
0:? 'anon@2' (layout( location=0 column_major shared) buffer block{layout( column_major shared) buffer int b})
0:? 'gl_VertexID' ( gl_VertexId int VertexId)
0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId)

View File

@ -4569,6 +4569,8 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type)
break;
case EvqUniform:
case EvqBuffer:
if (type.getBasicType() == EbtBlock)
error(loc, "cannot apply to uniform or buffer block", "location", "");
break;
default:
error(loc, "can only apply to uniform, buffer, in, or out storage qualifiers", "location", "");