mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-10-24 06:04:08 +00:00
Update samplers in shaders
This commit is contained in:
parent
716c9c0ecf
commit
cdbd9ed9dd
2 changed files with 10 additions and 3 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue