Added simple post-processing.
This commit is contained in:
19
assets/shaders/glsl/post_process.comp
Normal file
19
assets/shaders/glsl/post_process.comp
Normal file
@@ -0,0 +1,19 @@
|
||||
#version 460
|
||||
|
||||
layout(local_size_x = 16, local_size_y = 16, local_size_x = 1) in;
|
||||
|
||||
layout(set = 0, binding = 0, rgba8) uniform readonly image2D u_sourceImage;
|
||||
layout(set = 1, binding = 0, rgba8) uniform writeonly image2D u_targetImage;
|
||||
|
||||
float luma(vec4 color)
|
||||
{
|
||||
return dot(color.rgb, vec3(0.299, 0.587, 0.114));
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
const ivec2 uv = ivec2(gl_GlobalInvocationID.xy);
|
||||
const vec4 pixel = imageLoad(u_sourceImage, uv);
|
||||
const float lum = luma(pixel);
|
||||
imageStore(u_targetImage, uv, vec4(lum, lum, lum, 1.0));
|
||||
}
|
||||
Reference in New Issue
Block a user