diff --git a/spa/plugins/vulkan/shaders/filter-color.comp b/spa/plugins/vulkan/shaders/filter-color.comp new file mode 100644 index 000000000..e08b715c5 --- /dev/null +++ b/spa/plugins/vulkan/shaders/filter-color.comp @@ -0,0 +1,39 @@ +void mainImage( out vec4 fragColor, in vec2 fragCoord ) +{ + vec2 p = fragCoord.xy/iResolution.xy; + + vec4 col = texture(iChannel0, p); + + + //Desaturate + if(p.x<.25) + { + col = vec4( (col.r+col.g+col.b)/3. ); + } + //Invert + else if (p.x<.5) + { + col = vec4(1.) - texture(iChannel0, p); + } + //Chromatic aberration + else if (p.x<.75) + { + vec2 offset = vec2(.01,.0); + col.r = texture(iChannel0, p+offset.xy).r; + col.g = texture(iChannel0, p ).g; + col.b = texture(iChannel0, p+offset.yx).b; + } + //Color switching + else + { + col.rgb = texture(iChannel0, p).brg; + } + + + //Line + if( mod(abs(p.x+.5/iResolution.y),.25)<0.5/iResolution.y ) + col = vec4(1.); + + + fragColor = col; +} diff --git a/spa/plugins/vulkan/shaders/filter.comp b/spa/plugins/vulkan/shaders/filter.comp new file mode 100644 index 000000000..f1ca48670 --- /dev/null +++ b/spa/plugins/vulkan/shaders/filter.comp @@ -0,0 +1,44 @@ +#version 450 +#extension GL_ARB_separate_shader_objects : enable + +#define WORKGROUP_SIZE 32 +layout (local_size_x = WORKGROUP_SIZE, local_size_y = WORKGROUP_SIZE, local_size_z = 1 ) in; + +layout(rgba32f, set = 0, binding = 0) uniform image2D resultImage; +layout(set = 0, binding = 1) uniform sampler2D iChannel0; + +layout( push_constant ) uniform Constants { + float time; + int frame; + int width; + int height; +} PushConstant; + +float iTime; +int iFrame; +vec3 iResolution; +vec4 iMouse; + +void mainImage( out vec4 fragColor, in vec2 fragCoord ); + +void main() +{ + iTime = PushConstant.time; + iFrame = PushConstant.frame; + iResolution = vec3(float(PushConstant.width), float(PushConstant.height), 0.0); + iMouse = vec4(0.0, 0.0, 0.0, 0.0); + vec2 coord = vec2(float(gl_GlobalInvocationID.x), + iResolution.y - float(gl_GlobalInvocationID.y)); + vec4 outColor; + + if(coord.x >= iResolution.x || coord.y >= iResolution.y) + return; + + mainImage(outColor, coord); + + imageStore(resultImage, ivec2(gl_GlobalInvocationID.xy), outColor); +} + +//#include "smearcam.comp" +#include "filter-color.comp" +//#include "filter-ripple.comp" diff --git a/spa/plugins/vulkan/shaders/filter.spv b/spa/plugins/vulkan/shaders/filter.spv new file mode 100644 index 000000000..5bfd24593 Binary files /dev/null and b/spa/plugins/vulkan/shaders/filter.spv differ diff --git a/spa/plugins/vulkan/shaders/main.spv b/spa/plugins/vulkan/shaders/main.spv index fac1545c2..5da17558e 100644 Binary files a/spa/plugins/vulkan/shaders/main.spv and b/spa/plugins/vulkan/shaders/main.spv differ