From afda2411c0bcf27db4a6330c2a297ef3696f41bc Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Wed, 4 Dec 2013 20:41:33 +0000 Subject: [PATCH] Check for structures out from vertex or into fragment for ES 100 or desktop pre-150. git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@24349 e7fa87d3-cd2b-0410-9028-fcbf551c1848 --- Test/100.frag | 2 ++ Test/100scope.vert | 2 ++ Test/140.frag | 2 ++ Test/150.frag | 2 ++ Test/300.vert | 2 ++ Test/baseResults/100.frag.out | 6 ++++-- Test/baseResults/100scope.vert.out | 4 +++- Test/baseResults/140.frag.out | 4 +++- Test/baseResults/150.frag.out | 1 + Test/baseResults/300.vert.out | 1 + glslang/Include/revision.h | 4 ++-- glslang/MachineIndependent/ParseHelper.cpp | 14 ++++++++++++++ 12 files changed, 38 insertions(+), 6 deletions(-) diff --git a/Test/100.frag b/Test/100.frag index 1b7f0d0e..28b0ec42 100644 --- a/Test/100.frag +++ b/Test/100.frag @@ -176,4 +176,6 @@ int agggf(float f) { return 2; } int agggf(float f); int agggf(float f); // ERROR, second prototype +varying struct SSS { float f; } s; // ERROR + uniform samplerExternalOES badExt; // syntax ERROR diff --git a/Test/100scope.vert b/Test/100scope.vert index 7e9f82ba..f7e26756 100644 --- a/Test/100scope.vert +++ b/Test/100scope.vert @@ -66,3 +66,5 @@ void main() S.x; // 'S' is now visible as a variable } } + +varying struct SSS { float f; } s; // ERROR diff --git a/Test/140.frag b/Test/140.frag index e7ae26d3..1ac44ce8 100644 --- a/Test/140.frag +++ b/Test/140.frag @@ -16,3 +16,5 @@ void main() #else #error GL_ES is not set #endif + +in struct S { float f; } s; // ERROR diff --git a/Test/150.frag b/Test/150.frag index d4d44881..49d5636a 100644 --- a/Test/150.frag +++ b/Test/150.frag @@ -12,3 +12,5 @@ void main() } layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord; // ERROR, declared after use + +in struct S { float f; } s; diff --git a/Test/300.vert b/Test/300.vert index 29453cfa..05a5932a 100644 --- a/Test/300.vert +++ b/Test/300.vert @@ -157,3 +157,5 @@ int gggf(float f); int agggf(float f) { return 2; } int agggf(float f); + +out struct Ssss { float f; } ssss; diff --git a/Test/baseResults/100.frag.out b/Test/baseResults/100.frag.out index bd7716fe..dafad7d4 100644 --- a/Test/baseResults/100.frag.out +++ b/Test/baseResults/100.frag.out @@ -66,8 +66,9 @@ ERROR: 0:152: 'floating-point suffix' : not supported for this version or the en ERROR: 0:167: 'highp' : overloaded functions must have the same parameter precision qualifiers for argument 2 ERROR: 0:170: 'multiple prototypes for same function' : not supported for this version or the enabled extensions ERROR: 0:177: 'multiple prototypes for same function' : not supported for this version or the enabled extensions -ERROR: 0:179: '' : syntax error -ERROR: 61 compilation errors. No code generated. +ERROR: 0:179: 'fragment-shader struct input' : not supported for this version or the enabled extensions +ERROR: 0:181: '' : syntax error +ERROR: 62 compilation errors. No code generated. ERROR: node is still EOpNull! @@ -342,6 +343,7 @@ ERROR: node is still EOpNull! 0:? 'f123' (mediump float) 0:? 'f124' (mediump float) 0:? 'sCube' (uniform lowp samplerCube) +0:? 's' (smooth in structure{f}) Linked fragment stage: diff --git a/Test/baseResults/100scope.vert.out b/Test/baseResults/100scope.vert.out index 0063ec5f..f155096c 100644 --- a/Test/baseResults/100scope.vert.out +++ b/Test/baseResults/100scope.vert.out @@ -7,7 +7,8 @@ ERROR: 0:22: 'redefinition of built-in function' : not supported with this profi ERROR: 0:35: 'local function declaration' : not supported with this profile: es ERROR: 0:54: 'z' : undeclared identifier ERROR: 0:54: 'z' : redefinition -ERROR: 8 compilation errors. No code generated. +ERROR: 0:70: 'vertex-shader struct output' : not supported for this version or the enabled extensions +ERROR: 9 compilation errors. No code generated. ERROR: node is still EOpNull! @@ -112,6 +113,7 @@ ERROR: node is still EOpNull! 0:? Linker Objects 0:? 'b' (bool) 0:? 'tan' (highp float) +0:? 's' (smooth out structure{f}) Linked vertex stage: diff --git a/Test/baseResults/140.frag.out b/Test/baseResults/140.frag.out index 4e963ee7..7ac82bb0 100644 --- a/Test/baseResults/140.frag.out +++ b/Test/baseResults/140.frag.out @@ -2,7 +2,8 @@ Warning, version 140 is not yet complete; most features are present, but a few are missing. WARNING: 0:3: varying deprecated in version 130; may be removed in future release ERROR: 0:17: '#error' : GL_ES is not set -ERROR: 1 compilation errors. No code generated. +ERROR: 0:20: 'fragment-shader struct input' : not supported for this version or the enabled extensions +ERROR: 2 compilation errors. No code generated. ERROR: node is still EOpNull! @@ -22,6 +23,7 @@ ERROR: node is still EOpNull! 0:? 'o' (out 4-component vector of float) 0:? 'gl_ClipDistance' (smooth in 5-element array of float) 0:? 'gl_ClipDistance' (smooth in 5-element array of float) +0:? 's' (smooth in structure{f}) Linked fragment stage: diff --git a/Test/baseResults/150.frag.out b/Test/baseResults/150.frag.out index 398e38a1..68d9ae04 100644 --- a/Test/baseResults/150.frag.out +++ b/Test/baseResults/150.frag.out @@ -21,6 +21,7 @@ ERROR: node is still EOpNull! 0:? 'gl_FragCoord' (gl_FragCoord 4-component vector of float) 0:? 'gl_FragCoord' (gl_FragCoord 4-component vector of float) 0:? 'foo' (smooth in 4-component vector of float) +0:? 's' (smooth in structure{f}) Linked fragment stage: diff --git a/Test/baseResults/300.vert.out b/Test/baseResults/300.vert.out index 156914db..e41d351b 100644 --- a/Test/baseResults/300.vert.out +++ b/Test/baseResults/300.vert.out @@ -285,6 +285,7 @@ ERROR: node is still EOpNull! 0:? 's2DS' (uniform lowp sampler2DShadow) 0:? 's2DAS' (uniform lowp sampler2DArrayShadow) 0:? 'c2D' (in highp 2-component vector of float) +0:? 'ssss' (smooth out structure{f}) 0:? 'gl_VertexID' (gl_VertexId highp int) 0:? 'gl_InstanceID' (gl_InstanceId highp int) diff --git a/glslang/Include/revision.h b/glslang/Include/revision.h index 77e51ba2..32650d76 100644 --- a/glslang/Include/revision.h +++ b/glslang/Include/revision.h @@ -9,5 +9,5 @@ // source have to figure out how to create revision.h just to get a build // going. However, if it is not updated, it can be a version behind. -#define GLSLANG_REVISION "24343" -#define GLSLANG_DATE "2013/12/04 12:46:19" +#define GLSLANG_REVISION "24347" +#define GLSLANG_DATE "2013/12/04 13:08:16" diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index cb74ed65..3d2d6f5e 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -1651,6 +1651,20 @@ void TParseContext::globalQualifierCheck(TSourceLoc loc, const TQualifier& quali } } + if (language == EShLangVertex && qualifier.storage == EvqVaryingOut) { + if (publicType.userDef) { + profileRequires(loc, EEsProfile, 300, 0, "vertex-shader struct output"); + profileRequires(loc, ~EEsProfile, 150, 0, "vertex-shader struct output"); + } + } + + if (language == EShLangFragment && qualifier.storage == EvqVaryingIn) { + if (publicType.userDef) { + profileRequires(loc, EEsProfile, 300, 0, "fragment-shader struct input"); + profileRequires(loc, ~EEsProfile, 150, 0, "fragment-shader struct input"); + } + } + if (publicType.basicType == EbtInt || publicType.basicType == EbtUint || publicType.basicType == EbtDouble) { profileRequires(loc, EEsProfile, 300, 0, "shader input/output"); if (! qualifier.flat) {