Files
z-bar-qt/Plugins/ZShell/Wallpaper/shaders/wallpaper_trans_fade.frag
T
zach b0cb43f75c
C++ / fmt (pull_request) Failing after 6s
C++ / build (pull_request) Failing after 10s
C++ / clang-tidy (pull_request) Failing after 11s
JS/TS / fmt (pull_request) Successful in 10s
JS/TS / lint (pull_request) Successful in 8s
Python / static (pull_request) Failing after 32s
Rust / build (pull_request) Successful in 52s
Python / verify (pull_request) Failing after 1m23s
Rust / fmt (pull_request) Successful in 51s
Rust / clippy (pull_request) Successful in 1m2s
feat: add vaapi path for video wallpapers on generic gpus
2026-10-27 02:15:16 +01:00

40 lines
1.1 KiB
GLSL

// Fade (crossfade) transition, from gl-transitions.com.
//
// Ported to ZShell's own GLSL ABI (same contract as wallpaper_trans_bowtie.frag):
// version/precision header is prepended by WallpaperService::shaderSource, the
// fullscreen triangle comes from shaders/wallpaper.vert, and getFromColor /
// getToColor sample with the crop + per-layer flip convention.
//
// uniforms: samplers `from`/`to`, vec2 size, vec4 fromCrop, vec4 toCrop,
// float fromFlip, float toFlip, float progress (0..1).
uniform sampler2D from;
uniform sampler2D to;
uniform vec2 size;
uniform vec4 fromCrop;
uniform vec4 toCrop;
uniform float fromFlip;
uniform float toFlip;
uniform float progress;
out vec4 outColor;
vec4 getFromColor(vec2 uv) {
vec2 s = vec2(uv.x, fromFlip > 0.5 ? 1.0 - uv.y : uv.y);
return texture(from, fromCrop.xy + s * fromCrop.zw);
}
vec4 getToColor(vec2 uv) {
vec2 s = vec2(uv.x, toFlip > 0.5 ? 1.0 - uv.y : uv.y);
return texture(to, toCrop.xy + s * toCrop.zw);
}
vec4 transition(vec2 uv) {
return mix(getFromColor(uv), getToColor(uv), progress);
}
void main() {
vec2 uv = gl_FragCoord.xy / size;
outColor = transition(uv);
}