diff --git a/man/picom.1.asciidoc b/man/picom.1.asciidoc index 7f03d33..5304649 100644 --- a/man/picom.1.asciidoc +++ b/man/picom.1.asciidoc @@ -365,17 +365,45 @@ The shader must defined a function, 'vec4 window_shader()', which would be the e The following uniform/input variables are made available to the shader: - in vec2 texcoord; // texture coordinate of the fragment - - uniform float opacity; // opacity of the window (0.0 - 1.0) - uniform float dim; // dimming factor of the window (0.0 - 1.0, higher means more dim) - uniform float corner_radius; // corner radius of the window (pixels) - uniform float border_width; // estimated border width of the window (pixels) - uniform bool invert_color; // whether to invert the color of the window - uniform sampler2D tex; // texture of the window - uniform sampler2D brightness; // estimated brightness of the window, 1x1 texture - uniform float max_brightness; // configured maximum brightness of the window (0.0 - 1.0) - uniform float time; // time in milliseconds, counting from an unspecified starting point +[source,glsl] +---- +in vec2 texcoord; // texture coordinate of the fragment + +uniform float opacity; // opacity of the window (0.0 - 1.0) +uniform float dim; // dimming factor of the window (0.0 - 1.0, higher means more dim) +uniform float corner_radius; // corner radius of the window (pixels) +uniform float border_width; // estimated border width of the window (pixels) +uniform bool invert_color; // whether to invert the color of the window +uniform sampler2D tex; // texture of the window +uniform sampler2D brightness; // estimated brightness of the window, 1x1 texture +uniform float max_brightness; // configured maximum brightness of the window (0.0 - 1.0) +uniform float time; // time in milliseconds, counting from an unspecified starting point +---- + +The default behavior of picom window rendering can be replicated by the following shader: + +[source,glsl] +---- +#version 330 +in vec2 texcoord; // texture coordinate of the fragment + +uniform sampler2D tex; // texture of the window + +// Default window post-processing: +// 1) invert color +// 2) opacity / transparency +// 3) max-brightness clamping +// 4) rounded corners +vec4 default_post_processing(vec4 c); + +// Default window shader: +// 1) fetch the specified pixel +// 2) apply default post-processing +vec4 window_shader() { + vec4 c = texelFetch(tex, ivec2(texcoord), 0); + return default_post_processing(c); +} +---- The interface is expected to be mostly stable.