Commit 82aa5a6c authored by Ian Romanick's avatar Ian Romanick
Browse files

glsl-1.10 / glsl-1.30: Verify that fragment shader can only write one kind of output


Signed-off-by: default avatarIan Romanick <ian.d.romanick@intel.com>
Reviewed-by: default avatarChad Versace <chad.versace@linux.intel.com>
parent 5cfdf951
/* [config]
* expect_result: fail
* glsl_version: 1.10
* [end config]
*
* From page 49 of the GLSL 1.10 spec:
*
* "If a shader statically assigns a value to gl_FragColor, it may not
* assign a value to any element of gl_FragData. If a shader statically
* writes a value to any element of gl_FragData, it may not assign a value
* to gl_FragColor. That is, a shader may assign values to either
* gl_FragColor or gl_FragData, but not both."
*
* Since these are compile time errors and are based on static assignments,
* the check must happen before any dead-code removal or other optimizations.
*/
void main()
{
gl_FragColor = vec4(1.0);
if (false)
gl_FragData[0] = vec4(1.0);
}
/* [config]
* expect_result: fail
* glsl_version: 1.10
* [end config]
*
* From page 49 of the GLSL 1.10 spec:
*
* "If a shader statically assigns a value to gl_FragColor, it may not
* assign a value to any element of gl_FragData. If a shader statically
* writes a value to any element of gl_FragData, it may not assign a value
* to gl_FragColor. That is, a shader may assign values to either
* gl_FragColor or gl_FragData, but not both."
*/
void main()
{
gl_FragColor = vec4(1.0);
gl_FragData[0] = vec4(1.0);
}
/* [config]
* expect_result: fail
* glsl_version: 1.10
* [end config]
*
* From page 49 of the GLSL 1.10 spec:
*
* "If a shader statically assigns a value to gl_FragColor, it may not
* assign a value to any element of gl_FragData. If a shader statically
* writes a value to any element of gl_FragData, it may not assign a value
* to gl_FragColor. That is, a shader may assign values to either
* gl_FragColor or gl_FragData, but not both."
*
* Since these are compile time errors and are based on static assignments,
* the check must happen before any dead-code removal or other optimizations.
*/
void main()
{
if (false)
gl_FragColor = vec4(1.0);
gl_FragData[0] = vec4(1.0);
}
/* [config]
* expect_result: fail
* 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."
*
* Since these are compile time errors and are based on static assignments,
* the check must happen before any dead-code removal or other optimizations.
*/
#version 130
out vec4 frag_color;
void main()
{
gl_FragColor = vec4(1.0);
if (false)
frag_color = vec4(1.0);
}
/* [config]
* expect_result: fail
* 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."
*/
#version 130
out vec4 frag_color;
void main()
{
gl_FragColor = vec4(1.0);
frag_color = vec4(1.0);
}
/* [config]
* expect_result: fail
* 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."
*
* Since these are compile time errors and are based on static assignments,
* the check must happen before any dead-code removal or other optimizations.
*/
#version 130
out vec4 frag_color;
void main()
{
if (false)
gl_FragColor = vec4(1.0);
frag_color = vec4(1.0);
}
/* [config]
* expect_result: fail
* 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."
*
* Since these are compile time errors and are based on static assignments,
* the check must happen before any dead-code removal or other optimizations.
*/
#version 130
out vec4 frag_color;
void main()
{
gl_FragData[0] = vec4(1.0);
if (false)
frag_color = vec4(1.0);
}
/* [config]
* expect_result: fail
* 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."
*/
#version 130
out vec4 frag_color;
void main()
{
gl_FragData[0] = vec4(1.0);
frag_color = vec4(1.0);
}
/* [config]
* expect_result: fail
* 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."
*
* Since these are compile time errors and are based on static assignments,
* the check must happen before any dead-code removal or other optimizations.
*/
#version 130
out vec4 frag_color;
void main()
{
if (false)
gl_FragData[0] = vec4(1.0);
frag_color = vec4(1.0);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment