summaryrefslogtreecommitdiff
path: root/shaders
diff options
context:
space:
mode:
Diffstat (limited to 'shaders')
-rw-r--r--shaders/prebuilt/ui.frag.glsl18
-rw-r--r--shaders/prebuilt/ui.frag.spvbin8176 -> 6968 bytes
-rw-r--r--shaders/ui.frag.glsl18
3 files changed, 8 insertions, 28 deletions
diff --git a/shaders/prebuilt/ui.frag.glsl b/shaders/prebuilt/ui.frag.glsl
index cb38fff1..51ec5b8c 100644
--- a/shaders/prebuilt/ui.frag.glsl
+++ b/shaders/prebuilt/ui.frag.glsl
@@ -27,16 +27,6 @@ layout(location = 5) flat in vec4 v_clip;
layout(location = 0) out vec4 o_col;
-float cellNoise(uint serial, uint col, uint row) {
- uint x = serial ^ (col * 0x9e3779b9u) ^ (row * 0x85ebca6bu);
- x ^= x >> 16;
- x *= 0x7feb352du;
- x ^= x >> 15;
- x *= 0x846ca68bu;
- x ^= x >> 16;
- return float(x & 0xffffu) / 65535.0;
-}
-
void main() {
if (v_clip.z >= v_clip.x && (gl_FragCoord.x < v_clip.x || gl_FragCoord.x >= v_clip.z ||
gl_FragCoord.y < v_clip.y || gl_FragCoord.y >= v_clip.w)) discard;
@@ -51,9 +41,6 @@ void main() {
: clamp(u_ui.background_opacity, 0.0, 1.0);
uint effect = v_effect.x & 0x07ffffffu;
float progress = clamp(uintBitsToFloat(v_effect.y), 0.0, 1.0);
- uint cellCol = v_effect.w & 0xffffu;
- uint cellRow = v_effect.w >> 16;
- float noise = cellNoise(v_effect.z, cellCol, cellRow);
// Ink over ground, both premultiplied: v_fg*a + (v_bg*bgA)*(1-a), which is
// mix() with the ground already premultiplied. At bgA = 1 that is exactly
@@ -63,7 +50,10 @@ void main() {
// dot every period pixels, fixed to the window, under the text.
if ((v_effect.x & 0x10000000u) != 0u) {
float period = u_ui.decor_dot_geom.x;
- vec2 d = mod(gl_FragCoord.xy, period) - 0.5 * period;
+ // v_effect.z: how far its pane's text has moved the dots (G13's
+ // parallax), in pixels, as a float's bits (0 without).
+ vec2 at = gl_FragCoord.xy - vec2(0.0, uintBitsToFloat(v_effect.z));
+ vec2 d = mod(at, period) - 0.5 * period;
float dot_a = 1.0 - smoothstep(u_ui.decor_dot_geom.y, u_ui.decor_dot_geom.z, length(d));
ground = mix(ground, u_ui.decor_dots.rgb, u_ui.decor_dots.a * dot_a);
}
diff --git a/shaders/prebuilt/ui.frag.spv b/shaders/prebuilt/ui.frag.spv
index 15318214..02e3edc4 100644
--- a/shaders/prebuilt/ui.frag.spv
+++ b/shaders/prebuilt/ui.frag.spv
Binary files differ
diff --git a/shaders/ui.frag.glsl b/shaders/ui.frag.glsl
index cb38fff1..51ec5b8c 100644
--- a/shaders/ui.frag.glsl
+++ b/shaders/ui.frag.glsl
@@ -27,16 +27,6 @@ layout(location = 5) flat in vec4 v_clip;
layout(location = 0) out vec4 o_col;
-float cellNoise(uint serial, uint col, uint row) {
- uint x = serial ^ (col * 0x9e3779b9u) ^ (row * 0x85ebca6bu);
- x ^= x >> 16;
- x *= 0x7feb352du;
- x ^= x >> 15;
- x *= 0x846ca68bu;
- x ^= x >> 16;
- return float(x & 0xffffu) / 65535.0;
-}
-
void main() {
if (v_clip.z >= v_clip.x && (gl_FragCoord.x < v_clip.x || gl_FragCoord.x >= v_clip.z ||
gl_FragCoord.y < v_clip.y || gl_FragCoord.y >= v_clip.w)) discard;
@@ -51,9 +41,6 @@ void main() {
: clamp(u_ui.background_opacity, 0.0, 1.0);
uint effect = v_effect.x & 0x07ffffffu;
float progress = clamp(uintBitsToFloat(v_effect.y), 0.0, 1.0);
- uint cellCol = v_effect.w & 0xffffu;
- uint cellRow = v_effect.w >> 16;
- float noise = cellNoise(v_effect.z, cellCol, cellRow);
// Ink over ground, both premultiplied: v_fg*a + (v_bg*bgA)*(1-a), which is
// mix() with the ground already premultiplied. At bgA = 1 that is exactly
@@ -63,7 +50,10 @@ void main() {
// dot every period pixels, fixed to the window, under the text.
if ((v_effect.x & 0x10000000u) != 0u) {
float period = u_ui.decor_dot_geom.x;
- vec2 d = mod(gl_FragCoord.xy, period) - 0.5 * period;
+ // v_effect.z: how far its pane's text has moved the dots (G13's
+ // parallax), in pixels, as a float's bits (0 without).
+ vec2 at = gl_FragCoord.xy - vec2(0.0, uintBitsToFloat(v_effect.z));
+ vec2 d = mod(at, period) - 0.5 * period;
float dot_a = 1.0 - smoothstep(u_ui.decor_dot_geom.y, u_ui.decor_dot_geom.z, length(d));
ground = mix(ground, u_ui.decor_dots.rgb, u_ui.decor_dots.a * dot_a);
}