diff --git a/kitty/shaders/custom/pipeline.slang b/kitty/shaders/custom/pipeline.slang index d10a52900..cb638f1e4 100644 --- a/kitty/shaders/custom/pipeline.slang +++ b/kitty/shaders/custom/pipeline.slang @@ -57,12 +57,12 @@ float3 linear2srgb(float3 x) { // vector return lerp(lower, upper, step(float3(0.0031308f), x)); } -uniform Sampler2D backbuffer; +uniform Sampler2D backbuffer, a, b, persist; public float4 pipeline_fragment_main(float2 backbuffer_pos, int group) { float4 color = backbuffer.Sample(backbuffer_pos); // pre multiplied linear RGB color = float4(color.rgb / color.a, color.a); // un pre multiplied color passed through pipeline - KittyTextures t = {backbuffer, backbuffer_pos}; + KittyTextures t = {backbuffer, a, b, persist, backbuffer_pos}; // PIPELINE return vec4_premul(color.rgb, color.a); } diff --git a/kitty/shaders/custom/types.slang b/kitty/shaders/custom/types.slang index b1bd87d26..43203956d 100644 --- a/kitty/shaders/custom/types.slang +++ b/kitty/shaders/custom/types.slang @@ -13,8 +13,15 @@ public struct KittyCustomShaderData { public struct KittyTextures { // the buffer containing the original rendered pixels from kitty's own rendering. This will - // be updated with the output color only after all custom shaders in the chain have run + // be updated with the output color only after all custom shaders in this group have run public Sampler2D backbuffer; + // The following are named textures that can be sampled from in custom + // shaders. The persist texture will persist across frames, anything + // written to it in render number N can be read from it in subsequent + // renders. + public Sampler2D a; + public Sampler2D b; + public Sampler2D persist; public float2 pos; // the position of this pixel in the textures }