Commit 61d86313 authored by Chad Versace's avatar Chad Versace

AMD_conservative_depth: Add tests

parent 3fd587bc
......@@ -954,6 +954,12 @@ import_glsl_parser_tests(spec['glsl-1.30'],
os.path.dirname(__file__) + '/spec/glsl-1.30',
['preprocessor', 'compiler'])
# Group AMD_conservative_depth
spec['AMD_conservative_depth'] = Group()
import_glsl_parser_tests(spec['AMD_conservative_depth'],
os.path.dirname(__file__) + '/spec/amd_conservative_depth',
[''])
# Group ARB_ES2_compatibility
arb_es2_compatibility = Group()
spec['ARB_ES2_compatibility'] = arb_es2_compatibility
......
// [config]
// expect_result: pass
// glsl_version: 1.30
// require_extensions: GL_AMD_conservative_depth
// override_extensions: +GL_AMD_conservative_depth
// [end config]
//
// From the AMD_conservative_depth spec:
// Redeclarations are performed as follows:
//
// out float gl_FragDepth; // Redeclaration that changes nothing is allowed
//
// layout (depth_any) out float gl_FragDepth; // Assume that gl_FragDepth may be modified in any way
// layout (depth_greater) out float gl_FragDepth; // Assume that gl_FragDepth may be modified such that its value will only increase
// layout (depth_less) out float gl_FragDepth; // Assume that gl_FragDepth may be modified such that its value will only decrease
// layout (depth_unchanged) out float gl_FragDepth; // Assume that gl_FragDepth will not be modified
#version 130
#extension GL_AMD_conservative_depth: require
layout (depth_any) out float gl_FragDepth;
float f() {
return 0.0;
}
// [config]
// expect_result: pass
// glsl_version: 1.30
// require_extensions: GL_AMD_conservative_depth
// override_extensions: +GL_AMD_conservative_depth
// [end config]
//
// From the AMD_conservative_depth spec:
// Redeclarations are performed as follows:
//
// out float gl_FragDepth; // Redeclaration that changes nothing is allowed
//
// layout (depth_any) out float gl_FragDepth; // Assume that gl_FragDepth may be modified in any way
// layout (depth_greater) out float gl_FragDepth; // Assume that gl_FragDepth may be modified such that its value will only increase
// layout (depth_less) out float gl_FragDepth; // Assume that gl_FragDepth may be modified such that its value will only decrease
// layout (depth_unchanged) out float gl_FragDepth; // Assume that gl_FragDepth will not be modified
#version 130
#extension GL_AMD_conservative_depth: require
layout (depth_greater) out float gl_FragDepth;
float f() {
return 0.0;
}
// [config]
// expect_result: pass
// glsl_version: 1.30
// require_extensions: GL_AMD_conservative_depth
// override_extensions: +GL_AMD_conservative_depth
// [end config]
//
// From the AMD_conservative_depth spec:
// Redeclarations are performed as follows:
//
// out float gl_FragDepth; // Redeclaration that changes nothing is allowed
//
// layout (depth_any) out float gl_FragDepth; // Assume that gl_FragDepth may be modified in any way
// layout (depth_greater) out float gl_FragDepth; // Assume that gl_FragDepth may be modified such that its value will only increase
// layout (depth_less) out float gl_FragDepth; // Assume that gl_FragDepth may be modified such that its value will only decrease
// layout (depth_unchanged) out float gl_FragDepth; // Assume that gl_FragDepth will not be modified
#version 130
#extension GL_AMD_conservative_depth: require
layout (depth_less) out float gl_FragDepth;
float f() {
return 0.0;
}
// [config]
// expect_result: pass
// glsl_version: 1.30
// require_extensions: GL_AMD_conservative_depth
// override_extensions: +GL_AMD_conservative_depth
// [end config]
//
// From the AMD_conservative_depth spec:
// Redeclarations are performed as follows:
//
// out float gl_FragDepth; // Redeclaration that changes nothing is allowed
//
// layout (depth_any) out float gl_FragDepth; // Assume that gl_FragDepth may be modified in any way
// layout (depth_greater) out float gl_FragDepth; // Assume that gl_FragDepth may be modified such that its value will only increase
// layout (depth_less) out float gl_FragDepth; // Assume that gl_FragDepth may be modified such that its value will only decrease
// layout (depth_unchanged) out float gl_FragDepth; // Assume that gl_FragDepth will not be modified
#version 130
#extension GL_AMD_conservative_depth: require
layout (depth_unchanged) out float gl_FragDepth;
float f() {
return 0.0;
}
// [config]
// expect_result: fail
// glsl_version: 1.30
// require_extensions: GL_AMD_conservative_depth
// override_extensions: +GL_AMD_conservative_depth
// [end config]
#version 130
#extension GL_AMD_conservative_depth: require
layout (invalid_layout) out float gl_FragDepth;
float f() {
return 0.0;
}
// [config]
// expect_result: fail
// glsl_version: 1.30
// require_extensions: GL_AMD_conservative_depth
// override_extensions: +GL_AMD_conservative_depth
// [end config]
//
// From the AMD_conservative_depth spec:
// Within any shader, the first redeclarations of gl_FragDepth must appear
// before any use of gl_FragDepth.
#version 130
#extension GL_AMD_conservative_depth: require
float f() {
gl_FragDepth = 0.0;
return 0.0;
}
layout (depth_any) out float gl_FragDepth;
// [config]
// expect_result: pass
// glsl_version: 1.30
// require_extensions: GL_AMD_conservative_depth
// override_extensions: +GL_AMD_conservative_depth
// [end config]
//
// From the AMD_conservative_depth spec:
// Redeclarations are performed as follows:
//
// out float gl_FragDepth; // Redeclaration that changes nothing is allowed
//
// layout (depth_any) out float gl_FragDepth; // Assume that gl_FragDepth may be modified in any way
// layout (depth_greater) out float gl_FragDepth; // Assume that gl_FragDepth may be modified such that its value will only increase
// layout (depth_less) out float gl_FragDepth; // Assume that gl_FragDepth may be modified such that its value will only decrease
// layout (depth_unchanged) out float gl_FragDepth; // Assume that gl_FragDepth will not be modified
#version 130
#extension GL_AMD_conservative_depth: require
out float gl_FragDepth;
float f() {
return 0.0;
}
// [config]
// expect_result: pass
// glsl_version: 1.30
// require_extensions: GL_AMD_conservative_depth
// override_extensions: +GL_AMD_conservative_depth
// [end config]
//
// Require AMD_conservative_depth in the fragment shader, but don't use any of its
// features.
#version 130
#extension GL_AMD_conservative_depth: require
float f() {
return 0.0;
}
// [config]
// expect_result: pass
// glsl_version: 1.30
// require_extensions: GL_AMD_conservative_depth
// override_extensions: +GL_AMD_conservative_depth
// [end config]
//
// Require AMD_conservative_depth in the vertex shader, but don't use any of its
// features.
//
// The AMD_conservative_depth spec says nothing of vertex shaders, and does not
// explicitly restrict the extension to the fragment shader, so it shouldn't be
// an error to require the extension here.
#version 130
#extension GL_AMD_conservative_depth: require
float f() {
return 0.0;
}
// [config]
// expect_result: fail
// glsl_version: 1.30
// require_extensions: GL_AMD_conservative_depth
// override_extensions: +GL_AMD_conservative_depth
// [end config]
//
// Cannot redeclare gl_FragDepth in vertex shader.
//
// From the AMD_conservative_depth spec:
// The built-in gl_FragDepth is only predeclared in fragment shaders, so
// redeclaring it in any other shader language will be illegal.
#version 130
#extension GL_AMD_conservative_depth: require
layout(depth_any) out float gl_FragDepth;
float f() {
return 0.0;
}
// [config]
// expect_result: pass
// glsl_version: 1.30
// require_extensions: GL_AMD_conservative_depth
// override_extensions: +GL_AMD_conservative_depth
// [end config]
//
// From the AMD_conservative_depth spec:
// A new preprocessor #define is added to the OpenGL Shading Language:
// #define GL_AMD_conservative_depth 1
#version 130
#extension GL_AMD_conservative_depth: require
#if !defined GL_AMD_conservative_depth
# error GL_AMD_conservative_depth is not defined
#elif GL_AMD_conservative_depth != 1
# error GL_AMD_conservative_depth != 1
#endif
float foo() { return 0.0; }
// [config]
// expect_result: pass
// glsl_version: 1.30
// require_extensions: GL_AMD_conservative_depth
// override_extensions: +GL_AMD_conservative_depth
// [end config]
//
// From the AMD_conservative_depth spec:
// A new preprocessor #define is added to the OpenGL Shading Language:
// #define GL_AMD_conservative_depth 1
#version 130
#extension GL_AMD_conservative_depth: require
#if !defined GL_AMD_conservative_depth
# error GL_AMD_conservative_depth is not defined
#elif GL_AMD_conservative_depth != 1
# error GL_AMD_conservative_depth != 1
#endif
float foo() { return 0.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