GLSL: validation of early_fragment_tests, others, on an object.

Some layout qualifiers must not be on an object and had a TBD for testing
them: early_fragment_tests, cw/ccw, points, point_mode, and
fractional_even_spacing/fractional_odd_spacing/equal_spacing.
This commit is contained in:
John Kessenich 2017-06-29 10:46:47 -06:00
parent 89f8d1e64f
commit 89400ea73e
7 changed files with 56 additions and 11 deletions

View File

@ -64,3 +64,5 @@ layout(location = 12) in bName2 {
float f;
layout(location = 13) float g; // ERROR, location on array
} bInst2[3];
layout(early_fragment_tests) in float f; // ERROR, must be standalone

View File

@ -15,3 +15,5 @@ void main()
gl_in[3].gl_Position; // ERROR, out of range
gl_CullDistance[2] = gl_in[1].gl_CullDistance[2];
}
layout(points) in float f[3]; // ERROR, must be standalone

View File

@ -12,3 +12,10 @@ void main()
{
gl_CullDistance[2] = gl_in[1].gl_CullDistance[2];
}
layout(equal_spacing) in float f1[]; // ERROR, must be standalone
layout(fractional_even_spacing) in float f2[]; // ERROR, must be standalone
layout(fractional_odd_spacing) in float f3[]; // ERROR, must be standalone
layout(cw) in float f4[]; // ERROR, must be standalone
layout(ccw) in float f5[]; // ERROR, must be standalone
layout(point_mode) in float f6[]; // ERROR, must be standalone

View File

@ -1,6 +1,7 @@
450.frag
ERROR: 0:63: 'location' : cannot use in a block array where new locations are needed for each block element
ERROR: 1 compilation errors. No code generated.
ERROR: 0:68: 'early_fragment_tests' : can only apply to a standalone qualifier
ERROR: 2 compilation errors. No code generated.
Shader version: 450
@ -164,6 +165,7 @@ ERROR: node is still EOpNull!
0:? 'i2dmsa' (layout( rgba32f) uniform image2DMSArray)
0:? 'bInst1' ( in block{layout( location=6) in float f, layout( location=7) in float g, layout( location=8) in 4X4 matrix of float m})
0:? 'bInst2' ( in 3-element array of block{layout( location=12) in float f, layout( location=13) in float g})
0:? 'f' ( smooth in float)
Linked fragment stage:
@ -279,4 +281,5 @@ ERROR: node is still EOpNull!
0:? 'i2dmsa' (layout( rgba32f) uniform image2DMSArray)
0:? 'bInst1' ( in block{layout( location=6) in float f, layout( location=7) in float g, layout( location=8) in 4X4 matrix of float m})
0:? 'bInst2' ( in 3-element array of block{layout( location=12) in float f, layout( location=13) in float g})
0:? 'f' ( smooth in float)

View File

@ -1,7 +1,8 @@
450.geom
ERROR: 0:15: '[' : array index out of range '3'
ERROR: 0:15: 'gl_Position' : no such field in structure
ERROR: 2 compilation errors. No code generated.
ERROR: 0:19: 'points' : can only apply to a standalone qualifier
ERROR: 3 compilation errors. No code generated.
Shader version: 450
@ -38,6 +39,7 @@ ERROR: node is still EOpNull!
0:? Linker Objects
0:? 'gl_in' ( in 3-element array of block{ in 3-element array of float CullDistance gl_CullDistance})
0:? 'anon@0' (layout( stream=0) out block{layout( stream=0) out 3-element array of float CullDistance gl_CullDistance})
0:? 'f' ( in 3-element array of float)
Linked geometry stage:
@ -79,4 +81,5 @@ ERROR: node is still EOpNull!
0:? Linker Objects
0:? 'gl_in' ( in 3-element array of block{ in 3-element array of float CullDistance gl_CullDistance})
0:? 'anon@0' (layout( stream=0) out block{layout( stream=0) out 3-element array of float CullDistance gl_CullDistance})
0:? 'f' ( in 3-element array of float)

View File

@ -1,9 +1,18 @@
450.tese
ERROR: 0:16: 'equal_spacing' : can only apply to a standalone qualifier
ERROR: 0:17: 'fractional_even_spacing' : can only apply to a standalone qualifier
ERROR: 0:18: 'fractional_odd_spacing' : can only apply to a standalone qualifier
ERROR: 0:19: 'cw' : can only apply to a standalone qualifier
ERROR: 0:20: 'ccw' : can only apply to a standalone qualifier
ERROR: 0:21: 'point_mode' : can only apply to a standalone qualifier
ERROR: 6 compilation errors. No code generated.
Shader version: 450
input primitive = none
vertex spacing = none
triangle order = none
0:? Sequence
ERROR: node is still EOpNull!
0:11 Function Definition: main( ( global void)
0:11 Function Parameters:
0:13 Sequence
@ -28,6 +37,12 @@ triangle order = none
0:? Linker Objects
0:? 'gl_in' ( in 32-element array of block{ in 3-element array of float CullDistance gl_CullDistance})
0:? 'anon@0' ( out block{ out 3-element array of float CullDistance gl_CullDistance})
0:? 'f1' ( in 32-element array of float)
0:? 'f2' ( in 32-element array of float)
0:? 'f3' ( in 32-element array of float)
0:? 'f4' ( in 32-element array of float)
0:? 'f5' ( in 32-element array of float)
0:? 'f6' ( in 32-element array of float)
Linked tessellation evaluation stage:
@ -38,7 +53,7 @@ Shader version: 450
input primitive = none
vertex spacing = equal_spacing
triangle order = ccw
0:? Sequence
ERROR: node is still EOpNull!
0:11 Function Definition: main( ( global void)
0:11 Function Parameters:
0:13 Sequence
@ -63,4 +78,10 @@ triangle order = ccw
0:? Linker Objects
0:? 'gl_in' ( in 32-element array of block{ in 3-element array of float CullDistance gl_CullDistance})
0:? 'anon@0' ( out block{ out 3-element array of float CullDistance gl_CullDistance})
0:? 'f1' ( in 32-element array of float)
0:? 'f2' ( in 32-element array of float)
0:? 'f3' ( in 32-element array of float)
0:? 'f4' ( in 32-element array of float)
0:? 'f5' ( in 32-element array of float)
0:? 'f6' ( in 32-element array of float)

View File

@ -4778,8 +4778,22 @@ void TParseContext::checkNoShaderLayouts(const TSourceLoc& loc, const TShaderQua
if (shaderQualifiers.geometry != ElgNone)
error(loc, message, TQualifier::getGeometryString(shaderQualifiers.geometry), "");
if (shaderQualifiers.spacing != EvsNone)
error(loc, message, TQualifier::getVertexSpacingString(shaderQualifiers.spacing), "");
if (shaderQualifiers.order != EvoNone)
error(loc, message, TQualifier::getVertexOrderString(shaderQualifiers.order), "");
if (shaderQualifiers.pointMode)
error(loc, message, "point_mode", "");
if (shaderQualifiers.invocations != TQualifier::layoutNotSet)
error(loc, message, "invocations", "");
if (shaderQualifiers.earlyFragmentTests)
error(loc, message, "early_fragment_tests", "");
for (int i = 0; i < 3; ++i) {
if (shaderQualifiers.localSize[i] > 1)
error(loc, message, "local_size", "");
if (shaderQualifiers.localSizeSpecId[i] != TQualifier::layoutNotSet)
error(loc, message, "local_size id", "");
}
if (shaderQualifiers.vertices != TQualifier::layoutNotSet) {
if (language == EShLangGeometry)
error(loc, message, "max_vertices", "");
@ -4788,15 +4802,8 @@ void TParseContext::checkNoShaderLayouts(const TSourceLoc& loc, const TShaderQua
else
assert(0);
}
for (int i = 0; i < 3; ++i) {
if (shaderQualifiers.localSize[i] > 1)
error(loc, message, "local_size", "");
if (shaderQualifiers.localSizeSpecId[i] != TQualifier::layoutNotSet)
error(loc, message, "local_size id", "");
}
if (shaderQualifiers.blendEquation)
error(loc, message, "blend equation", "");
// TBD: correctness: are any of these missing? pixelCenterInteger, originUpperLeft, spacing, order, pointmode, earlyfragment, depth
}
// Correct and/or advance an object's offset layout qualifier.