diff --git a/Test/330.frag b/Test/330.frag index 57736b0c46dce808d47222f14a105bcc5136fcc4..9afa8f826976129481819b5c3ec9ac9a8c05a5b8 100644 --- a/Test/330.frag +++ b/Test/330.frag @@ -148,3 +148,5 @@ void fooKeyMem() { KeyMem.precise; } + +layout(location=28, index=2) out vec4 outIndex2; // ERROR index out of range \ No newline at end of file diff --git a/Test/baseResults/330.frag.out b/Test/baseResults/330.frag.out index 5d145efd0722fcf706139b0d61a965ca99a04cd6..904ad3edf38cc1ce0e78c24bfeab6102891535ab 100644 --- a/Test/baseResults/330.frag.out +++ b/Test/baseResults/330.frag.out @@ -37,7 +37,8 @@ ERROR: 0:140: 'textureQueryLod' : no matching overloaded function found ERROR: 0:140: 'assign' : cannot convert from 'const float' to 'temp 2-component vector of float' 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: 38 compilation errors. No code generated. +ERROR: 0:152: 'index' : value must be 0 or 1 +ERROR: 39 compilation errors. No code generated. Shader version: 330 @@ -122,6 +123,7 @@ ERROR: node is still EOpNull! 0:? 'samp2Ds' (uniform sampler2DShadow) 0:? 'precise' (global int) 0:? 'KeyMem' (global structure{global int precise}) +0:? 'outIndex2' (layout(location=28 index=0 ) out 4-component vector of float) Linked fragment stage: @@ -211,4 +213,5 @@ ERROR: node is still EOpNull! 0:? 'samp2Ds' (uniform sampler2DShadow) 0:? 'precise' (global int) 0:? 'KeyMem' (global structure{global int precise}) +0:? 'outIndex2' (layout(location=28 index=0 ) out 4-component vector of float) diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index 31a94d26bf61e8a63550b9f11f63a20210431fc0..959d69002441511f7c1925611fb256a5172ac24a 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -4225,6 +4225,13 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi requireProfile(loc, ECompatibilityProfile | ECoreProfile, "index layout qualifier on fragment output"); const char* exts[2] = { E_GL_ARB_separate_shader_objects, E_GL_ARB_explicit_attrib_location }; profileRequires(loc, ECompatibilityProfile | ECoreProfile, 330, 2, exts, "index layout qualifier on fragment output"); + + // "It is also a compile-time error if a fragment shader sets a layout index to less than 0 or greater than 1." + if (value < 0 || value > 1) { + value = 0; + error(loc, "value must be 0 or 1", "index", ""); + } + publicType.qualifier.layoutIndex = value; return; }