chore: shaders upgrade

This commit is contained in:
2025-11-07 18:06:51 +01:00
parent 1ed3f4baf5
commit 261ff88583
9 changed files with 97 additions and 92 deletions
+2 -2
View File
@@ -245,13 +245,13 @@ MIDI_2_6_Y=23
MIDI_2_6_Z= MIDI_2_6_Z=
MIDI_2_7_X=4 MIDI_2_7_X=4
MIDI_2_7_Y=20 MIDI_2_7_Y=20
MIDI_2_7_Z= MIDI_2_7_Z=59
# Same for group 3 # Same for group 3
MIDI_3_COUNT=2 MIDI_3_COUNT=2
MIDI_3_1_X=48 MIDI_3_1_X=48
MIDI_3_1_Y=58 MIDI_3_1_Y=58
MIDI_3_1_Z=59 MIDI_3_1_Z=
MIDI_3_2_X=0 MIDI_3_2_X=0
MIDI_3_2_Y=16 MIDI_3_2_Y=16
MIDI_3_2_Z= MIDI_3_2_Z=
+78 -75
View File
@@ -13,6 +13,8 @@ uniform vec2 iResolution;
uniform vec2 iTexResolution; uniform vec2 iTexResolution;
uniform vec2 iInputResolution1; uniform vec2 iInputResolution1;
uniform vec2 iInputResolution2; uniform vec2 iInputResolution2;
uniform int iInputFormat1;
uniform int iInputFormat2;
uniform int iDemo; uniform int iDemo;
uniform int iPage; uniform int iPage;
uniform int iSelected; uniform int iSelected;
@@ -57,7 +59,8 @@ uniform sampler2D iTex9;
// 3. definitions // 3. definitions
// -------------- // --------------
#define PI 3.1415927 const float PI = 3.1415927;
const int YUYV_FOURCC = 1448695129;
// 4. functions // 4. functions
// ------------ // ------------
@@ -1145,6 +1148,8 @@ subroutine(src_stage_sub) vec4 src_8(vec2 vUV, int seed, vec3 b1, vec2 f1, vec3
// TODO SRC 9 // TODO SRC 9
subroutine(src_stage_sub) vec4 src_9(vec2 vUV, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3) subroutine(src_stage_sub) vec4 src_9(vec2 vUV, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3)
{ {
return src_2(vUV, seed, b1, f1, b2, f2, b3, f3);
// start // start
vec2 uv0 = vUV.st; vec2 uv0 = vUV.st;
@@ -1161,6 +1166,7 @@ subroutine(src_stage_sub) vec4 src_9(vec2 vUV, int seed, vec3 b1, vec2 f1, vec3
// TODO SRC 10 // TODO SRC 10
subroutine(src_stage_sub) vec4 src_10(vec2 vUV, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3) subroutine(src_stage_sub) vec4 src_10(vec2 vUV, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3)
{ {
return src_3(vUV, seed, b1, f1, b2, f2, b3, f3);
// start // start
vec2 uv0 = vUV.st; vec2 uv0 = vUV.st;
@@ -1183,6 +1189,7 @@ subroutine(src_stage_sub) vec4 src_11(vec2 vUV, int seed, vec3 b1, vec2 f1, vec3
// TODO SRC 12 // TODO SRC 12
subroutine(src_stage_sub) vec4 src_12(vec2 vUV, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3) subroutine(src_stage_sub) vec4 src_12(vec2 vUV, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3)
{ {
return src_4(vUV, seed, b1, f1, b2, f2, b3, f3);
// start // start
vec2 uv0 = vUV.st; vec2 uv0 = vUV.st;
@@ -1199,6 +1206,7 @@ subroutine(src_stage_sub) vec4 src_12(vec2 vUV, int seed, vec3 b1, vec2 f1, vec3
// TODO SRC 13 // TODO SRC 13
subroutine(src_stage_sub) vec4 src_13(vec2 vUV, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3) subroutine(src_stage_sub) vec4 src_13(vec2 vUV, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3)
{ {
return src_5(vUV, seed, b1, f1, b2, f2, b3, f3);
// start // start
vec2 uv0 = vUV.st; vec2 uv0 = vUV.st;
@@ -1215,6 +1223,7 @@ subroutine(src_stage_sub) vec4 src_13(vec2 vUV, int seed, vec3 b1, vec2 f1, vec3
// TODO SRC 14 // TODO SRC 14
subroutine(src_stage_sub) vec4 src_14(vec2 vUV, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3) subroutine(src_stage_sub) vec4 src_14(vec2 vUV, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3)
{ {
return src_7(vUV, seed, b1, f1, b2, f2, b3, f3);
// start // start
vec2 uv0 = vUV.st; vec2 uv0 = vUV.st;
@@ -1239,14 +1248,17 @@ subroutine(src_stage_sub) vec4 src_15(vec2 vUV, int seed, vec3 b1, vec2 f1, vec3
// inputs // inputs
int selected_srca = iState3; int selected_srca = iState3 - 1;
int selected_srcb = iState4; int selected_srcb = iState4 - 1;
int selected_fxa = iState5; int selected_fxa = iState5 - 1;
int selected_fxb = iState6; int selected_fxb = iState6 - 1;
int selected_mfx = iState8; int selected_mfx = iState8 - 1;
float fxa_value = magic(iMidi2_1[6].xy, vec3(1, 0, 0), iSeed5); float fxa_value = magic(iMidi2_1[6].xy, vec3(1, 0, 0), iSeed5);
bool fxa_invert = magic_trigger(vec3(iMidi2_1[6].z, 0, 0), iSeed5);
float fxb_value = magic(iMidi2_2[6].xy, vec3(1, 0, 0), iSeed6); float fxb_value = magic(iMidi2_2[6].xy, vec3(1, 0, 0), iSeed6);
bool fxb_invert = magic_trigger(vec3(iMidi2_2[6].z, 0, 0), iSeed6);
float mfx_value = magic(iMidi2_3[6].xy, vec3(1, 0, 0), iSeed8); float mfx_value = magic(iMidi2_3[6].xy, vec3(1, 0, 0), iSeed8);
bool mfx_invert = magic_trigger(vec3(iMidi2_3[6].z, 0, 0), iSeed8);
float mix_value = magic(iMidi3_1[1].xy, vec3(1, 0, 0), iSeed7); float mix_value = magic(iMidi3_1[1].xy, vec3(1, 0, 0), iSeed7);
bool mix_type = magic_trigger(vec3(iMidi3_1[0].x, 0, 0), iSeed7 + 10); bool mix_type = magic_trigger(vec3(iMidi3_1[0].x, 0, 0), iSeed7 + 10);
@@ -1290,8 +1302,11 @@ subroutine(src_stage_sub) vec4 src_15(vec2 vUV, int seed, vec3 b1, vec2 f1, vec3
f += char_at(uv2, vec2(-5.4, 1.45), hex_chars[selected_srca]); f += char_at(uv2, vec2(-5.4, 1.45), hex_chars[selected_srca]);
f += char_at(uv2, vec2(-5.4, -2.55), hex_chars[selected_srcb]); f += char_at(uv2, vec2(-5.4, -2.55), hex_chars[selected_srcb]);
f += char_at(uv2, vec2(-2.4, 1.45), hex_chars[selected_fxa]); f += char_at(uv2, vec2(-2.4, 1.45), hex_chars[selected_fxa]);
f += fxa_invert ? rect(uv2, vec2(-2, 2.7), vec2(0.5, 0.05)) : 0;
f += char_at(uv2, vec2(-2.4, -2.55), hex_chars[selected_fxb]); f += char_at(uv2, vec2(-2.4, -2.55), hex_chars[selected_fxb]);
f += fxb_invert ? rect(uv2, vec2(-2, -1.3), vec2(0.5, 0.05)) : 0;
f += char_at(uv2, vec2(4.6, -0.55), hex_chars[selected_mfx]); f += char_at(uv2, vec2(4.6, -0.55), hex_chars[selected_mfx]);
f += mfx_invert ? rect(uv2, vec2(5, 0.7), vec2(0.5, 0.05)) : 0;
// show current selected // show current selected
f += iSelected == 3 ? h_rect(uv2, vec2(-5, 2), vec2(1.2), 0.1) : 0; f += iSelected == 3 ? h_rect(uv2, vec2(-5, 2), vec2(1.2), 0.1) : 0;
@@ -1311,21 +1326,21 @@ subroutine(src_stage_sub) vec4 src_15(vec2 vUV, int seed, vec3 b1, vec2 f1, vec3
float line_a_a = rect(uv2, vec2(-8, 2), vec2(2, 0.1)); float line_a_a = rect(uv2, vec2(-8, 2), vec2(2, 0.1));
float line_a_b = rect(uv2, vec2(-7, 2), vec2(1, 0.1)) + rect(uv2, vec2(-8, 0.5), vec2(0.1, 1.6)) + rect(uv2, vec2(-9, -1), vec2(1, 0.1)); float line_a_b = rect(uv2, vec2(-7, 2), vec2(1, 0.1)) + rect(uv2, vec2(-8, 0.5), vec2(0.1, 1.6)) + rect(uv2, vec2(-9, -1), vec2(1, 0.1));
float line_a_f = rect(uv2, vec2(-6.5, 2), vec2(0.5, 0.1)) + rect(uv2, vec2(0, 4), vec2(7, 0.1)) + rect(uv2, vec2(-7, 3), vec2(0.1, 1.1)) + rect(uv2, vec2(7, 2), vec2(0.1, 2.1)); float line_a_f = rect(uv2, vec2(-6.5, 2), vec2(0.5, 0.1)) + rect(uv2, vec2(0, 4), vec2(7, 0.1)) + rect(uv2, vec2(-7, 3), vec2(0.1, 1.1)) + rect(uv2, vec2(7, 2), vec2(0.1, 2.1));
if (selected_srca == 5) { if (selected_srca == 5 && iInputFormat1 == YUYV_FOURCC) {
f += iInputResolution1.x > 0 ? line_a_a : line_a_f; f += iInputResolution1.x > 0 ? line_a_a : line_a_f;
} else if (selected_srca == 10) { } else if (selected_srca == 10 && iInputFormat2 == YUYV_FOURCC) {
f += iInputResolution2.x > 0 ? line_a_b : line_a_f; f += iInputResolution2.x > 0 ? line_a_b : line_a_f;
} else if (selected_srca == 0 || selected_srca >= 8) { } else if (selected_srca % 5 == 0) {
f += line_a_f; f += line_a_f;
} }
float line_b_a = rect(uv2, vec2(-6.5, -2), vec2(0.5, 0.1)) + rect(uv2, vec2(-7, -0.5), vec2(0.1, 1.6)) + rect(uv2, vec2(-8.5, 1), vec2(1.5, 0.1)); float line_b_a = rect(uv2, vec2(-6.5, -2), vec2(0.5, 0.1)) + rect(uv2, vec2(-7, -0.5), vec2(0.1, 1.6)) + rect(uv2, vec2(-8.5, 1), vec2(1.5, 0.1));
float line_b_b = rect(uv2, vec2(-8, -2), vec2(2, 0.1)); float line_b_b = rect(uv2, vec2(-8, -2), vec2(2, 0.1));
float line_b_f = rect(uv2, vec2(-6.5, -2), vec2(0.5, 0.1)) + rect(uv2, vec2(0, -4), vec2(7, 0.1)) + rect(uv2, vec2(-7, -3), vec2(0.1, 1.1)) + rect(uv2, vec2(7, -2), vec2(0.1, 2.1)); float line_b_f = rect(uv2, vec2(-6.5, -2), vec2(0.5, 0.1)) + rect(uv2, vec2(0, -4), vec2(7, 0.1)) + rect(uv2, vec2(-7, -3), vec2(0.1, 1.1)) + rect(uv2, vec2(7, -2), vec2(0.1, 2.1));
if (selected_srcb == 5) { if (selected_srcb == 5 && iInputFormat1 == YUYV_FOURCC) {
f += iInputResolution1.x > 0 ? line_b_a : line_b_f; f += iInputResolution1.x > 0 ? line_b_a : line_b_f;
} else if (selected_srcb == 10) { } else if (selected_srcb == 10 && iInputFormat2 == YUYV_FOURCC) {
f += iInputResolution2.x > 0 ? line_b_b : line_b_f; f += iInputResolution2.x > 0 ? line_b_b : line_b_f;
} else if (selected_srcb == 0 || selected_srcb >= 8) { } else if (selected_srcb % 5 == 0) {
f += line_b_f; f += line_b_f;
} }
@@ -1333,6 +1348,8 @@ subroutine(src_stage_sub) vec4 src_15(vec2 vUV, int seed, vec3 b1, vec2 f1, vec3
f += char_at(uv2, vec2(-9.2, -4.3), hex_chars[iPage]); f += char_at(uv2, vec2(-9.2, -4.3), hex_chars[iPage]);
// show fx values // show fx values
float fx_rect = 0;
f = mix(f, 1 - f, rect(uv2, vec2(-2, 1.1 + 0.9 * fxa_value), vec2(0.9, 0.9 * fxa_value))); f = mix(f, 1 - f, rect(uv2, vec2(-2, 1.1 + 0.9 * fxa_value), vec2(0.9, 0.9 * fxa_value)));
f = mix(f, 1 - f, rect(uv2, vec2(-2, -2.9 + 0.9 * fxb_value), vec2(0.9, 0.9 * fxb_value))); f = mix(f, 1 - f, rect(uv2, vec2(-2, -2.9 + 0.9 * fxb_value), vec2(0.9, 0.9 * fxb_value)));
f = mix(f, 1 - f, rect(uv2, vec2(5, -0.9 + 0.9 * mfx_value), vec2(0.9, 0.9 * mfx_value))); f = mix(f, 1 - f, rect(uv2, vec2(5, -0.9 + 0.9 * mfx_value), vec2(0.9, 0.9 * mfx_value)));
@@ -1374,12 +1391,23 @@ subroutine(src_stage_sub) vec4 src_15(vec2 vUV, int seed, vec3 b1, vec2 f1, vec3
// 6. effects // 6. effects
// ---------- // ----------
subroutine vec4 fx_stage_sub(vec2 vUV, sampler2D previous, sampler2D feedback, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3, vec2 f0); vec4 fx_master(vec3 c0, vec3 c, int seed, vec3 m0) {
float fx = magic(m0.xy, vec3(1,0,0), seed);
bool invert = magic_trigger(vec3(m0.z, 0, 0), seed);
vec3 c_out = mix(c0, c, fx);
c_out = mix(c_out, 1 - c_out, invert ? 1 : 0);
return vec4(c_out, 1.0);
}
subroutine vec4 fx_stage_sub(vec2 vUV, sampler2D previous, sampler2D feedback, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3, vec3 m0);
subroutine uniform fx_stage_sub fx_stage; subroutine uniform fx_stage_sub fx_stage;
// FX 1 : thru // FX 1 : thru
subroutine(fx_stage_sub) vec4 fx_1(vec2 vUV, sampler2D previous, sampler2D feedback, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3, vec2 f0) subroutine(fx_stage_sub) vec4 fx_1(vec2 vUV, sampler2D previous, sampler2D feedback, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3, vec3 m0)
{ {
// start // start
@@ -1387,8 +1415,6 @@ subroutine(fx_stage_sub) vec4 fx_1(vec2 vUV, sampler2D previous, sampler2D feedb
// controls // controls
float fx = magic(f0, vec3(1,0,0), seed);
float hue = magic(f1, b1, seed + 10); float hue = magic(f1, b1, seed + 10);
float saturation = magic(f2, b2, seed + 20); float saturation = magic(f2, b2, seed + 20);
float light = magic(f3, b3, seed + 30); float light = magic(f3, b3, seed + 30);
@@ -1401,11 +1427,11 @@ subroutine(fx_stage_sub) vec4 fx_1(vec2 vUV, sampler2D previous, sampler2D feedb
c *= 1 + saturation; c *= 1 + saturation;
c = mix(c + light * 2.0, c - (1 - light) * 2.0, step(0.5, light)); c = mix(c + light * 2.0, c - (1 - light) * 2.0, step(0.5, light));
return vec4(mix(c0, c, fx), 1.0); return fx_master(c0, c, seed, m0);
} }
// FX 2 : feedback + shift // FX 2 : feedback + shift
vec4 fx_shift(vec2 vUV, sampler2D src0, sampler2D src1, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3, vec2 f0) vec4 fx_shift(vec2 vUV, sampler2D src0, sampler2D src1, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3, vec3 m0)
{ {
// start // start
@@ -1415,8 +1441,6 @@ vec4 fx_shift(vec2 vUV, sampler2D src0, sampler2D src1, int seed, vec3 b1, vec2
// controls // controls
float fx = magic(f0, vec3(1,0,0), seed);
float zoom = magic(f1, b1, seed + 10); float zoom = magic(f1, b1, seed + 10);
float x_shift = magic(f2, b2, seed + 20); float x_shift = magic(f2, b2, seed + 20);
float y_shift = magic(f3, b3, seed + 30); float y_shift = magic(f3, b3, seed + 30);
@@ -1430,22 +1454,22 @@ vec4 fx_shift(vec2 vUV, sampler2D src0, sampler2D src1, int seed, vec3 b1, vec2
uv2 += vec2(x_shift * ratio, y_shift) * 2; uv2 += vec2(x_shift * ratio, y_shift) * 2;
vec3 c = reframe(src1, uv2).xyz; vec3 c = reframe(src1, uv2).xyz;
return vec4(mix(c0, c, fx), 1.0); return fx_master(c0, c, seed, m0);
} }
subroutine(fx_stage_sub) vec4 fx_2(vec2 vUV, sampler2D previous, sampler2D feedback, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3, vec2 f0) subroutine(fx_stage_sub) vec4 fx_2(vec2 vUV, sampler2D previous, sampler2D feedback, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3, vec3 m0)
{ {
return fx_shift(vUV, previous, feedback, seed, b1, f1, b2, f2, b3, f3, f0); return fx_shift(vUV, previous, feedback, seed, b1, f1, b2, f2, b3, f3, m0);
} }
// FX 3 : shift // FX 3 : shift
subroutine(fx_stage_sub) vec4 fx_3(vec2 vUV, sampler2D previous, sampler2D feedback, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3, vec2 f0) subroutine(fx_stage_sub) vec4 fx_3(vec2 vUV, sampler2D previous, sampler2D feedback, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3, vec3 m0)
{ {
return fx_shift(vUV, previous, previous, seed, b1, f1, b2, f2, b3, f3, f0); return fx_shift(vUV, previous, previous, seed, b1, f1, b2, f2, b3, f3, m0);
} }
// FX 4 : colorize // FX 4 : colorize
subroutine(fx_stage_sub) vec4 fx_4(vec2 vUV, sampler2D previous, sampler2D feedback, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3, vec2 f0) subroutine(fx_stage_sub) vec4 fx_4(vec2 vUV, sampler2D previous, sampler2D feedback, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3, vec3 m0)
{ {
// start // start
@@ -1453,8 +1477,6 @@ subroutine(fx_stage_sub) vec4 fx_4(vec2 vUV, sampler2D previous, sampler2D feedb
// controls // controls
float fx = magic(f0, vec3(1,0,0), seed);
float c_black = magic(f1, b1, seed + 10); float c_black = magic(f1, b1, seed + 10);
bool c_black_trigger = magic_trigger(b1, seed + 10); bool c_black_trigger = magic_trigger(b1, seed + 10);
float c_white = magic(f2, b2, seed + 20); float c_white = magic(f2, b2, seed + 20);
@@ -1469,11 +1491,11 @@ subroutine(fx_stage_sub) vec4 fx_4(vec2 vUV, sampler2D previous, sampler2D feedb
float c_mix = mix(c_black, c_white, f) + delta; float c_mix = mix(c_black, c_white, f) + delta;
vec3 c = mix(c_black_trigger ? col(c_mix) : vec3(0), c_white_trigger ? col(c_mix) : vec3(1), f); vec3 c = mix(c_black_trigger ? col(c_mix) : vec3(0), c_white_trigger ? col(c_mix) : vec3(1), f);
return vec4(mix(c0, c, fx), 1.0); return fx_master(c0, c, seed, m0);
} }
// FX 5 : quantize // FX 5 : quantize
subroutine(fx_stage_sub) vec4 fx_5(vec2 vUV, sampler2D previous, sampler2D feedback, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3, vec2 f0) subroutine(fx_stage_sub) vec4 fx_5(vec2 vUV, sampler2D previous, sampler2D feedback, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3, vec3 m0)
{ {
// start // start
@@ -1483,8 +1505,6 @@ subroutine(fx_stage_sub) vec4 fx_5(vec2 vUV, sampler2D previous, sampler2D feedb
// controls // controls
float fx = magic(f0, vec3(1,0,0), seed);
float pixel_size = magic(f1, b1, seed + 10); float pixel_size = magic(f1, b1, seed + 10);
float quantize = magic(f2, b2, seed + 20); float quantize = magic(f2, b2, seed + 20);
bool quantize_trigger = magic_trigger(b2, seed + 20); bool quantize_trigger = magic_trigger(b2, seed + 20);
@@ -1504,11 +1524,11 @@ subroutine(fx_stage_sub) vec4 fx_5(vec2 vUV, sampler2D previous, sampler2D feedb
} }
// c = mix(c, 1 - c, step(noise_f(uv0 * 10 + vec2(iTime * 0.1, 0), 5), 0.5)); // c = mix(c, 1 - c, step(noise_f(uv0 * 10 + vec2(iTime * 0.1, 0), 5), 0.5));
return vec4(mix(c0, c, fx), 1.0); return fx_master(c0, c, seed, m0);
} }
// FX 6 : dithering // FX 6 : dithering
subroutine(fx_stage_sub) vec4 fx_6(vec2 vUV, sampler2D previous, sampler2D feedback, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3, vec2 f0) subroutine(fx_stage_sub) vec4 fx_6(vec2 vUV, sampler2D previous, sampler2D feedback, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3, vec3 m0)
{ {
// start // start
@@ -1518,8 +1538,6 @@ subroutine(fx_stage_sub) vec4 fx_6(vec2 vUV, sampler2D previous, sampler2D feedb
// controls // controls
float fx = magic(f0, vec3(1,0,0), seed);
float pixel_size = magic(f1, b1, seed + 10); float pixel_size = magic(f1, b1, seed + 10);
bool pixel_size_trigger = magic_trigger(b1, seed + 10); bool pixel_size_trigger = magic_trigger(b1, seed + 10);
float quantize = magic(f2, b2, seed + 20); float quantize = magic(f2, b2, seed + 20);
@@ -1548,11 +1566,11 @@ subroutine(fx_stage_sub) vec4 fx_6(vec2 vUV, sampler2D previous, sampler2D feedb
c /= k3; c /= k3;
} }
return vec4(mix(c0, c, fx), 1.0); return fx_master(c0, c, seed, m0);
} }
// FX 7 : tv // FX 7 : tv
subroutine(fx_stage_sub) vec4 fx_7(vec2 vUV, sampler2D previous, sampler2D feedback, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3, vec2 f0) subroutine(fx_stage_sub) vec4 fx_7(vec2 vUV, sampler2D previous, sampler2D feedback, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3, vec3 m0)
{ {
// start // start
@@ -1562,8 +1580,6 @@ subroutine(fx_stage_sub) vec4 fx_7(vec2 vUV, sampler2D previous, sampler2D feedb
// controls // controls
float fx = magic(f0, vec3(1,0,0), seed);
float lens_v = magic(f1, b1, seed + 10); float lens_v = magic(f1, b1, seed + 10);
float horizontal_noise = magic(f2, b2, seed + 20); float horizontal_noise = magic(f2, b2, seed + 20);
float zoom = magic(f3, b3, seed + 30); float zoom = magic(f3, b3, seed + 30);
@@ -1583,11 +1599,11 @@ subroutine(fx_stage_sub) vec4 fx_7(vec2 vUV, sampler2D previous, sampler2D feedb
reframe_b(previous, uv2).z reframe_b(previous, uv2).z
); );
return vec4(mix(c0, c, fx), 1.0); return fx_master(c0, c, seed, m0);
} }
// FX 8 : kaleidoscope // FX 8 : kaleidoscope
subroutine(fx_stage_sub) vec4 fx_8(vec2 vUV, sampler2D previous, sampler2D feedback, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3, vec2 f0) subroutine(fx_stage_sub) vec4 fx_8(vec2 vUV, sampler2D previous, sampler2D feedback, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3, vec3 m0)
{ {
// start // start
@@ -1597,8 +1613,6 @@ subroutine(fx_stage_sub) vec4 fx_8(vec2 vUV, sampler2D previous, sampler2D feedb
// controls // controls
float fx = magic(f0, vec3(1,0,0), seed);
float axes = magic(f1, b1, seed + 10); float axes = magic(f1, b1, seed + 10);
float axes_trigger = magic_b(b1, seed + 10).x; float axes_trigger = magic_b(b1, seed + 10).x;
float rotation = magic(f2, b2, seed + 20); float rotation = magic(f2, b2, seed + 20);
@@ -1614,11 +1628,11 @@ subroutine(fx_stage_sub) vec4 fx_8(vec2 vUV, sampler2D previous, sampler2D feedb
uv2.x = (saw(uv2.x / ratio + 0.5 + h_scroll * 2) - 0.5) * ratio; uv2.x = (saw(uv2.x / ratio + 0.5 + h_scroll * 2) - 0.5) * ratio;
vec3 c = reframe(previous, uv2).xyz; vec3 c = reframe(previous, uv2).xyz;
return vec4(mix(c0, c, fx), 1.0); return fx_master(c0, c, seed, m0);
} }
// FX 9 : cp437 // FX 9 : cp437
subroutine(fx_stage_sub) vec4 fx_9(vec2 vUV, sampler2D previous, sampler2D feedback, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3, vec2 f0) subroutine(fx_stage_sub) vec4 fx_9(vec2 vUV, sampler2D previous, sampler2D feedback, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3, vec3 m0)
{ {
// start // start
@@ -1628,8 +1642,6 @@ subroutine(fx_stage_sub) vec4 fx_9(vec2 vUV, sampler2D previous, sampler2D feedb
// controls // controls
float fx = magic(f0, vec3(1,0,0), seed);
float zoom = magic(f1, b1, seed + 10); float zoom = magic(f1, b1, seed + 10);
vec2 charset = magic_f(f2, b2, seed + 20); vec2 charset = magic_f(f2, b2, seed + 20);
vec3 charset_ctrl = magic_b(b2, seed + 20); vec3 charset_ctrl = magic_b(b2, seed + 20);
@@ -1656,11 +1668,11 @@ subroutine(fx_stage_sub) vec4 fx_9(vec2 vUV, sampler2D previous, sampler2D feedb
+ reframe(previous, uv2 + vec2(0.5, 0.5) * inv_k * 0.125).xyz * 0.2; + reframe(previous, uv2 + vec2(0.5, 0.5) * inv_k * 0.125).xyz * 0.2;
c = char(mod(uv1 * k1, 1), code) ? c : vec3(0); c = char(mod(uv1 * k1, 1), code) ? c : vec3(0);
return vec4(mix(c0, c, fx), 1.0); return fx_master(c0, c, seed, m0);
} }
// FX 10 : lens // FX 10 : lens
subroutine(fx_stage_sub) vec4 fx_10(vec2 vUV, sampler2D previous, sampler2D feedback, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3, vec2 f0) subroutine(fx_stage_sub) vec4 fx_10(vec2 vUV, sampler2D previous, sampler2D feedback, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3, vec3 m0)
{ {
// start // start
@@ -1670,8 +1682,6 @@ subroutine(fx_stage_sub) vec4 fx_10(vec2 vUV, sampler2D previous, sampler2D feed
// controls // controls
float fx = magic(f0, vec3(1,0,0), seed);
float lens_v1 = magic(f1, b1, seed + 10); float lens_v1 = magic(f1, b1, seed + 10);
float lens_v2 = magic(f2, b2, seed + 20); float lens_v2 = magic(f2, b2, seed + 20);
float zoom = magic(f3, b3, seed + 30); float zoom = magic(f3, b3, seed + 30);
@@ -1686,12 +1696,13 @@ subroutine(fx_stage_sub) vec4 fx_10(vec2 vUV, sampler2D previous, sampler2D feed
uv2 = lens(uv2, -lens_v2 * 10, lens_v1 * 10); uv2 = lens(uv2, -lens_v2 * 10, lens_v1 * 10);
vec3 c = reframe(previous, uv2).xyz; vec3 c = reframe(previous, uv2).xyz;
return vec4(mix(c0, c, fx), 1.0); return fx_master(c0, c, seed, m0);
} }
// TODO FX 11 // TODO FX 11
subroutine(fx_stage_sub) vec4 fx_11(vec2 vUV, sampler2D previous, sampler2D feedback, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3, vec2 f0) subroutine(fx_stage_sub) vec4 fx_11(vec2 vUV, sampler2D previous, sampler2D feedback, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3, vec3 m0)
{ {
return fx_1(vUV, previous, feedback, seed, b1, f1, b2, f2, b3, f3, m0);
// start // start
vec2 uv0 = vUV.st; vec2 uv0 = vUV.st;
@@ -1700,19 +1711,18 @@ subroutine(fx_stage_sub) vec4 fx_11(vec2 vUV, sampler2D previous, sampler2D feed
// controls // controls
float fx = magic(f0, vec3(1,0,0), seed);
// logic // logic
vec3 c0 = texture(previous, uv0).xyz; vec3 c0 = texture(previous, uv0).xyz;
vec3 c = c0; vec3 c = c0;
return vec4(mix(c0, c, fx), 1.0); return fx_master(c0, c, seed, m0);
} }
// TODO FX 12 // TODO FX 12
subroutine(fx_stage_sub) vec4 fx_12(vec2 vUV, sampler2D previous, sampler2D feedback, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3, vec2 f0) subroutine(fx_stage_sub) vec4 fx_12(vec2 vUV, sampler2D previous, sampler2D feedback, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3, vec3 m0)
{ {
return fx_2(vUV, previous, feedback, seed, b1, f1, b2, f2, b3, f3, m0);
// start // start
vec2 uv0 = vUV.st; vec2 uv0 = vUV.st;
@@ -1721,19 +1731,18 @@ subroutine(fx_stage_sub) vec4 fx_12(vec2 vUV, sampler2D previous, sampler2D feed
// controls // controls
float fx = magic(f0, vec3(1,0,0), seed);
// logic // logic
vec3 c0 = texture(previous, uv0).xyz; vec3 c0 = texture(previous, uv0).xyz;
vec3 c = c0; vec3 c = c0;
return vec4(mix(c0, c, fx), 1.0); return fx_master(c0, c, seed, m0);
} }
// TODO FX 13 // TODO FX 13
subroutine(fx_stage_sub) vec4 fx_13(vec2 vUV, sampler2D previous, sampler2D feedback, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3, vec2 f0) subroutine(fx_stage_sub) vec4 fx_13(vec2 vUV, sampler2D previous, sampler2D feedback, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3, vec3 m0)
{ {
return fx_3(vUV, previous, feedback, seed, b1, f1, b2, f2, b3, f3, m0);
// start // start
vec2 uv0 = vUV.st; vec2 uv0 = vUV.st;
@@ -1742,19 +1751,18 @@ subroutine(fx_stage_sub) vec4 fx_13(vec2 vUV, sampler2D previous, sampler2D feed
// controls // controls
float fx = magic(f0, vec3(1,0,0), seed);
// logic // logic
vec3 c0 = texture(previous, uv0).xyz; vec3 c0 = texture(previous, uv0).xyz;
vec3 c = c0; vec3 c = c0;
return vec4(mix(c0, c, fx), 1.0); return fx_master(c0, c, seed, m0);
} }
// TODO FX 14 // TODO FX 14
subroutine(fx_stage_sub) vec4 fx_14(vec2 vUV, sampler2D previous, sampler2D feedback, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3, vec2 f0) subroutine(fx_stage_sub) vec4 fx_14(vec2 vUV, sampler2D previous, sampler2D feedback, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3, vec3 m0)
{ {
return fx_4(vUV, previous, feedback, seed, b1, f1, b2, f2, b3, f3, m0);
// start // start
vec2 uv0 = vUV.st; vec2 uv0 = vUV.st;
@@ -1763,19 +1771,18 @@ subroutine(fx_stage_sub) vec4 fx_14(vec2 vUV, sampler2D previous, sampler2D feed
// controls // controls
float fx = magic(f0, vec3(1,0,0), seed);
// logic // logic
vec3 c0 = texture(previous, uv0).xyz; vec3 c0 = texture(previous, uv0).xyz;
vec3 c = c0; vec3 c = c0;
return vec4(mix(c0, c, fx), 1.0); return fx_master(c0, c, seed, m0);
} }
// TODO FX 15 // TODO FX 15
subroutine(fx_stage_sub) vec4 fx_15(vec2 vUV, sampler2D previous, sampler2D feedback, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3, vec2 f0) subroutine(fx_stage_sub) vec4 fx_15(vec2 vUV, sampler2D previous, sampler2D feedback, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3, vec3 m0)
{ {
return fx_5(vUV, previous, feedback, seed, b1, f1, b2, f2, b3, f3, m0);
// start // start
vec2 uv0 = vUV.st; vec2 uv0 = vUV.st;
@@ -1784,20 +1791,16 @@ subroutine(fx_stage_sub) vec4 fx_15(vec2 vUV, sampler2D previous, sampler2D feed
// controls // controls
float fx = magic(f0, vec3(1,0,0), seed);
// logic // logic
vec3 c0 = texture(previous, uv0).xyz; vec3 c0 = texture(previous, uv0).xyz;
vec3 c = c0; vec3 c = c0;
return vec4(mix(c0, c, fx), 1.0); return fx_master(c0, c, seed, m0);
} }
const mat3x3 yuv_to_rgb = {{1,1,1},{0,-0.39465,2.03211},{1.13983,-0.5806,0}}; const mat3x3 yuv_to_rgb = {{1,1,1},{0,-0.39465,2.03211},{1.13983,-0.5806,0}};
const int YUYV_FOURCC = 1448695129;
vec4 yuyvTex(sampler2D tex, vec2 vUV, int base_width) { vec4 yuyvTex(sampler2D tex, vec2 vUV, int base_width) {
float w = base_width - 1; float w = base_width - 1;
-2
View File
@@ -6,8 +6,6 @@
in vec2 vUV; in vec2 vUV;
out vec4 fragColor; out vec4 fragColor;
uniform int iInputFormat1;
void main() { void main() {
if (iInputFormat1 == YUYV_FOURCC) { if (iInputFormat1 == YUYV_FOURCC) {
fragColor = yuyvTex(iTex1, vUV, int(iInputResolution1.x)); fragColor = yuyvTex(iTex1, vUV, int(iInputResolution1.x));
+13 -5
View File
@@ -12,7 +12,7 @@ float s(vec2 uv, float x0, float y0) {
step(-y0 - 1, -uv.y); step(-y0 - 1, -uv.y);
} }
const int texts[9][5] = { const int texts[10][5] = {
{0x49, 0x4E, 0x20, 0x41, 0x00}, // IN A {0x49, 0x4E, 0x20, 0x41, 0x00}, // IN A
{0x49, 0x4E, 0x20, 0x42, 0x00}, // IN B {0x49, 0x4E, 0x20, 0x42, 0x00}, // IN B
{0x53, 0x52, 0x43, 0x20, 0x41}, // SRC A {0x53, 0x52, 0x43, 0x20, 0x41}, // SRC A
@@ -22,6 +22,7 @@ const int texts[9][5] = {
{0x41, 0x2B, 0x42, 0x00, 0x00}, // A+B {0x41, 0x2B, 0x42, 0x00, 0x00}, // A+B
{0x4D, 0x46, 0x58, 0x00, 0x00}, // MFX {0x4D, 0x46, 0x58, 0x00, 0x00}, // MFX
{0x46, 0x50, 0x53, 0x00, 0x00}, // FPS {0x46, 0x50, 0x53, 0x00, 0x00}, // FPS
{0x4F, 0x46, 0x46, 0x00, 0x00}, // OFF
}; };
void main() { void main() {
@@ -47,23 +48,30 @@ void main() {
float f = 0; float f = 0;
float t = 0; float t = 0;
f += rect(uv3, vec2(-51, 28.5), vec2(2.1, 0.7));
t += write_5(uv3, vec2(-53,28), texts[0]);
if (iInputResolution1.x > 0) { if (iInputResolution1.x > 0) {
c += s(uv2,0,2) * texture(iTex3, uv2); c += s(uv2,0,2) * texture(iTex3, uv2);
f += rect(uv3, vec2(-51, 28.5), vec2(2.1, 0.7));
t += write_5(uv3, vec2(-53,28), texts[0]);
f += rect(uv3, vec2(-50.4, 26.5), vec2(2.8, 0.7)); f += rect(uv3, vec2(-50.4, 26.5), vec2(2.8, 0.7));
t += write_int(uv3, vec2(-53,26), iInputFPS1, 2); t += write_int(uv3, vec2(-53,26), iInputFPS1, 2);
t += write_5(uv3, vec2(-50.5,26), texts[8]); t += write_5(uv3, vec2(-50.5,26), texts[8]);
} else {
f += rect(uv3, vec2(-51.5, 26.5), vec2(1.6, 0.7));
t += write_5(uv3, vec2(-53,26), texts[9]);
} }
f += rect(uv3, vec2(-51, 8.5), vec2(2.1, 0.7));
t += write_5(uv3, vec2(-53,8), texts[1]);
if (iInputResolution2.x > 0) { if (iInputResolution2.x > 0) {
c += s(uv2,0,1) * texture(iTex4, uv2); c += s(uv2,0,1) * texture(iTex4, uv2);
f += rect(uv3, vec2(-51, 8.5), vec2(2.1, 0.7));
t += write_5(uv3, vec2(-53,8), texts[1]);
f += rect(uv3, vec2(-50.4, 6.5), vec2(2.8, 0.7)); f += rect(uv3, vec2(-50.4, 6.5), vec2(2.8, 0.7));
t += write_int(uv3, vec2(-53,6), iInputFPS2, 2); t += write_int(uv3, vec2(-53,6), iInputFPS2, 2);
t += write_5(uv3, vec2(-50.5,6), texts[8]); t += write_5(uv3, vec2(-50.5,6), texts[8]);
} else {
f += rect(uv3, vec2(-51.5, 6.5), vec2(1.6, 0.7));
t += write_5(uv3, vec2(-53,6), texts[9]);
} }
f += rect(uv3, vec2(-14.5, 28.5), vec2(2.6, 0.7)); f += rect(uv3, vec2(-14.5, 28.5), vec2(2.6, 0.7));
t += write_5(uv3, vec2(-17,28), texts[2]); t += write_5(uv3, vec2(-17,28), texts[2]);
-2
View File
@@ -6,8 +6,6 @@
in vec2 vUV; in vec2 vUV;
out vec4 fragColor; out vec4 fragColor;
uniform int iInputFormat2;
void main() { void main() {
if (iInputFormat2 == YUYV_FOURCC) { if (iInputFormat2 == YUYV_FOURCC) {
fragColor = yuyvTex(iTex2, vUV, int(iInputResolution2.x)); fragColor = yuyvTex(iTex2, vUV, int(iInputResolution2.x));
+1 -1
View File
@@ -8,5 +8,5 @@ in vec2 vUV;
out vec4 fragColor; out vec4 fragColor;
void main() { void main() {
fragColor = fx_stage(vUV, iTex5, iTex7, iSeed5, iMidi2_1[0], iMidi2_1[1].xy, iMidi2_1[2], iMidi2_1[3].xy, iMidi2_1[4], iMidi2_1[5].xy, iMidi2_1[6].xy); fragColor = fx_stage(vUV, iTex5, iTex7, iSeed5, iMidi2_1[0], iMidi2_1[1].xy, iMidi2_1[2], iMidi2_1[3].xy, iMidi2_1[4], iMidi2_1[5].xy, iMidi2_1[6]);
} }
+1 -1
View File
@@ -8,5 +8,5 @@ in vec2 vUV;
out vec4 fragColor; out vec4 fragColor;
void main() { void main() {
fragColor = fx_stage(vUV, iTex6, iTex8, iSeed6, iMidi2_2[0], iMidi2_2[1].xy, iMidi2_2[2], iMidi2_2[3].xy, iMidi2_2[4], iMidi2_2[5].xy, iMidi2_2[6].xy); fragColor = fx_stage(vUV, iTex6, iTex8, iSeed6, iMidi2_2[0], iMidi2_2[1].xy, iMidi2_2[2], iMidi2_2[3].xy, iMidi2_2[4], iMidi2_2[5].xy, iMidi2_2[6]);
} }
+1 -3
View File
@@ -8,11 +8,9 @@ in vec2 vUV;
out vec4 fragColor; out vec4 fragColor;
void main() { void main() {
vec4 color = fx_stage(vUV, iTex9, iTex0, iSeed8, iMidi2_3[0], iMidi2_3[1].xy, iMidi2_3[2], iMidi2_3[3].xy, iMidi2_3[4], iMidi2_3[5].xy, iMidi2_3[6].xy); vec4 color = fx_stage(vUV, iTex9, iTex0, iSeed8, iMidi2_3[0], iMidi2_3[1].xy, iMidi2_3[2], iMidi2_3[3].xy, iMidi2_3[4], iMidi2_3[5].xy, iMidi2_3[6]);
color = mix(color, vec4(0), iMidi3_1[0].y); color = mix(color, vec4(0), iMidi3_1[0].y);
color = mix(color, 1 - color, iMidi3_1[0].z);
fragColor = color; fragColor = color;
} }
+1 -1
View File
@@ -536,7 +536,7 @@ static void use_program(ShaderProgram program, int i, bool output,
for (j = 0; j < program.frag_count; j++) { for (j = 0; j < program.frag_count; j++) {
write_uniform_1i(program.istate_locations[i * program.frag_count + j], write_uniform_1i(program.istate_locations[i * program.frag_count + j],
context->state.values[j]); context->state.values[j] + 1);
} }
offset = 0; offset = 0;