diff options
Diffstat (limited to 'tests/glsl/sascha-willems/shadowmapping/quad.frag')
| -rw-r--r-- | tests/glsl/sascha-willems/shadowmapping/quad.frag | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/glsl/sascha-willems/shadowmapping/quad.frag b/tests/glsl/sascha-willems/shadowmapping/quad.frag new file mode 100644 index 000000000..3074bd5ee --- /dev/null +++ b/tests/glsl/sascha-willems/shadowmapping/quad.frag @@ -0,0 +1,25 @@ +//TEST:COMPARE_GLSL: +#version 450 + +#extension GL_ARB_separate_shader_objects : enable +#extension GL_ARB_shading_language_420pack : enable + +layout (binding = 1) uniform sampler2D samplerColor; + +layout (location = 0) in vec2 inUV; + +layout (location = 0) out vec4 outFragColor; + +float LinearizeDepth(float depth) +{ + float n = 1.0; // camera z near + float f = 128.0; // camera z far + float z = depth; + return (2.0 * n) / (f + n - z * (f - n)); +} + +void main() +{ + float depth = texture(samplerColor, inUV).r; + outFragColor = vec4(vec3(1.0-LinearizeDepth(depth)), 1.0); +}
\ No newline at end of file |
