32 lines
922 B
GLSL
32 lines
922 B
GLSL
|
#version 460 core
|
||
|
|
||
|
layout(location = 0) in vec2 inUV;
|
||
|
layout(location = 1) in vec2 inPos;
|
||
|
layout(location = 2) in float cocRadius;
|
||
|
|
||
|
layout(location = 0) out vec4 outColor;
|
||
|
|
||
|
layout(binding = 0) uniform sampler2D bokehSampler;
|
||
|
layout(binding = 1) uniform sampler2D sceneSampler;
|
||
|
layout(binding = 2) uniform sampler2D depthSampler;
|
||
|
|
||
|
layout(push_constant) uniform PushConstants {
|
||
|
vec4 dpack;
|
||
|
} pushConstants;
|
||
|
|
||
|
void main() {
|
||
|
const vec2 res = vec2(pushConstants.dpack[2], pushConstants.dpack[3]);
|
||
|
|
||
|
outColor = texture(sceneSampler, vec2(inPos.x / res.x, inPos.y / res.y)) * texture(bokehSampler, inUV);
|
||
|
outColor.a = (cocRadius / 9000.0);
|
||
|
|
||
|
if(pushConstants.dpack[0] == 0) {
|
||
|
if(texture(depthSampler, gl_FragCoord.xy / res).r < pushConstants.dpack[1])
|
||
|
discard;
|
||
|
} else {
|
||
|
if(texture(depthSampler, gl_FragCoord.xy / res).r > pushConstants.dpack[1])
|
||
|
discard;
|
||
|
}
|
||
|
}
|
||
|
|