write-gl_FragData-and-function-output.frag 622 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* [config]
 * expect_result: pass
 * glsl_version: 1.30
 * [end config]
 *
 * From page 68 of the GLSL 1.30 spec:
 *
 *     "Similarly, if user declared output variables are in use (statically
 *     assigned to), then the built-in variables gl_FragColor and gl_FragData
 *     may not be assigned to. These incorrect usages all generate compile
 *     time errors."
 *
 * This test tries to trick the compiler by writing to gl_FragColor and an
 * 'out' parameter of a function.  This is valid.
 */
#version 130

void function(out vec4 f)
{
	f = vec4(1.0);
}

void main()
{
	vec4 v;

	function(v);
	gl_FragData[0] = v;
}