1// [config] 2// expect_result: fail 3// glsl_version: 4.20 4// require_extensions: GL_ARB_fragment_shader_interlock 5// check_link: false 6// [end config] 7 8/* The GL_ARB_fragment_shader_interlock spec says: 9 * 10 * The beginInvocationInterlockARB() and endInvocationInterlockARB() may 11 * only be placed inside the function main() of a fragment shader and may 12 * not be called within any flow control. These functions may not be 13 * called after a return statement in the function main(), but may be 14 * called after a discard statement. 15 * 16 * and 17 * 18 * (8) What restrictions should be imposed on the use of the 19 * beginInvocationInterlockARB() and endInvocationInterlockARB() 20 * functions delimiting a critical section? 21 * 22 * RESOLVED: We impose restrictions similar to those on the barrier() 23 * built-in function in tessellation control shaders to ensure that any 24 * shader using this functionality has a single critical section that can 25 * be easily identified during compilation... 26 * 27 * The GLSL 4.60 spec says: 28 * 29 * For tessellation control shaders, the barrier() function may only be 30 * placed inside the function main() of the tessellation control shader and 31 * may not be called within any control flow. Barriers are also disallowed 32 * after a return statement in the function main(). Any such misplaced 33 * barriers result in a compile-time error. 34 * 35 * From this we infer that the first errors mentioned in the 36 * GL_ARB_fragment_shader_interlock spec are intended to generate compile-time 37 * errors. 38 */ 39#version 420 40#extension GL_ARB_fragment_shader_interlock: require 41 42void wrapper() 43{ 44 endInvocationInterlockARB(); 45} 46 47void main() 48{ 49 beginInvocationInterlockARB(); 50 wrapper(); 51} 52