summaryrefslogtreecommitdiff
path: root/workspaces/main
diff options
context:
space:
mode:
Diffstat (limited to 'workspaces/main')
-rw-r--r--workspaces/main/assets.txt20
-rw-r--r--workspaces/main/shaders/cnn/cnn_activation.wgsl18
-rw-r--r--workspaces/main/shaders/cnn/cnn_conv1x1.wgsl100
-rw-r--r--workspaces/main/shaders/cnn/cnn_conv3x3.wgsl100
-rw-r--r--workspaces/main/shaders/cnn/cnn_conv5x5.wgsl101
-rw-r--r--workspaces/main/shaders/cnn/cnn_conv7x7.wgsl53
-rw-r--r--workspaces/main/shaders/cnn/cnn_layer.wgsl55
-rw-r--r--workspaces/main/shaders/cnn/cnn_weights_generated.wgsl302
-rw-r--r--workspaces/main/shaders/cnn_v2/cnn_v2_compute.wgsl143
-rw-r--r--workspaces/main/shaders/cnn_v2/cnn_v2_layer_0.wgsl174
-rw-r--r--workspaces/main/shaders/cnn_v2/cnn_v2_layer_1.wgsl174
-rw-r--r--workspaces/main/shaders/cnn_v2/cnn_v2_layer_2.wgsl156
-rw-r--r--workspaces/main/shaders/cnn_v2/cnn_v2_layer_template.wgsl68
-rw-r--r--workspaces/main/shaders/cnn_v2/cnn_v2_static.wgsl75
-rw-r--r--workspaces/main/timeline.seq4
15 files changed, 12 insertions, 1531 deletions
diff --git a/workspaces/main/assets.txt b/workspaces/main/assets.txt
index 972cc8b..189e965 100644
--- a/workspaces/main/assets.txt
+++ b/workspaces/main/assets.txt
@@ -37,16 +37,16 @@ SHADER_PASSTHROUGH, NONE, ../../common/shaders/passthrough.wgsl, "Passthrough Sh
SHADER_ELLIPSE, NONE, shaders/ellipse.wgsl, "Ellipse Shader"
SHADER_PARTICLE_SPRAY_COMPUTE, NONE, shaders/particle_spray_compute.wgsl, "Particle Spray Compute"
SHADER_GAUSSIAN_BLUR, NONE, shaders/gaussian_blur.wgsl, "Gaussian Blur Shader"
-SHADER_CNN_ACTIVATION, NONE, shaders/cnn/cnn_activation.wgsl, "CNN Activation Functions"
-SHADER_CNN_CONV1X1, NONE, shaders/cnn/cnn_conv1x1.wgsl, "CNN 1x1 Convolution"
-SHADER_CNN_CONV3X3, NONE, shaders/cnn/cnn_conv3x3.wgsl, "CNN 3x3 Convolution"
-SHADER_CNN_CONV5X5, NONE, shaders/cnn/cnn_conv5x5.wgsl, "CNN 5x5 Convolution"
-SHADER_CNN_CONV7X7, NONE, shaders/cnn/cnn_conv7x7.wgsl, "CNN 7x7 Convolution"
-SHADER_CNN_WEIGHTS, NONE, shaders/cnn/cnn_weights_generated.wgsl, "CNN Weights (Generated)"
-SHADER_CNN_LAYER, NONE, shaders/cnn/cnn_layer.wgsl, "CNN Layer Shader"
-SHADER_CNN_V2_STATIC, NONE, shaders/cnn_v2/cnn_v2_static.wgsl, "CNN v2 Static Features"
-SHADER_CNN_V2_COMPUTE, NONE, shaders/cnn_v2/cnn_v2_compute.wgsl, "CNN v2 Compute (Storage Buffer)"
-WEIGHTS_CNN_V2, NONE, weights/cnn_v2_weights.bin, "CNN v2 Binary Weights"
+SHADER_CNN_ACTIVATION, NONE, ../../cnn_v1/shaders/cnn_activation.wgsl, "CNN Activation Functions"
+SHADER_CNN_CONV1X1, NONE, ../../cnn_v1/shaders/cnn_conv1x1.wgsl, "CNN 1x1 Convolution"
+SHADER_CNN_CONV3X3, NONE, ../../cnn_v1/shaders/cnn_conv3x3.wgsl, "CNN 3x3 Convolution"
+SHADER_CNN_CONV5X5, NONE, ../../cnn_v1/shaders/cnn_conv5x5.wgsl, "CNN 5x5 Convolution"
+SHADER_CNN_CONV7X7, NONE, ../../cnn_v1/shaders/cnn_conv7x7.wgsl, "CNN 7x7 Convolution"
+SHADER_CNN_WEIGHTS, NONE, ../../cnn_v1/shaders/cnn_weights_generated.wgsl, "CNN Weights (Generated)"
+SHADER_CNN_LAYER, NONE, ../../cnn_v1/shaders/cnn_layer.wgsl, "CNN Layer Shader"
+SHADER_CNN_V2_STATIC, NONE, ../../cnn_v2/shaders/cnn_v2_static.wgsl, "CNN v2 Static Features"
+SHADER_CNN_V2_COMPUTE, NONE, ../../cnn_v2/shaders/cnn_v2_compute.wgsl, "CNN v2 Compute (Storage Buffer)"
+WEIGHTS_CNN_V2, NONE, ../../cnn_v2/weights/cnn_v2_weights.bin, "CNN v2 Binary Weights"
SHADER_SOLARIZE, NONE, shaders/solarize.wgsl, "Solarize Shader"
SHADER_DISTORT, NONE, shaders/distort.wgsl, "Distort Shader"
SHADER_CHROMA_ABERRATION, NONE, shaders/chroma_aberration.wgsl, "Chroma Aberration Shader"
diff --git a/workspaces/main/shaders/cnn/cnn_activation.wgsl b/workspaces/main/shaders/cnn/cnn_activation.wgsl
deleted file mode 100644
index 4fe771e..0000000
--- a/workspaces/main/shaders/cnn/cnn_activation.wgsl
+++ /dev/null
@@ -1,18 +0,0 @@
-// CNN activation functions
-// 4 functions: tanh, ReLU, sigmoid, leaky_relu
-
-fn cnn_tanh(x: vec4<f32>) -> vec4<f32> {
- return tanh(x);
-}
-
-fn cnn_relu(x: vec4<f32>) -> vec4<f32> {
- return max(vec4<f32>(0.0), x);
-}
-
-fn cnn_sigmoid(x: vec4<f32>) -> vec4<f32> {
- return 1.0 / (1.0 + exp(-x));
-}
-
-fn cnn_leaky_relu(x: vec4<f32>, alpha: f32) -> vec4<f32> {
- return max(alpha * x, x);
-}
diff --git a/workspaces/main/shaders/cnn/cnn_conv1x1.wgsl b/workspaces/main/shaders/cnn/cnn_conv1x1.wgsl
deleted file mode 100644
index f77cfa8..0000000
--- a/workspaces/main/shaders/cnn/cnn_conv1x1.wgsl
+++ /dev/null
@@ -1,100 +0,0 @@
-// 1x1 convolution (vec4-optimized)
-
-// Inner layers: 7→4 channels (vec4-optimized)
-// Assumes 'tex' is already normalized to [-1,1]
-fn cnn_conv1x1_7to4(
- tex: texture_2d<f32>,
- samp: sampler,
- uv: vec2<f32>,
- resolution: vec2<f32>,
- gray: f32,
- weights: array<vec4<f32>, 8>
-) -> vec4<f32> {
- let step = 1.0 / resolution;
- let uv_norm = (uv - 0.5) * 2.0;
-
- var sum = vec4<f32>(0.0);
- var pos = 0;
-
- for (var dy = -0; dy <= 0; dy++) {
- for (var dx = -0; dx <= 0; dx++) {
- let offset = vec2<f32>(f32(dx), f32(dy)) * step;
- let rgbd = textureSample(tex, samp, uv + offset);
- let in1 = vec4<f32>(uv_norm, gray, 1.0);
-
- sum.r += dot(weights[pos+0], rgbd) + dot(weights[pos+1], in1);
- sum.g += dot(weights[pos+2], rgbd) + dot(weights[pos+3], in1);
- sum.b += dot(weights[pos+4], rgbd) + dot(weights[pos+5], in1);
- sum.a += dot(weights[pos+6], rgbd) + dot(weights[pos+7], in1);
- pos += 8;
- }
- }
-
- return sum;
-}
-
-// Source layer: 7→4 channels (vec4-optimized)
-// Normalizes [0,1] input to [-1,1] internally
-fn cnn_conv1x1_7to4_src(
- tex: texture_2d<f32>,
- samp: sampler,
- uv: vec2<f32>,
- resolution: vec2<f32>,
- weights: array<vec4<f32>, 8>
-) -> vec4<f32> {
- let step = 1.0 / resolution;
-
- var original = (textureSample(tex, samp, uv) - 0.5) * 2.0;
- let gray = dot(original.rgb, vec3<f32>(0.2126, 0.7152, 0.0722));
- let uv_norm = (uv - 0.5) * 2.0;
- let in1 = vec4<f32>(uv_norm, gray, 1.0);
-
- var sum = vec4<f32>(0.0);
- var pos = 0;
-
- for (var dy = -0; dy <= 0; dy++) {
- for (var dx = -0; dx <= 0; dx++) {
- let offset = vec2<f32>(f32(dx), f32(dy)) * step;
- var rgbd = (textureSample(tex, samp, uv + offset) - 0.5) * 2.0;
-
- sum.r += dot(weights[pos+0], rgbd) + dot(weights[pos+1], in1);
- sum.g += dot(weights[pos+2], rgbd) + dot(weights[pos+3], in1);
- sum.b += dot(weights[pos+4], rgbd) + dot(weights[pos+5], in1);
- sum.a += dot(weights[pos+6], rgbd) + dot(weights[pos+7], in1);
- pos += 8;
- }
- }
-
- return sum;
-}
-
-// Final layer: 7→1 channel (vec4-optimized)
-// Assumes 'tex' is already normalized to [-1,1]
-// Returns raw sum (activation applied at call site)
-fn cnn_conv1x1_7to1(
- tex: texture_2d<f32>,
- samp: sampler,
- uv: vec2<f32>,
- resolution: vec2<f32>,
- gray: f32,
- weights: array<vec4<f32>, 2>
-) -> f32 {
- let step = 1.0 / resolution;
- let uv_norm = (uv - 0.5) * 2.0;
- let in1 = vec4<f32>(uv_norm, gray, 1.0);
-
- var sum = 0.0;
- var pos = 0;
-
- for (var dy = -0; dy <= 0; dy++) {
- for (var dx = -0; dx <= 0; dx++) {
- let offset = vec2<f32>(f32(dx), f32(dy)) * step;
- let rgbd = textureSample(tex, samp, uv + offset);
-
- sum += dot(weights[pos], rgbd) + dot(weights[pos+1], in1);
- pos += 2;
- }
- }
-
- return sum;
-}
diff --git a/workspaces/main/shaders/cnn/cnn_conv3x3.wgsl b/workspaces/main/shaders/cnn/cnn_conv3x3.wgsl
deleted file mode 100644
index f7d11b1..0000000
--- a/workspaces/main/shaders/cnn/cnn_conv3x3.wgsl
+++ /dev/null
@@ -1,100 +0,0 @@
-// 3x3 convolution (vec4-optimized)
-
-// Inner layers: 7→4 channels (vec4-optimized)
-// Assumes 'tex' is already normalized to [-1,1]
-fn cnn_conv3x3_7to4(
- tex: texture_2d<f32>,
- samp: sampler,
- uv: vec2<f32>,
- resolution: vec2<f32>,
- gray: f32,
- weights: array<vec4<f32>, 72>
-) -> vec4<f32> {
- let step = 1.0 / resolution;
- let uv_norm = (uv - 0.5) * 2.0;
-
- var sum = vec4<f32>(0.0);
- var pos = 0;
-
- for (var dy = -1; dy <= 1; dy++) {
- for (var dx = -1; dx <= 1; dx++) {
- let offset = vec2<f32>(f32(dx), f32(dy)) * step;
- let rgbd = textureSample(tex, samp, uv + offset);
- let in1 = vec4<f32>(uv_norm, gray, 1.0);
-
- sum.r += dot(weights[pos+0], rgbd) + dot(weights[pos+1], in1);
- sum.g += dot(weights[pos+2], rgbd) + dot(weights[pos+3], in1);
- sum.b += dot(weights[pos+4], rgbd) + dot(weights[pos+5], in1);
- sum.a += dot(weights[pos+6], rgbd) + dot(weights[pos+7], in1);
- pos += 8;
- }
- }
-
- return sum;
-}
-
-// Source layer: 7→4 channels (vec4-optimized)
-// Normalizes [0,1] input to [-1,1] internally
-fn cnn_conv3x3_7to4_src(
- tex: texture_2d<f32>,
- samp: sampler,
- uv: vec2<f32>,
- resolution: vec2<f32>,
- weights: array<vec4<f32>, 72>
-) -> vec4<f32> {
- let step = 1.0 / resolution;
-
- let original = (textureSample(tex, samp, uv) - 0.5) * 2.0;
- let gray = dot(original.rgb, vec3<f32>(0.2126, 0.7152, 0.0722));
- let uv_norm = (uv - 0.5) * 2.0;
- let in1 = vec4<f32>(uv_norm, gray, 1.0);
-
- var sum = vec4<f32>(0.0);
- var pos = 0;
-
- for (var dy = -1; dy <= 1; dy++) {
- for (var dx = -1; dx <= 1; dx++) {
- let offset = vec2<f32>(f32(dx), f32(dy)) * step;
- let rgbd = (textureSample(tex, samp, uv + offset) - 0.5) * 2.0;
-
- sum.r += dot(weights[pos+0], rgbd) + dot(weights[pos+1], in1);
- sum.g += dot(weights[pos+2], rgbd) + dot(weights[pos+3], in1);
- sum.b += dot(weights[pos+4], rgbd) + dot(weights[pos+5], in1);
- sum.a += dot(weights[pos+6], rgbd) + dot(weights[pos+7], in1);
- pos += 8;
- }
- }
-
- return sum;
-}
-
-// Final layer: 7→1 channel (vec4-optimized)
-// Assumes 'tex' is already normalized to [-1,1]
-// Returns raw sum (activation applied at call site)
-fn cnn_conv3x3_7to1(
- tex: texture_2d<f32>,
- samp: sampler,
- uv: vec2<f32>,
- resolution: vec2<f32>,
- gray: f32,
- weights: array<vec4<f32>, 18>
-) -> f32 {
- let step = 1.0 / resolution;
- let uv_norm = (uv - 0.5) * 2.0;
- let in1 = vec4<f32>(uv_norm, gray, 1.0);
-
- var sum = 0.0;
- var pos = 0;
-
- for (var dy = -1; dy <= 1; dy++) {
- for (var dx = -1; dx <= 1; dx++) {
- let offset = vec2<f32>(f32(dx), f32(dy)) * step;
- let rgbd = textureSample(tex, samp, uv + offset);
-
- sum += dot(weights[pos], rgbd) + dot(weights[pos+1], in1);
- pos += 2;
- }
- }
-
- return sum;
-}
diff --git a/workspaces/main/shaders/cnn/cnn_conv5x5.wgsl b/workspaces/main/shaders/cnn/cnn_conv5x5.wgsl
deleted file mode 100644
index 9328d75..0000000
--- a/workspaces/main/shaders/cnn/cnn_conv5x5.wgsl
+++ /dev/null
@@ -1,101 +0,0 @@
-// 5×5 variant for 7→4 channels (vec4-optimized)
-// Assumes 'tex' is already normalized to [-1,1]
-// UV coordinates remain in [0,1] and are normalized internally
-// weights: array<vec4<f32>, 200> (25 pos × 4 ch × 2 vec4)
-fn cnn_conv5x5_7to4(
- tex: texture_2d<f32>,
- samp: sampler,
- uv: vec2<f32>,
- resolution: vec2<f32>,
- gray: f32,
- weights: array<vec4<f32>, 200>
-) -> vec4<f32> {
- let step = 1.0 / resolution;
- let uv_norm = (uv - 0.5) * 2.0;
- let in1 = vec4<f32>(uv_norm, gray, 1.0);
-
- var sum = vec4<f32>(0.0);
- var pos = 0;
-
- for (var dy = -2; dy <= 2; dy++) {
- for (var dx = -2; dx <= 2; dx++) {
- let offset = vec2<f32>(f32(dx), f32(dy)) * step;
- let rgbd = textureSample(tex, samp, uv + offset);
-
- sum.r += dot(weights[pos+0], rgbd) + dot(weights[pos+1], in1);
- sum.g += dot(weights[pos+2], rgbd) + dot(weights[pos+3], in1);
- sum.b += dot(weights[pos+4], rgbd) + dot(weights[pos+5], in1);
- sum.a += dot(weights[pos+6], rgbd) + dot(weights[pos+7], in1);
- pos += 8;
- }
- }
-
- return sum;
-}
-
-// 5×5 variant for 7→1 channel (vec4-optimized)
-// Assumes 'tex' is already normalized to [-1,1]
-// UV coordinates remain in [0,1] and are normalized internally
-// weights: array<vec4<f32>, 50> (25 pos × 2 vec4)
-fn cnn_conv5x5_7to1(
- tex: texture_2d<f32>,
- samp: sampler,
- uv: vec2<f32>,
- resolution: vec2<f32>,
- gray: f32,
- weights: array<vec4<f32>, 50>
-) -> f32 {
- let step = 1.0 / resolution;
- let uv_norm = (uv - 0.5) * 2.0;
- let in1 = vec4<f32>(uv_norm, gray, 1.0);
-
- var sum = 0.0;
- var pos = 0;
-
- for (var dy = -2; dy <= 2; dy++) {
- for (var dx = -2; dx <= 2; dx++) {
- let offset = vec2<f32>(f32(dx), f32(dy)) * step;
- let rgbd = textureSample(tex, samp, uv + offset);
-
- sum += dot(weights[pos], rgbd) + dot(weights[pos+1], in1);
- pos += 2;
- }
- }
-
- return sum;
-}
-
-// Source layer: 7→4 channels (vec4-optimized)
-// Normalizes [0,1] input to [-1,1] internally
-fn cnn_conv5x5_7to4_src(
- tex: texture_2d<f32>,
- samp: sampler,
- uv: vec2<f32>,
- resolution: vec2<f32>,
- weights: array<vec4<f32>, 200>
-) -> vec4<f32> {
- let step = 1.0 / resolution;
-
- let original = (textureSample(tex, samp, uv) - 0.5) * 2.0;
- let gray = dot(original.rgb, vec3<f32>(0.2126, 0.7152, 0.0722));
- let uv_norm = (uv - 0.5) * 2.0;
- let in1 = vec4<f32>(uv_norm, gray, 1.0);
-
- var sum = vec4<f32>(0.0);
- var pos = 0;
-
- for (var dy = -2; dy <= 2; dy++) {
- for (var dx = -2; dx <= 2; dx++) {
- let offset = vec2<f32>(f32(dx), f32(dy)) * step;
- let rgbd = (textureSample(tex, samp, uv + offset) - 0.5) * 2.0;
-
- sum.r += dot(weights[pos+0], rgbd) + dot(weights[pos+1], in1);
- sum.g += dot(weights[pos+2], rgbd) + dot(weights[pos+3], in1);
- sum.b += dot(weights[pos+4], rgbd) + dot(weights[pos+5], in1);
- sum.a += dot(weights[pos+6], rgbd) + dot(weights[pos+7], in1);
- pos += 8;
- }
- }
-
- return sum;
-}
diff --git a/workspaces/main/shaders/cnn/cnn_conv7x7.wgsl b/workspaces/main/shaders/cnn/cnn_conv7x7.wgsl
deleted file mode 100644
index e68d644..0000000
--- a/workspaces/main/shaders/cnn/cnn_conv7x7.wgsl
+++ /dev/null
@@ -1,53 +0,0 @@
-// 7x7 convolution with 49 samples
-// Applies mat4 weights per sample
-
-fn cnn_conv7x7(
- tex: texture_2d<f32>,
- samp: sampler,
- uv: vec2<f32>,
- resolution: vec2<f32>,
- weights: array<mat4x4<f32>, 49>,
- bias: vec4<f32>
-) -> vec4<f32> {
- let step = 1.0 / resolution;
- var sum = bias;
- var idx = 0;
-
- for (var dy = -3; dy <= 3; dy++) {
- for (var dx = -3; dx <= 3; dx++) {
- let offset = vec2<f32>(f32(dx), f32(dy)) * step;
- let sample = textureSample(tex, samp, uv + offset);
- sum += weights[idx] * sample;
- idx++;
- }
- }
-
- return sum;
-}
-
-fn cnn_conv7x7_with_coord(
- tex: texture_2d<f32>,
- samp: sampler,
- uv: vec2<f32>,
- resolution: vec2<f32>,
- rgba_weights: array<mat4x4<f32>, 49>,
- coord_weights: mat2x4<f32>,
- bias: vec4<f32>
-) -> vec4<f32> {
- let step = 1.0 / resolution;
- var sum = bias;
-
- sum += coord_weights * uv;
-
- var idx = 0;
- for (var dy = -3; dy <= 3; dy++) {
- for (var dx = -3; dx <= 3; dx++) {
- let offset = vec2<f32>(f32(dx), f32(dy)) * step;
- let rgba = textureSample(tex, samp, uv + offset);
- sum += rgba_weights[idx] * rgba;
- idx++;
- }
- }
-
- return sum;
-}
diff --git a/workspaces/main/shaders/cnn/cnn_layer.wgsl b/workspaces/main/shaders/cnn/cnn_layer.wgsl
deleted file mode 100644
index cbd1686..0000000
--- a/workspaces/main/shaders/cnn/cnn_layer.wgsl
+++ /dev/null
@@ -1,55 +0,0 @@
-// CNN layer shader - uses modular convolution snippets
-// Supports multi-pass rendering with residual connections
-// DO NOT EDIT - Generated by train_cnn.py
-
-@group(0) @binding(0) var smplr: sampler;
-@group(0) @binding(1) var txt: texture_2d<f32>;
-
-#include "common_uniforms"
-#include "cnn_activation"
-#include "cnn_conv3x3"
-#include "cnn_conv5x5"
-#include "cnn_weights_generated"
-
-struct CNNLayerParams {
- layer_index: i32,
- blend_amount: f32,
- _pad: vec2<f32>,
-};
-
-@group(0) @binding(2) var<uniform> uniforms: CommonUniforms;
-@group(0) @binding(3) var<uniform> params: CNNLayerParams;
-@group(0) @binding(4) var original_input: texture_2d<f32>;
-
-@vertex fn vs_main(@builtin(vertex_index) i: u32) -> @builtin(position) vec4<f32> {
- var pos = array<vec2<f32>, 3>(
- vec2<f32>(-1.0, -1.0), vec2<f32>(3.0, -1.0), vec2<f32>(-1.0, 3.0)
- );
- return vec4<f32>(pos[i], 0.0, 1.0);
-}
-
-@fragment fn fs_main(@builtin(position) p: vec4<f32>) -> @location(0) vec4<f32> {
- // Match PyTorch linspace
- let uv = (p.xy - 0.5) / (uniforms.resolution - 1.0);
- let original_raw = textureSample(original_input, smplr, uv);
- let original = (original_raw - 0.5) * 2.0; // Normalize to [-1,1]
- let gray = (dot(original_raw.rgb, vec3<f32>(0.2126, 0.7152, 0.0722)) - 0.5) * 2.0;
- var result = vec4<f32>(0.0);
-
- // Layer 0: 7→4 (RGBD output, normalizes [0,1] input)
- if (params.layer_index == 0) {
- result = cnn_conv5x5_7to4_src(txt, smplr, uv, uniforms.resolution, weights_layer0);
- result = cnn_tanh(result);
- }
- else if (params.layer_index == 1) {
- result = cnn_conv3x3_7to4(txt, smplr, uv, uniforms.resolution, gray, weights_layer1);
- result = cnn_tanh(result); // Keep in [-1,1]
- }
- else if (params.layer_index == 2) {
- let sum = cnn_conv3x3_7to1(txt, smplr, uv, uniforms.resolution, gray, weights_layer2);
- let gray_out = 1.0 / (1.0 + exp(-sum)); // Sigmoid activation
- result = vec4<f32>(gray_out, gray_out, gray_out, 1.0);
- return mix(original_raw, result, params.blend_amount); // [0,1]
- }
- return result; // [-1,1]
-}
diff --git a/workspaces/main/shaders/cnn/cnn_weights_generated.wgsl b/workspaces/main/shaders/cnn/cnn_weights_generated.wgsl
deleted file mode 100644
index 510f86f..0000000
--- a/workspaces/main/shaders/cnn/cnn_weights_generated.wgsl
+++ /dev/null
@@ -1,302 +0,0 @@
-// Auto-generated CNN weights (vec4-optimized)
-// DO NOT EDIT - Generated by train_cnn.py
-
-const weights_layer0: array<vec4<f32>, 200> = array(
- vec4<f32>(0.235493, 0.070711, -0.007171, 0.029242),
- vec4<f32>(0.010796, -0.007094, 0.104870, -0.001741),
- vec4<f32>(-0.363645, 0.625662, 0.044248, 0.046890),
- vec4<f32>(0.016731, -0.099652, 0.198682, -0.002050),
- vec4<f32>(-0.738196, -1.196639, -0.153794, 0.059818),
- vec4<f32>(-0.012392, 0.206094, -1.159788, 0.001624),
- vec4<f32>(-0.089846, -0.097056, 0.533546, -0.256308),
- vec4<f32>(0.052460, 0.007740, -0.025518, -0.011569),
- vec4<f32>(0.024563, -0.123127, -0.189236, -0.034605),
- vec4<f32>(0.027494, 0.077022, -0.073083, -0.001741),
- vec4<f32>(0.127897, -1.191688, -0.289229, -0.057213),
- vec4<f32>(-0.017651, -0.095915, -0.540725, -0.002050),
- vec4<f32>(0.459141, 1.047422, 1.008783, 0.082279),
- vec4<f32>(-0.148789, 0.141891, 0.964934, 0.001624),
- vec4<f32>(-0.458732, -0.253084, 0.429181, -0.267647),
- vec4<f32>(0.029582, 0.043901, -0.332350, -0.011569),
- vec4<f32>(-0.089206, -0.379760, -0.267976, -0.033062),
- vec4<f32>(-0.059616, 0.042331, -0.297211, -0.001741),
- vec4<f32>(0.347450, 0.349807, -0.107598, -0.038193),
- vec4<f32>(-0.054979, -0.022737, 0.368773, -0.002050),
- vec4<f32>(1.185666, 2.203693, 1.743948, 0.015765),
- vec4<f32>(-0.004807, 0.138734, 2.114184, 0.001624),
- vec4<f32>(-0.397312, -0.423930, 0.436068, -0.309529),
- vec4<f32>(-0.025822, 0.061618, -0.358850, -0.011569),
- vec4<f32>(0.031591, -0.133625, -0.210201, -0.058735),
- vec4<f32>(0.026377, 0.074180, -0.075918, -0.001741),
- vec4<f32>(-0.632064, -0.365984, -0.183357, -0.064294),
- vec4<f32>(-0.038233, -0.027135, -0.529794, -0.002050),
- vec4<f32>(-0.079942, -0.108489, 0.284420, 0.068003),
- vec4<f32>(-0.033783, 0.131316, -0.006431, 0.001624),
- vec4<f32>(-0.096003, -0.037157, 0.523401, -0.332369),
- vec4<f32>(0.098362, 0.049597, 0.024988, -0.011569),
- vec4<f32>(-0.042374, 0.215371, 0.044488, -0.079190),
- vec4<f32>(-0.108483, 0.244548, 0.195395, -0.001741),
- vec4<f32>(0.121079, 0.214838, 0.292411, -0.013912),
- vec4<f32>(0.098564, -0.117552, 0.392438, -0.002050),
- vec4<f32>(-0.994368, -0.526871, 0.165568, 0.006371),
- vec4<f32>(-0.142932, 0.234835, -0.612723, 0.001624),
- vec4<f32>(-0.430247, -0.230031, 0.035994, -0.340101),
- vec4<f32>(-0.134622, -0.045299, -0.264801, -0.011569),
- vec4<f32>(-0.116651, 0.042012, -0.004781, 0.018667),
- vec4<f32>(0.000405, -0.068494, 0.084279, -0.001741),
- vec4<f32>(0.180754, -0.853766, -0.384955, 0.013426),
- vec4<f32>(0.038369, 0.010519, -0.437544, -0.002050),
- vec4<f32>(0.373661, 0.677625, 0.617145, -0.028541),
- vec4<f32>(0.071383, 0.012678, 0.734573, 0.001624),
- vec4<f32>(-0.187586, -0.167658, 0.445526, -0.213674),
- vec4<f32>(-0.054012, -0.048233, -0.111101, -0.011569),
- vec4<f32>(-0.329708, 0.124956, 0.150447, 0.038372),
- vec4<f32>(0.042139, -0.014901, 0.056693, -0.001741),
- vec4<f32>(0.547166, 1.493724, 0.572366, 0.044038),
- vec4<f32>(-0.055818, 0.022352, 1.209448, -0.002050),
- vec4<f32>(-0.669255, -0.481531, -0.593402, 0.125846),
- vec4<f32>(-0.086191, -0.012315, -0.692654, 0.001624),
- vec4<f32>(-0.667836, -0.543086, 0.253854, -0.236805),
- vec4<f32>(0.045048, 0.047535, -0.607491, -0.011569),
- vec4<f32>(-0.262418, 0.247133, 0.225155, -0.084126),
- vec4<f32>(0.017065, 0.007371, 0.103683, -0.001741),
- vec4<f32>(0.216644, 1.179116, 0.436799, 0.041116),
- vec4<f32>(0.006571, 0.012147, 0.674660, -0.002050),
- vec4<f32>(0.290965, -0.022340, -0.616338, 0.021808),
- vec4<f32>(-0.091234, -0.016764, 0.116976, 0.001624),
- vec4<f32>(-0.689736, -0.685681, 0.342797, -0.213249),
- vec4<f32>(0.040683, 0.038921, -0.663171, -0.011569),
- vec4<f32>(-0.150412, 0.018053, -0.103426, 0.026070),
- vec4<f32>(0.016183, -0.090006, 0.028738, -0.001741),
- vec4<f32>(0.851827, -0.499315, 0.146696, 0.047324),
- vec4<f32>(0.059725, 0.031269, 0.184268, -0.002050),
- vec4<f32>(0.160719, -0.309456, -0.432633, -0.021171),
- vec4<f32>(-0.060075, -0.052701, -0.248520, 0.001624),
- vec4<f32>(-0.217727, 0.354527, 0.663356, -0.267530),
- vec4<f32>(-0.032714, 0.000761, 0.246687, -0.011569),
- vec4<f32>(0.077123, 0.069934, 0.077986, 0.004388),
- vec4<f32>(-0.107897, 0.103689, 0.072698, -0.001741),
- vec4<f32>(-0.216285, -0.206663, -0.497913, -0.019433),
- vec4<f32>(0.042063, -0.036315, -0.306115, -0.002050),
- vec4<f32>(0.351038, 0.116104, -0.046132, 0.022280),
- vec4<f32>(-0.026460, -0.025197, 0.286924, 0.001624),
- vec4<f32>(-0.480131, -0.253209, -0.259724, -0.353796),
- vec4<f32>(-0.069436, -0.026651, -0.285359, -0.011569),
- vec4<f32>(0.225811, -0.092313, -0.152689, 0.007505),
- vec4<f32>(0.120530, 0.012846, -0.020303, -0.001741),
- vec4<f32>(0.305262, 0.699468, 0.474383, -0.002565),
- vec4<f32>(-0.036377, 0.008052, 0.424588, -0.002050),
- vec4<f32>(0.557323, 0.489104, 0.312243, 0.072877),
- vec4<f32>(0.096476, -0.012612, 0.586454, 0.001624),
- vec4<f32>(-0.370964, -0.252666, 0.235903, -0.299915),
- vec4<f32>(-0.066341, -0.008435, -0.158507, -0.011569),
- vec4<f32>(0.070604, -0.016186, -0.079075, 0.015055),
- vec4<f32>(0.042533, -0.085281, -0.014053, -0.001741),
- vec4<f32>(-1.115748, -0.531544, -0.207050, -0.040691),
- vec4<f32>(0.010035, -0.008330, -0.718958, -0.002050),
- vec4<f32>(-1.404958, -2.000416, -1.884062, 0.014171),
- vec4<f32>(0.019375, -0.078894, -1.999592, 0.001624),
- vec4<f32>(-1.144367, -0.681485, 0.145197, -0.310542),
- vec4<f32>(0.071912, -0.001021, -0.817277, -0.011569),
- vec4<f32>(-0.018298, 0.109930, -0.067419, -0.031281),
- vec4<f32>(0.072086, -0.047123, -0.018405, -0.001741),
- vec4<f32>(-2.926982, -5.479454, -1.936543, 0.034851),
- vec4<f32>(0.005592, 0.052238, -4.695754, -0.002050),
- vec4<f32>(0.504616, -0.384917, -0.623795, 0.009371),
- vec4<f32>(-0.105685, -0.049385, -0.154266, 0.001624),
- vec4<f32>(-1.428979, -0.829611, 0.160294, -0.239524),
- vec4<f32>(0.054180, -0.058797, -0.939519, -0.011569),
- vec4<f32>(0.088147, -0.158820, -0.199674, -0.083067),
- vec4<f32>(0.073984, -0.059593, -0.103344, -0.001741),
- vec4<f32>(0.465084, 2.259005, 0.899806, -0.010464),
- vec4<f32>(0.058231, -0.075668, 1.383652, -0.002050),
- vec4<f32>(-0.162736, -0.899540, -0.559890, 0.066380),
- vec4<f32>(0.029594, 0.036117, -0.780812, 0.001624),
- vec4<f32>(-0.605431, 0.342970, 0.671602, -0.313734),
- vec4<f32>(0.072950, 0.058100, 0.232742, -0.011569),
- vec4<f32>(0.161941, -0.017279, -0.010904, -0.041589),
- vec4<f32>(-0.118079, 0.090886, 0.001212, -0.001741),
- vec4<f32>(-0.136354, 0.155269, 0.058437, -0.043499),
- vec4<f32>(0.029368, 0.079326, -0.060807, -0.002050),
- vec4<f32>(0.222824, 0.267939, 0.010260, 0.093258),
- vec4<f32>(-0.091763, 0.028527, 0.290062, 0.001624),
- vec4<f32>(-0.584501, -0.074002, -0.187352, -0.247388),
- vec4<f32>(-0.067679, -0.036398, -0.237425, -0.011569),
- vec4<f32>(-0.026121, -0.231360, 0.002505, -0.096021),
- vec4<f32>(0.073173, -0.059323, -0.128630, -0.001741),
- vec4<f32>(-0.118509, -0.931686, -0.328151, 0.027222),
- vec4<f32>(0.006670, -0.094619, -0.605555, -0.002050),
- vec4<f32>(0.260254, 0.186958, 0.235441, -0.030871),
- vec4<f32>(0.111987, -0.056380, 0.227175, 0.001624),
- vec4<f32>(0.012446, -0.068683, 0.273271, -0.315052),
- vec4<f32>(-0.020011, 0.046984, 0.026316, -0.011569),
- vec4<f32>(0.149830, 0.108146, 0.141757, 0.040947),
- vec4<f32>(-0.060874, -0.004303, 0.196782, -0.001741),
- vec4<f32>(1.031257, 1.493831, 0.443644, -0.089572),
- vec4<f32>(-0.035087, 0.049431, 1.193984, -0.002050),
- vec4<f32>(-0.204666, -0.340174, -0.045684, 0.053997),
- vec4<f32>(0.000214, -0.073696, -0.299299, 0.001624),
- vec4<f32>(-1.040674, -0.828753, 0.007912, -0.326534),
- vec4<f32>(0.040669, -0.036526, -0.794626, -0.011569),
- vec4<f32>(-0.018212, -0.031610, 0.259871, -0.041978),
- vec4<f32>(0.021055, -0.061307, -0.004348, -0.001741),
- vec4<f32>(0.002720, 0.570871, 0.371837, -0.076940),
- vec4<f32>(0.023420, 0.006175, 0.318983, -0.002050),
- vec4<f32>(0.259713, 0.294528, 0.907401, 0.043367),
- vec4<f32>(-0.087576, -0.053953, 0.273380, 0.001624),
- vec4<f32>(-1.177213, -0.464727, 0.211285, -0.266637),
- vec4<f32>(0.075274, -0.007404, -0.703821, -0.011569),
- vec4<f32>(-0.089204, -0.053316, 0.280138, -0.056155),
- vec4<f32>(0.030981, -0.005136, 0.038455, -0.001741),
- vec4<f32>(0.936459, -0.196866, 0.270033, -0.096884),
- vec4<f32>(0.025329, -0.032176, 0.473732, -0.002050),
- vec4<f32>(0.312348, 0.234105, 0.580837, 0.099177),
- vec4<f32>(0.019877, -0.096514, 0.450075, 0.001624),
- vec4<f32>(-1.099700, -0.203693, 0.157253, -0.331450),
- vec4<f32>(-0.033353, -0.072074, -0.453590, -0.011569),
- vec4<f32>(-0.084598, -0.039735, 0.162495, -0.070988),
- vec4<f32>(-0.038491, 0.071525, 0.034601, -0.001741),
- vec4<f32>(-0.199528, -0.475454, -0.297979, 0.037322),
- vec4<f32>(-0.003106, 0.003258, -0.475664, -0.002050),
- vec4<f32>(-0.282845, 0.058921, -0.300971, -0.011632),
- vec4<f32>(-0.102320, 0.065302, -0.035173, 0.001624),
- vec4<f32>(-0.515296, 0.497936, 0.313751, -0.245144),
- vec4<f32>(-0.126936, 0.016721, 0.233370, -0.011569),
- vec4<f32>(-0.220154, 0.069414, 0.194344, 0.000786),
- vec4<f32>(0.037788, -0.095021, -0.055585, -0.001741),
- vec4<f32>(-0.186244, 0.434960, 0.138978, -0.017604),
- vec4<f32>(0.014466, 0.055976, 0.306540, -0.002050),
- vec4<f32>(0.000614, -0.087365, -0.327816, 0.025776),
- vec4<f32>(0.227096, -0.143725, -0.046319, 0.001624),
- vec4<f32>(0.468607, -0.441809, -0.025186, -0.260166),
- vec4<f32>(0.018770, -0.067388, -0.240128, -0.011569),
- vec4<f32>(-0.013968, 0.032027, -0.111361, -0.023976),
- vec4<f32>(0.041929, -0.033460, 0.001994, -0.001741),
- vec4<f32>(0.005203, -0.837762, -0.287991, -0.026139),
- vec4<f32>(-0.077592, 0.021388, -0.524153, -0.002050),
- vec4<f32>(0.250865, 0.313428, -0.248465, 0.059517),
- vec4<f32>(0.034922, -0.054528, 0.257107, 0.001624),
- vec4<f32>(0.010692, -0.067238, 0.233031, -0.310017),
- vec4<f32>(0.176915, -0.059644, 0.016072, -0.011569),
- vec4<f32>(0.016422, 0.016187, -0.037382, -0.083725),
- vec4<f32>(0.002691, -0.110865, -0.012957, -0.001741),
- vec4<f32>(0.095561, 0.396829, 0.128803, 0.037097),
- vec4<f32>(0.019823, 0.093399, 0.310928, -0.002050),
- vec4<f32>(-0.193791, -0.079385, 0.332894, 0.039734),
- vec4<f32>(0.119291, -0.053947, 0.020449, 0.001624),
- vec4<f32>(-0.446965, -0.003325, 0.231982, -0.298212),
- vec4<f32>(0.063248, -0.060392, -0.103558, -0.011569),
- vec4<f32>(-0.044501, -0.246630, -0.254448, -0.025872),
- vec4<f32>(0.044620, -0.074284, -0.183828, -0.001741),
- vec4<f32>(-0.369636, -0.171104, -0.485456, -0.085980),
- vec4<f32>(-0.053131, 0.016452, -0.377567, -0.002050),
- vec4<f32>(-0.183644, -0.028271, 0.226453, 0.010102),
- vec4<f32>(0.039391, -0.132828, -0.009034, 0.001624),
- vec4<f32>(-0.644046, -0.335421, 0.011161, -0.222670),
- vec4<f32>(0.091183, 0.005457, -0.472058, -0.011569),
- vec4<f32>(0.045107, 0.080623, -0.132791, 0.064920),
- vec4<f32>(-0.110745, 0.109524, 0.092569, -0.001741),
- vec4<f32>(0.064397, 0.190407, 0.257845, 0.024637),
- vec4<f32>(-0.042557, 0.128625, 0.317239, -0.002050),
- vec4<f32>(-0.362482, 0.271381, -0.115412, 0.103104),
- vec4<f32>(0.088766, 0.042583, 0.069687, 0.001624),
- vec4<f32>(-0.353634, 0.554832, 0.442496, -0.351794),
- vec4<f32>(-0.140207, -0.064649, 0.346336, -0.011569)
-);
-
-const weights_layer1: array<vec4<f32>, 72> = array(
- vec4<f32>(-0.059078, -0.087833, -0.048345, -0.276761),
- vec4<f32>(-0.101904, 0.058647, -0.405575, -0.064215),
- vec4<f32>(-0.382952, 0.579364, -0.051813, -0.155723),
- vec4<f32>(-0.140997, -0.006771, 0.212267, 0.120289),
- vec4<f32>(-0.152651, -0.134768, -0.076617, -0.506104),
- vec4<f32>(0.089304, 0.078492, 0.541122, 0.129289),
- vec4<f32>(0.739323, -0.014103, -0.012980, -0.112747),
- vec4<f32>(-0.089971, -0.088661, -0.520901, 0.158290),
- vec4<f32>(0.819725, 2.866048, 0.080441, 0.380885),
- vec4<f32>(0.035196, 0.028422, -0.748029, -0.064215),
- vec4<f32>(-0.551722, 0.995924, -0.203047, -0.220742),
- vec4<f32>(-0.081721, 0.039584, 0.581791, 0.120289),
- vec4<f32>(-0.752329, -0.482903, -0.317275, 0.515372),
- vec4<f32>(-0.087637, 0.040969, 0.481261, 0.129289),
- vec4<f32>(0.532382, -0.653574, 0.078268, 0.139585),
- vec4<f32>(-0.089350, -0.072701, -1.289249, 0.158290),
- vec4<f32>(0.384272, -0.051717, 0.428463, -0.006561),
- vec4<f32>(0.034003, 0.036653, -0.778556, -0.064215),
- vec4<f32>(-0.788796, 0.332339, -0.181283, -0.213141),
- vec4<f32>(0.196044, -0.062422, 0.724631, 0.120289),
- vec4<f32>(-0.416297, -0.520778, -0.009510, -0.304383),
- vec4<f32>(0.094475, -0.033135, 0.942838, 0.129289),
- vec4<f32>(0.887455, 0.054078, 0.193434, 0.268549),
- vec4<f32>(-0.055369, -0.042953, -0.172902, 0.158290),
- vec4<f32>(0.419144, -0.159019, 0.189637, -0.235703),
- vec4<f32>(-0.098285, 0.021026, -0.041846, -0.064215),
- vec4<f32>(-1.009575, 0.934207, -0.120383, -0.243756),
- vec4<f32>(-0.054562, 0.123804, 0.004157, 0.120289),
- vec4<f32>(-0.504099, 0.696545, -0.850290, 0.493131),
- vec4<f32>(-0.090043, -0.020600, -1.148702, 0.129289),
- vec4<f32>(0.302269, -0.662429, 0.315052, -0.276341),
- vec4<f32>(-0.084626, -0.029208, -0.799132, 0.158290),
- vec4<f32>(0.318365, 2.531235, 0.349606, 0.231242),
- vec4<f32>(0.053525, -0.031474, -0.570432, -0.064215),
- vec4<f32>(-0.635031, 0.498836, 0.009884, -0.465079),
- vec4<f32>(0.059087, 0.038415, 0.009928, 0.120289),
- vec4<f32>(-0.522592, -3.781285, 0.418296, -0.608186),
- vec4<f32>(0.100879, -0.083891, 1.653884, 0.129289),
- vec4<f32>(0.258571, 2.590279, 0.221239, -0.143175),
- vec4<f32>(0.121409, -0.084177, -1.397735, 0.158290),
- vec4<f32>(0.907284, -0.034063, 0.573987, -0.125626),
- vec4<f32>(-0.017610, -0.059485, -0.242599, -0.064215),
- vec4<f32>(-0.748146, 0.686047, -0.074510, -0.248879),
- vec4<f32>(-0.034986, -0.121423, -0.406087, 0.120289),
- vec4<f32>(-0.559352, -2.921763, -0.718019, -0.764524),
- vec4<f32>(0.165658, 0.097044, 0.773885, 0.129289),
- vec4<f32>(0.006276, -0.801820, 0.215264, 0.115919),
- vec4<f32>(0.081513, -0.023028, -0.590423, 0.158290),
- vec4<f32>(-0.207850, 0.088171, -0.173170, 0.351969),
- vec4<f32>(-0.042732, -0.024059, -0.087492, -0.064215),
- vec4<f32>(-0.711148, 0.312318, -0.145549, -0.113749),
- vec4<f32>(0.053038, 0.093166, -0.473856, 0.120289),
- vec4<f32>(-0.343481, -0.137305, -0.340862, 0.445920),
- vec4<f32>(-0.070473, -0.024914, -0.735660, 0.129289),
- vec4<f32>(0.212955, -0.200508, 0.105125, -0.165284),
- vec4<f32>(-0.123633, 0.052941, 0.099918, 0.158290),
- vec4<f32>(0.362468, -0.709693, 0.281097, -0.155976),
- vec4<f32>(-0.034566, 0.002014, 0.443026, -0.064215),
- vec4<f32>(-0.346208, 1.179972, -0.563868, -0.424647),
- vec4<f32>(0.012676, -0.023351, -0.703819, 0.120289),
- vec4<f32>(-0.476282, -0.001002, -0.456911, -0.143433),
- vec4<f32>(0.061018, -0.051173, -0.992671, 0.129289),
- vec4<f32>(0.340925, -0.869046, 0.333377, -0.070414),
- vec4<f32>(0.022279, 0.022837, -0.389711, 0.158290),
- vec4<f32>(0.217347, -0.092030, -0.004346, 0.209850),
- vec4<f32>(-0.116637, -0.096003, -0.333961, -0.064215),
- vec4<f32>(-0.105262, 0.443411, -0.443104, 0.032732),
- vec4<f32>(0.014939, 0.058855, -0.723723, 0.120289),
- vec4<f32>(-0.598907, -0.166341, -0.635385, 0.463685),
- vec4<f32>(0.151976, 0.049510, 0.155364, 0.129289),
- vec4<f32>(0.138981, -0.109141, 0.272429, 0.190495),
- vec4<f32>(-0.005729, 0.020860, -0.062157, 0.158290)
-);
-
-const weights_layer2: array<vec4<f32>, 18> = array(
- vec4<f32>(0.043207, -0.056041, 0.131565, 0.116278),
- vec4<f32>(-0.038849, -0.028105, -0.112979, 0.023741),
- vec4<f32>(-0.010112, -0.085145, 0.257510, 0.245113),
- vec4<f32>(0.041108, 0.049255, -0.082008, 0.023741),
- vec4<f32>(0.012368, -0.035856, 0.018924, 0.174452),
- vec4<f32>(0.052554, 0.039427, -0.279445, 0.023741),
- vec4<f32>(-0.160061, -0.232735, 0.256951, 0.208887),
- vec4<f32>(-0.088352, 0.100106, 0.103566, 0.023741),
- vec4<f32>(-0.406607, -1.336396, 0.454171, 0.310834),
- vec4<f32>(-0.061166, 0.105463, 1.572779, 0.023741),
- vec4<f32>(-0.188413, -0.523344, 0.082813, 0.209113),
- vec4<f32>(0.052509, -0.069748, -0.065008, 0.023741),
- vec4<f32>(-0.124016, 0.005237, 0.177859, 0.138953),
- vec4<f32>(0.072167, 0.070582, -0.209545, 0.023741),
- vec4<f32>(-0.384457, -0.186386, 0.273595, 0.235457),
- vec4<f32>(-0.032392, -0.086899, -0.006561, 0.023741),
- vec4<f32>(-0.195800, 0.017395, 0.023080, 0.181437),
- vec4<f32>(-0.035524, -0.095398, -0.204917, 0.023741)
-);
-
diff --git a/workspaces/main/shaders/cnn_v2/cnn_v2_compute.wgsl b/workspaces/main/shaders/cnn_v2/cnn_v2_compute.wgsl
deleted file mode 100644
index cdbfd74..0000000
--- a/workspaces/main/shaders/cnn_v2/cnn_v2_compute.wgsl
+++ /dev/null
@@ -1,143 +0,0 @@
-// CNN v2 Compute Shader - Uniform 12D→4D Architecture
-// All layers: input/previous (4D) + static (8D) = 12D → 4 channels
-// Storage buffer weights, ping-pong execution
-// Per-layer kernel sizes supported via LayerParams
-
-// Push constants for layer parameters (passed per dispatch)
-struct LayerParams {
- kernel_size: u32,
- in_channels: u32,
- out_channels: u32,
- weight_offset: u32, // Offset in f16 units
- is_output_layer: u32, // 1 if final layer (sigmoid), 0 otherwise (relu)
- blend_amount: f32, // [0,1] blend with original
- is_layer_0: u32, // 1 if first layer (clamp [0,1]), 0 otherwise
-}
-
-@group(0) @binding(0) var static_features: texture_2d<u32>; // 8D static features (p0-p3 + spatial)
-@group(0) @binding(1) var layer_input: texture_2d<u32>; // 4D previous/input (RGBD or prev layer)
-@group(0) @binding(2) var output_tex: texture_storage_2d<rgba32uint, write>; // 4D output
-@group(0) @binding(3) var<storage, read> weights_buffer: array<u32>; // Packed f16 weights
-@group(0) @binding(4) var<uniform> params: LayerParams;
-@group(0) @binding(5) var original_input: texture_2d<f32>; // Original RGB for blending
-
-fn unpack_static_features(coord: vec2<i32>) -> array<f32, 8> {
- let packed = textureLoad(static_features, coord, 0);
- let v0 = unpack2x16float(packed.x);
- let v1 = unpack2x16float(packed.y);
- let v2 = unpack2x16float(packed.z);
- let v3 = unpack2x16float(packed.w);
- return array<f32, 8>(v0.x, v0.y, v1.x, v1.y, v2.x, v2.y, v3.x, v3.y);
-}
-
-fn unpack_layer_channels(coord: vec2<i32>) -> vec4<f32> {
- let packed = textureLoad(layer_input, coord, 0);
- let v0 = unpack2x16float(packed.x);
- let v1 = unpack2x16float(packed.y);
- return vec4<f32>(v0.x, v0.y, v1.x, v1.y);
-}
-
-fn pack_channels(values: vec4<f32>) -> vec4<u32> {
- return vec4<u32>(
- pack2x16float(vec2<f32>(values.x, values.y)),
- pack2x16float(vec2<f32>(values.z, values.w)),
- 0u, // Unused
- 0u // Unused
- );
-}
-
-// Get weight from storage buffer (f16 packed as u32 pairs)
-// Buffer layout: [header: 4 u32][layer_info: N×5 u32][weights: packed f16]
-// TODO: Support 8-bit quantized weights (4× per u32) for 2× size reduction
-fn get_weight(idx: u32) -> f32 {
- // Skip header (16 bytes = 4 u32) and layer info
- // Weights start after header + layer_info, but weight_offset already accounts for this
- let pair_idx = idx / 2u;
- let packed = weights_buffer[pair_idx];
- let unpacked = unpack2x16float(packed);
- return select(unpacked.y, unpacked.x, (idx & 1u) == 0u);
-}
-
-@compute @workgroup_size(8, 8)
-fn main(@builtin(global_invocation_id) id: vec3<u32>) {
- let coord = vec2<i32>(id.xy);
- let dims = textureDimensions(static_features);
-
- if (coord.x >= i32(dims.x) || coord.y >= i32(dims.y)) {
- return;
- }
-
- let kernel_size = params.kernel_size;
- let in_channels = params.in_channels; // Always 12 (4 prev + 8 static)
- let out_channels = params.out_channels; // Always 4
- let weight_offset = params.weight_offset;
- let is_output = params.is_output_layer != 0u;
-
- let kernel_radius = i32(kernel_size / 2u);
-
- // Load static features (8D) and previous/input layer (4D)
- let static_feat = unpack_static_features(coord);
-
- // Convolution: 12D input → 4D output
- var output: vec4<f32> = vec4<f32>(0.0);
- for (var c: u32 = 0u; c < 4u; c++) {
- var sum: f32 = 0.0;
-
- // Convolve over kernel
- for (var ky: i32 = -kernel_radius; ky <= kernel_radius; ky++) {
- for (var kx: i32 = -kernel_radius; kx <= kernel_radius; kx++) {
- let sample_coord = coord + vec2<i32>(kx, ky);
-
- // Border handling (clamp)
- let clamped = vec2<i32>(
- clamp(sample_coord.x, 0, i32(dims.x) - 1),
- clamp(sample_coord.y, 0, i32(dims.y) - 1)
- );
-
- // Load features at this spatial location
- let static_local = unpack_static_features(clamped);
- let layer_local = unpack_layer_channels(clamped); // 4D
-
- // Weight index calculation
- let ky_idx = u32(ky + kernel_radius);
- let kx_idx = u32(kx + kernel_radius);
- let spatial_idx = ky_idx * kernel_size + kx_idx;
-
- // Accumulate: previous/input channels (4D)
- for (var i: u32 = 0u; i < 4u; i++) {
- let w_idx = weight_offset +
- c * 12u * kernel_size * kernel_size +
- i * kernel_size * kernel_size + spatial_idx;
- sum += get_weight(w_idx) * layer_local[i];
- }
-
- // Accumulate: static features (8D)
- for (var i: u32 = 0u; i < 8u; i++) {
- let w_idx = weight_offset +
- c * 12u * kernel_size * kernel_size +
- (4u + i) * kernel_size * kernel_size + spatial_idx;
- sum += get_weight(w_idx) * static_local[i];
- }
- }
- }
-
- // Activation (matches train_cnn_v2.py)
- if (is_output || params.is_layer_0 != 0u) {
- output[c] = 1.0 / (1.0 + exp(-sum)); // Sigmoid [0,1]
- } else {
- output[c] = max(0.0, sum); // ReLU
- }
- }
-
- // Blend with original on final layer
- if (is_output) {
- let original = textureLoad(original_input, coord, 0).rgb;
- let result_rgb = vec3<f32>(output.x, output.y, output.z);
- let blended = mix(original, result_rgb, params.blend_amount);
- output.x = blended.r;
- output.y = blended.g;
- output.z = blended.b;
- }
-
- textureStore(output_tex, coord, pack_channels(output));
-}
diff --git a/workspaces/main/shaders/cnn_v2/cnn_v2_layer_0.wgsl b/workspaces/main/shaders/cnn_v2/cnn_v2_layer_0.wgsl
deleted file mode 100644
index 8e14957..0000000
--- a/workspaces/main/shaders/cnn_v2/cnn_v2_layer_0.wgsl
+++ /dev/null
@@ -1,174 +0,0 @@
-// CNN v2 Layer 0 - Auto-generated
-// Kernel: 3×3, In: 8, Out: 8
-
-const KERNEL_SIZE: u32 = 3u;
-const IN_CHANNELS: u32 = 8u;
-const OUT_CHANNELS: u32 = 8u;
-const KERNEL_RADIUS: i32 = 1;
-
-// Weights quantized to float16 (stored as f32 in WGSL)
-const weights: array<f32, 576> = array(
- 0.057281, -0.041962, 0.003933, 0.026459, 0.304199, 0.067261, 0.191895, 0.047455,
- 0.074402, 0.201660, 0.158325, 0.150513, 0.219238, 0.260010, 0.319336, 0.208618,
- 0.050201, 0.090210, 0.086853, 0.181152, 0.060486, 0.167847, 0.161499, 0.265869,
- 0.163818, 0.100647, 0.243408, -0.008553, -0.010849, 0.046509, -0.060608, -0.022263,
- 0.094360, -0.043854, -0.005329, -0.093262, 0.032349, 0.007259, 0.039948, -0.018692,
- -0.000618, 0.052368, -0.038055, 0.118042, -0.084595, 0.044281, -0.107056, 0.089478,
- -0.076477, 0.017441, 0.088135, 0.076721, -0.063965, 0.001612, 0.062469, 0.067505,
- 0.035736, 0.115051, -0.117737, -0.076843, -0.008888, -0.002028, -0.061005, 0.081726,
- 0.115051, -0.028183, 0.043213, -0.079285, -0.040314, -0.047699, -0.051575, -0.052521,
- 0.071533, 0.084656, 0.051910, 0.090637, -0.104248, -0.066467, -0.032104, -0.006977,
- 0.075439, -0.004841, 0.084656, -0.034698, 0.035675, -0.101929, -0.035034, -0.036804,
- 0.069641, -0.026840, -0.017807, -0.088318, -0.125000, -0.042847, -0.003063, 0.007622,
- 0.076416, 0.094971, -0.019058, 0.083496, -0.085205, 0.036285, -0.077209, 0.082458,
- 0.056549, 0.038818, 0.092224, -0.002499, 0.069641, 0.097229, 0.069275, -0.111084,
- -0.092041, -0.020462, -0.061279, -0.032196, -0.088623, 0.032227, -0.117004, -0.125854,
- -0.015884, 0.093018, -0.070923, -0.117615, -0.081848, -0.115479, 0.033508, -0.026443,
- -0.009850, -0.063232, 0.098328, -0.000984, 0.039886, -0.085754, -0.108826, 0.030258,
- 0.091675, 0.024384, -0.118958, -0.077148, -0.122437, -0.002090, -0.089539, 0.096741,
- 0.095337, 0.108582, -0.101807, 0.152222, 0.206177, 0.050323, -0.111450, -0.104431,
- -0.037445, 0.276611, 0.244019, 0.171143, 0.131592, 0.056030, 0.141602, 0.014267,
- -0.025955, -0.019730, 0.155884, 0.072144, 0.176636, -0.010117, 0.141724, 0.103027,
- -0.253174, -0.229370, -0.105713, -0.005898, 0.075439, -0.002014, -0.010506, -0.108093,
- -0.016724, 0.108215, 0.053589, -0.044586, 0.030396, -0.077759, 0.058594, -0.018463,
- 0.027100, 0.030823, -0.026947, -0.014084, 0.121643, 0.116638, -0.010239, 0.106262,
- -0.109070, -0.044281, -0.045319, -0.021942, 0.083923, 0.114929, 0.154541, 0.078186,
- -0.047394, 0.007957, 0.099182, -0.030075, 0.103699, 0.080994, -0.085144, 0.047180,
- 0.099792, 0.081116, 0.084961, 0.151123, 0.000963, 0.029221, 0.073181, 0.086609,
- 0.149048, -0.052185, -0.158936, 0.146240, 0.020004, 0.063110, 0.111877, 0.037201,
- 0.087585, 0.134277, 0.058258, -0.075256, 0.141357, 0.045776, 0.171753, 0.186035,
- 0.093201, 0.202637, 0.018723, -0.047638, 0.072510, 0.132812, 0.182251, 0.191650,
- 0.163818, 0.146362, 0.124451, -0.082214, 0.094482, -0.007275, 0.029099, -0.040314,
- -0.017624, -0.018860, -0.108398, -0.111145, 0.058289, -0.106995, -0.091919, 0.069824,
- -0.084045, -0.105957, 0.065002, -0.012894, 0.042297, -0.081299, -0.112976, 0.012314,
- 0.015625, -0.100708, -0.039673, 0.092041, 0.037201, 0.089722, 0.064087, 0.000403,
- 0.120667, -0.012238, -0.055695, 0.010620, -0.022110, -0.008751, 0.038605, 0.075256,
- 0.041260, 0.128296, -0.072021, 0.020828, -0.072449, 0.051239, 0.034058, 0.122803,
- -0.062103, 0.156006, -0.111633, 0.043671, 0.209229, 0.006088, 0.141968, 0.209961,
- 0.122620, -0.004547, 0.107727, 0.115601, 0.003378, 0.375732, 0.068481, 0.037842,
- 0.159546, -0.014450, 0.073425, 0.168701, -0.052643, 0.060699, 0.333740, 0.033905,
- -0.060150, 0.053558, 0.165527, -0.052460, -0.047882, 0.080750, 0.110352, -0.057098,
- 0.057983, -0.018692, 0.019714, -0.056427, -0.053314, -0.001763, 0.027039, 0.003395,
- -0.131226, -0.068481, -0.086609, 0.065186, 0.084717, 0.036530, 0.043488, 0.013893,
- -0.076660, 0.081177, 0.037476, -0.124084, -0.070312, -0.027130, -0.009331, -0.128174,
- -0.075256, 0.098206, -0.046539, -0.045319, 0.083923, -0.050598, 0.063477, 0.007408,
- 0.026794, -0.090454, -0.083435, 0.129761, 0.044556, 0.051849, 0.115662, 0.071167,
- 0.004414, 0.048035, -0.148682, 0.098938, 0.200562, 0.111938, 0.208496, 0.200684,
- -0.050262, 0.119568, 0.062988, 0.072083, 0.123779, 0.369629, 0.317627, 0.187622,
- 0.157227, 0.183960, 0.031921, 0.142944, 0.080627, 0.218628, 0.264160, 0.156128,
- 0.084961, 0.029343, 0.057617, 0.089233, 0.041138, 0.044373, 0.074707, 0.025818,
- 0.113708, -0.045380, -0.114929, 0.104370, -0.012238, -0.174194, -0.169312, -0.070312,
- -0.005863, 0.027481, 0.053345, -0.016006, -0.057953, -0.010284, 0.034241, -0.041077,
- -0.002373, 0.034515, 0.078552, -0.066162, -0.035400, 0.072510, 0.060425, -0.037720,
- -0.025955, 0.118042, -0.071777, 0.133667, 0.012192, -0.080933, 0.093445, 0.052826,
- -0.037354, -0.052277, 0.124084, 0.029861, 0.137085, 0.053009, -0.034180, -0.011421,
- 0.089233, 0.172729, 0.146118, 0.003944, 0.279541, 0.162842, 0.112244, 0.204956,
- 0.059753, 0.117737, 0.330322, 0.185547, 0.194946, 0.404541, 0.274658, 0.177612,
- 0.153320, 0.189575, 0.032257, 0.285400, 0.158203, 0.048035, 0.476562, 0.301025,
- -0.179565, 0.160767, 0.137207, 0.102478, -0.060547, 0.060364, -0.091858, 0.064209,
- 0.082642, 0.044769, -0.096436, -0.103699, -0.021683, 0.007221, -0.048737, 0.071228,
- -0.069580, 0.066528, -0.122864, -0.008415, -0.094788, 0.040131, -0.091431, -0.029602,
- -0.112488, -0.074158, -0.004898, -0.006721, -0.118286, -0.047516, 0.069519, 0.121521,
- -0.004158, 0.167603, -0.092468, -0.049927, 0.006599, 0.097595, 0.064087, 0.083435,
- 0.026993, 0.071411, 0.020538, 0.022293, 0.022858, 0.124268, 0.098999, -0.031738,
- 0.019806, -0.087341, -0.096558, -0.099304, -0.113159, 0.021744, -0.080200, -0.056030,
- 0.089661, -0.055115, -0.115845, -0.040222, 0.035919, 0.027832, 0.034668, 0.072632,
- 0.071838, -0.081116, 0.050262, -0.037872, 0.054047, -0.096680, -0.102051, -0.044281,
- 0.078796, -0.095154, -0.013229, 0.031555, -0.058533, -0.114441, -0.008530, 0.112732,
- -0.057251, 0.096191, -0.008385, 0.052246, -0.016983, 0.092041, 0.013710, 0.012299,
- -0.109497, 0.025604, -0.121643, -0.023819, 0.039490, -0.090088, -0.013145, -0.101562,
- -0.115051, 0.050232, -0.047119, -0.055847, -0.017563, 0.103760, 0.116333, -0.061768,
- -0.083069, -0.030319, 0.078003, -0.010124, 0.044617, -0.045868, 0.103638, 0.032379,
- -0.093506, -0.048004, -0.022079, -0.004353, -0.048187, -0.025330, -0.070740, -0.014671
-);
-
-@group(0) @binding(0) var static_features: texture_2d<u32>;
-@group(0) @binding(1) var layer_input: texture_2d<u32>;
-@group(0) @binding(2) var output_tex: texture_storage_2d<rgba32uint, write>;
-
-fn unpack_static_features(coord: vec2<i32>) -> array<f32, 8> {
- let packed = textureLoad(static_features, coord, 0);
- let v0 = unpack2x16float(packed.x);
- let v1 = unpack2x16float(packed.y);
- let v2 = unpack2x16float(packed.z);
- let v3 = unpack2x16float(packed.w);
- return array<f32, 8>(v0.x, v0.y, v1.x, v1.y, v2.x, v2.y, v3.x, v3.y);
-}
-
-fn unpack_layer_channels(coord: vec2<i32>) -> array<f32, 8> {
- let packed = textureLoad(layer_input, coord, 0);
- let v0 = unpack2x16float(packed.x);
- let v1 = unpack2x16float(packed.y);
- let v2 = unpack2x16float(packed.z);
- let v3 = unpack2x16float(packed.w);
- return array<f32, 8>(v0.x, v0.y, v1.x, v1.y, v2.x, v2.y, v3.x, v3.y);
-}
-
-fn pack_channels(values: array<f32, 8>) -> vec4<u32> {
- return vec4<u32>(
- pack2x16float(vec2<f32>(values[0], values[1])),
- pack2x16float(vec2<f32>(values[2], values[3])),
- pack2x16float(vec2<f32>(values[4], values[5])),
- pack2x16float(vec2<f32>(values[6], values[7]))
- );
-}
-
-@compute @workgroup_size(8, 8)
-fn main(@builtin(global_invocation_id) id: vec3<u32>) {
- let coord = vec2<i32>(id.xy);
- let dims = textureDimensions(static_features);
-
- if (coord.x >= i32(dims.x) || coord.y >= i32(dims.y)) {
- return;
- }
-
- // Load static features (always available)
- let static_feat = unpack_static_features(coord);
-
- // Convolution
- var output: array<f32, OUT_CHANNELS>;
- for (var c: u32 = 0u; c < OUT_CHANNELS; c++) {
- var sum: f32 = 0.0;
-
- for (var ky: i32 = -KERNEL_RADIUS; ky <= KERNEL_RADIUS; ky++) {
- for (var kx: i32 = -KERNEL_RADIUS; kx <= KERNEL_RADIUS; kx++) {
- let sample_coord = coord + vec2<i32>(kx, ky);
-
- // Border handling (clamp)
- let clamped = vec2<i32>(
- clamp(sample_coord.x, 0, i32(dims.x) - 1),
- clamp(sample_coord.y, 0, i32(dims.y) - 1)
- );
-
- // Load input features
- let static_local = unpack_static_features(clamped);
- let layer_local = unpack_layer_channels(clamped);
-
- // Weight index calculation
- let ky_idx = u32(ky + KERNEL_RADIUS);
- let kx_idx = u32(kx + KERNEL_RADIUS);
- let spatial_idx = ky_idx * KERNEL_SIZE + kx_idx;
-
- // Accumulate: static features (8D)
- for (var i: u32 = 0u; i < 8u; i++) {
- let w_idx = c * IN_CHANNELS * KERNEL_SIZE * KERNEL_SIZE +
- i * KERNEL_SIZE * KERNEL_SIZE + spatial_idx;
- sum += weights[w_idx] * static_local[i];
- }
-
- // Accumulate: layer input channels (if layer_idx > 0)
- let prev_channels = IN_CHANNELS - 8u;
- for (var i: u32 = 0u; i < prev_channels; i++) {
- let w_idx = c * IN_CHANNELS * KERNEL_SIZE * KERNEL_SIZE +
- (8u + i) * KERNEL_SIZE * KERNEL_SIZE + spatial_idx;
- sum += weights[w_idx] * layer_local[i];
- }
- }
- }
-
- output[c] = max(0.0, sum); // ReLU
- }
-
- // Pack and store
- textureStore(output_tex, coord, pack_channels(output));
-}
diff --git a/workspaces/main/shaders/cnn_v2/cnn_v2_layer_1.wgsl b/workspaces/main/shaders/cnn_v2/cnn_v2_layer_1.wgsl
deleted file mode 100644
index f490d13..0000000
--- a/workspaces/main/shaders/cnn_v2/cnn_v2_layer_1.wgsl
+++ /dev/null
@@ -1,174 +0,0 @@
-// CNN v2 Layer 1 - Auto-generated
-// Kernel: 3×3, In: 16, Out: 4
-
-const KERNEL_SIZE: u32 = 3u;
-const IN_CHANNELS: u32 = 16u;
-const OUT_CHANNELS: u32 = 4u;
-const KERNEL_RADIUS: i32 = 1;
-
-// Weights quantized to float16 (stored as f32 in WGSL)
-const weights: array<f32, 576> = array(
- 0.337402, 0.638672, -0.481201, 0.699707, 1.127930, -0.018280, -0.062195, 0.148682,
- -0.655273, 0.448975, 0.969238, -0.280762, 0.817383, 1.271484, 0.421387, -0.163696,
- 0.305664, -0.454834, 0.354004, 0.932617, -0.411377, 0.581543, 1.263672, 0.422363,
- -0.380371, 0.152588, -0.668945, -0.063782, 0.060730, 0.022018, -0.075195, -0.049286,
- 0.068542, 0.057343, -0.009773, 0.006344, -0.080872, -0.179932, -0.297119, 0.098328,
- 0.061951, -0.088989, 0.047913, 0.093628, -0.091858, -0.068298, 0.102600, -0.044067,
- -0.054230, -0.031799, 0.050934, -0.300049, -0.202637, -0.203613, -0.294189, -0.361084,
- 0.277344, -0.213257, -0.239624, 0.193237, -0.215210, -0.295166, 0.298828, -0.065369,
- 0.148926, 0.024963, 0.272705, 0.368164, 0.173096, 0.061279, 0.291260, 0.151611,
- 0.411133, 0.216431, -0.179932, 0.506348, 0.319580, 0.059875, -0.134399, -0.150635,
- -0.275391, 0.029480, 0.115417, 0.063782, 0.018723, -0.073364, -0.019653, 0.066467,
- -0.086731, 0.113220, 0.110535, 0.011940, -0.094727, 0.262207, 0.180298, 0.141357,
- 0.249634, 0.199585, 0.120605, 0.403809, 0.242676, -0.028442, 0.251953, 0.130737,
- 0.152832, -0.306396, -0.324951, -0.176514, 0.161133, 0.333252, -0.195068, 0.250244,
- 0.569824, 0.011223, -0.186035, 0.048279, -0.325439, 0.272217, 0.144043, -0.142700,
- 0.447754, 0.434082, 0.124878, -0.157471, -0.120422, -0.281494, 0.338135, 0.266113,
- -0.301514, 0.424805, 0.541504, -0.195679, 0.054962, 0.061798, -0.323975, 0.056732,
- 0.072571, -0.087341, 0.052856, -0.057220, 0.023270, 0.071472, 0.014038, 0.083008,
- -0.050659, 0.020111, 0.035614, -0.038086, -0.042786, 0.060242, -0.050079, -0.044403,
- -0.059631, 0.075500, 0.056000, 0.010910, -0.064026, -0.016037, -0.050720, 0.050171,
- -0.075256, -0.014183, 0.047058, -0.086731, 0.027939, 0.063232, -0.024597, -0.039551,
- 0.000622, -0.048370, -0.001906, 0.058868, -0.074524, 0.019714, -0.036011, 0.028442,
- 0.009766, -0.060577, -0.007416, -0.014381, 0.002317, -0.023483, 0.014313, 0.057434,
- 0.063110, 0.030350, -0.027557, 0.023270, 0.055115, -0.003502, 0.012268, -0.054993,
- -0.084961, -0.022736, 0.076233, 0.027573, -0.068787, -0.036987, -0.018539, -0.049347,
- 0.032227, 0.033081, 0.050476, 0.043030, 0.023636, -0.039764, -0.018600, 0.073669,
- 0.032166, -0.047119, -0.033325, -0.038605, 0.034119, -0.076843, 0.005863, -0.049103,
- 0.065796, -0.056458, 0.054504, -0.008354, -0.018509, -0.057739, -0.075684, -0.053680,
- 0.036804, 0.020721, -0.056183, 0.021774, -0.043884, 0.033661, -0.029633, 0.027374,
- -0.087891, 0.030853, -0.040070, 0.013733, -0.082275, -0.072571, -0.055756, 0.002262,
- 0.004421, -0.012169, -0.078064, -0.063904, -0.051758, -0.033264, -0.059265, -0.062256,
- 0.063782, -0.088745, -0.026855, 0.062805, -0.036591, 0.037659, -0.012970, 0.025513,
- -0.000908, 0.027084, 0.001842, -0.080750, -0.049713, -0.069397, -0.046448, -0.031006,
- 0.012543, 0.009369, -0.080139, -0.034363, 0.003361, -0.052704, 0.041870, 0.059265,
- 0.029938, 0.000138, 0.049896, 0.068787, 0.040405, -0.073608, 0.047668, 0.015320,
- -0.033203, -0.016983, 0.034149, -0.010323, 0.029877, 0.078003, -0.054688, -0.021805,
- -0.019409, 0.010284, 0.089172, -0.050385, 0.024857, -0.041992, 0.016602, 0.082397,
- 0.081970, 0.096375, 0.060760, -0.006603, 0.029907, 0.012131, 0.104980, 0.034210,
- 0.074707, -0.028320, -0.020248, 0.114868, -0.036957, 0.040192, 0.002888, 0.034973,
- -0.038635, -0.018204, -0.058563, 0.029419, 0.013344, 0.027618, 0.073669, -0.038361,
- 0.080933, 0.044586, -0.013214, 0.022675, 0.084351, 0.081848, 0.027328, 0.043915,
- 0.040771, 0.078918, 0.054443, -0.049652, 0.073547, 0.103882, 0.065918, 0.070923,
- -0.037476, -0.011215, -0.021408, 0.094727, 0.042450, 0.032806, -0.064026, 0.023941,
- 0.011780, 0.041260, -0.038818, 0.079163, 0.079468, 0.053680, 0.047150, 0.003571,
- 0.054840, 0.045929, -0.041382, -0.033539, 0.069153, 0.046234, 0.119263, -0.006340,
- -0.050323, 0.030212, 0.069092, 0.045441, 0.096313, -0.024628, -0.088745, 0.009033,
- -0.016830, 0.028534, -0.042755, -0.031921, 0.013611, -0.029251, -0.051483, -0.005848,
- -0.032837, -0.058136, 0.075989, -0.008125, 0.108765, -0.004745, -0.003422, 0.079590,
- 0.090515, -0.019196, -0.006786, 0.059479, -0.041168, 0.093445, 0.075439, -0.025055,
- 0.067139, 0.011734, 0.031586, 0.029587, 0.098267, 0.025848, 0.095276, 0.003189,
- 0.105408, 0.018799, -0.102478, 0.033813, 0.004272, 0.020477, 0.033142, 0.009727,
- -0.021393, 0.120300, 0.088684, -0.037842, -0.094177, 0.017944, 0.020126, -0.002304,
- -0.016006, 0.018112, 0.072693, -0.072021, -0.171265, -0.053528, -0.093201, 0.024124,
- -0.050476, -0.023422, -0.071167, 0.046478, 0.034607, 0.076904, 0.013077, -0.082031,
- 0.091858, -0.001575, 0.083801, 0.078003, 0.019119, -0.004967, 0.027298, 0.027740,
- 0.032623, 0.048370, 0.029099, 0.093201, 0.049957, -0.007191, 0.059631, 0.008659,
- 0.042725, -0.009369, 0.089417, 0.074951, -0.024704, 0.005344, 0.123840, 0.080322,
- 0.096375, 0.070312, -0.010399, 0.033203, -0.009743, -0.030045, -0.039520, 0.042023,
- -0.017441, 0.073486, 0.049500, -0.039734, 0.009811, 0.093262, -0.069641, 0.099365,
- -0.010414, 0.048859, 0.099182, -0.007256, -0.023941, -0.021393, -0.005703, 0.025055,
- 0.054535, 0.093384, -0.033661, 0.073242, 0.055023, 0.037170, -0.009300, 0.048615,
- 0.019150, 0.019409, -0.080688, -0.050049, 0.104126, -0.023193, 0.044708, 0.111816,
- 0.061584, 0.042755, -0.013863, -0.008385, -0.039703, 0.070618, -0.016922, -0.040833,
- 0.051178, -0.060333, -0.004368, -0.009827, 0.051544, 0.072083, 0.068176, 0.148071,
- 0.159424, 0.017578, 0.089905, -0.006794, 0.066101, -0.051117, 0.088684, -0.002989,
- -0.066895, 0.089844, 0.012131, -0.020203, 0.011230, 0.000327, 0.073669, 0.060669,
- 0.091064, 0.075989, 0.051971, 0.045044, 0.033875, 0.040466, -0.029449, 0.128418,
- -0.000229, -0.026901, 0.052063, 0.000995, -0.032532, 0.105896, -0.001241, 0.114075,
- 0.047607, 0.090332, 0.063660, 0.016495, 0.124817, 0.090942, 0.021545, 0.007164,
- 0.074890, 0.118347, 0.047394, 0.052856, 0.104980, 0.009384, 0.034363, 0.019073,
- 0.072388, -0.013313, 0.119141, 0.021255, 0.103210, 0.058319, 0.186035, -0.010818,
- 0.037109, -0.044037, -0.075989, -0.001281, 0.017899, 0.030701, -0.080261, 0.082703
-);
-
-@group(0) @binding(0) var static_features: texture_2d<u32>;
-@group(0) @binding(1) var layer_input: texture_2d<u32>;
-@group(0) @binding(2) var output_tex: texture_storage_2d<rgba32uint, write>;
-
-fn unpack_static_features(coord: vec2<i32>) -> array<f32, 8> {
- let packed = textureLoad(static_features, coord, 0);
- let v0 = unpack2x16float(packed.x);
- let v1 = unpack2x16float(packed.y);
- let v2 = unpack2x16float(packed.z);
- let v3 = unpack2x16float(packed.w);
- return array<f32, 8>(v0.x, v0.y, v1.x, v1.y, v2.x, v2.y, v3.x, v3.y);
-}
-
-fn unpack_layer_channels(coord: vec2<i32>) -> array<f32, 8> {
- let packed = textureLoad(layer_input, coord, 0);
- let v0 = unpack2x16float(packed.x);
- let v1 = unpack2x16float(packed.y);
- let v2 = unpack2x16float(packed.z);
- let v3 = unpack2x16float(packed.w);
- return array<f32, 8>(v0.x, v0.y, v1.x, v1.y, v2.x, v2.y, v3.x, v3.y);
-}
-
-fn pack_channels(values: array<f32, 8>) -> vec4<u32> {
- return vec4<u32>(
- pack2x16float(vec2<f32>(values[0], values[1])),
- pack2x16float(vec2<f32>(values[2], values[3])),
- pack2x16float(vec2<f32>(values[4], values[5])),
- pack2x16float(vec2<f32>(values[6], values[7]))
- );
-}
-
-@compute @workgroup_size(8, 8)
-fn main(@builtin(global_invocation_id) id: vec3<u32>) {
- let coord = vec2<i32>(id.xy);
- let dims = textureDimensions(static_features);
-
- if (coord.x >= i32(dims.x) || coord.y >= i32(dims.y)) {
- return;
- }
-
- // Load static features (always available)
- let static_feat = unpack_static_features(coord);
-
- // Convolution
- var output: array<f32, OUT_CHANNELS>;
- for (var c: u32 = 0u; c < OUT_CHANNELS; c++) {
- var sum: f32 = 0.0;
-
- for (var ky: i32 = -KERNEL_RADIUS; ky <= KERNEL_RADIUS; ky++) {
- for (var kx: i32 = -KERNEL_RADIUS; kx <= KERNEL_RADIUS; kx++) {
- let sample_coord = coord + vec2<i32>(kx, ky);
-
- // Border handling (clamp)
- let clamped = vec2<i32>(
- clamp(sample_coord.x, 0, i32(dims.x) - 1),
- clamp(sample_coord.y, 0, i32(dims.y) - 1)
- );
-
- // Load input features
- let static_local = unpack_static_features(clamped);
- let layer_local = unpack_layer_channels(clamped);
-
- // Weight index calculation
- let ky_idx = u32(ky + KERNEL_RADIUS);
- let kx_idx = u32(kx + KERNEL_RADIUS);
- let spatial_idx = ky_idx * KERNEL_SIZE + kx_idx;
-
- // Accumulate: static features (8D)
- for (var i: u32 = 0u; i < 8u; i++) {
- let w_idx = c * IN_CHANNELS * KERNEL_SIZE * KERNEL_SIZE +
- i * KERNEL_SIZE * KERNEL_SIZE + spatial_idx;
- sum += weights[w_idx] * static_local[i];
- }
-
- // Accumulate: layer input channels (if layer_idx > 0)
- let prev_channels = IN_CHANNELS - 8u;
- for (var i: u32 = 0u; i < prev_channels; i++) {
- let w_idx = c * IN_CHANNELS * KERNEL_SIZE * KERNEL_SIZE +
- (8u + i) * KERNEL_SIZE * KERNEL_SIZE + spatial_idx;
- sum += weights[w_idx] * layer_local[i];
- }
- }
- }
-
- output[c] = max(0.0, sum); // ReLU
- }
-
- // Pack and store
- textureStore(output_tex, coord, pack_channels(output));
-}
diff --git a/workspaces/main/shaders/cnn_v2/cnn_v2_layer_2.wgsl b/workspaces/main/shaders/cnn_v2/cnn_v2_layer_2.wgsl
deleted file mode 100644
index 2f9836a..0000000
--- a/workspaces/main/shaders/cnn_v2/cnn_v2_layer_2.wgsl
+++ /dev/null
@@ -1,156 +0,0 @@
-// CNN v2 Layer 2 - Auto-generated
-// Kernel: 3×3, In: 12, Out: 4
-
-const KERNEL_SIZE: u32 = 3u;
-const IN_CHANNELS: u32 = 12u;
-const OUT_CHANNELS: u32 = 4u;
-const KERNEL_RADIUS: i32 = 1;
-
-// Weights quantized to float16 (stored as f32 in WGSL)
-const weights: array<f32, 432> = array(
- 0.030212, -0.041351, 0.053864, -0.025635, 0.099976, -0.016830, -0.068665, 0.112488,
- -0.069824, 0.030197, 0.020142, 0.101807, 0.061920, 0.022415, -0.025864, -0.056366,
- 0.085571, -0.053650, 0.109802, 0.129272, 0.023438, 0.087341, 0.066284, 0.037079,
- -0.067566, 0.021530, -0.046814, 0.029343, -0.028534, 0.047150, -0.079346, -0.022675,
- -0.019669, -0.024185, 0.029587, 0.068970, 0.108826, 0.050598, -0.072144, 0.083008,
- -0.002201, 0.006275, 0.056396, 0.001884, 0.097168, -0.028503, -0.002499, 0.008919,
- -0.013771, -0.017502, -0.033478, 0.105530, 0.032898, 0.068726, -0.036285, -0.021011,
- -0.018250, 0.073914, 0.024277, 0.061066, 0.008682, -0.022766, 0.074219, 0.094421,
- 0.050903, 0.072571, 0.117493, -0.033234, 0.067993, -0.008049, 0.046997, -0.064209,
- -0.381104, 0.107788, -0.213867, 0.145142, 0.514160, 0.407715, -0.317871, 0.249023,
- 0.055634, -0.006294, -0.067444, 0.025131, 0.012939, -0.074158, -0.013741, -0.033020,
- 0.026871, -0.007671, 0.089661, -0.003016, 0.029007, -0.038483, 0.045044, 0.104065,
- 0.077148, 0.092468, -0.090027, -0.048126, 0.096863, -0.088013, 0.009483, 0.075012,
- -0.076843, -0.085449, -0.066040, 0.019165, -0.019958, 0.083496, 0.069275, -0.019714,
- 0.027786, -0.042389, 0.054718, 0.010635, -0.071777, 0.029282, -0.003605, 0.113770,
- 0.080994, 0.106079, 0.047333, -0.013733, 0.034760, 0.099365, -0.020813, 0.095886,
- 0.052490, -0.049194, 0.047394, 0.072510, -0.030930, -0.003782, -0.038025, -0.019318,
- -0.047852, -0.043915, 0.026810, -0.041138, 0.038422, 0.009605, -0.080688, -0.019653,
- 0.075256, -0.013817, -0.022400, 0.050629, 0.048462, 0.072998, -0.009109, 0.070923,
- 0.079895, 0.071350, 0.002869, 0.081543, 0.037231, 0.020767, -0.017929, 0.042328,
- -0.075134, -0.010681, -0.009079, 0.057007, -0.040253, -0.025574, -0.041534, 0.105835,
- -0.039703, 0.032104, 0.076050, 0.070923, -0.013046, -0.054108, -0.024582, -0.033997,
- 0.092285, 0.000525, 0.114685, 0.036926, -0.419434, 0.087891, -0.187866, 0.128906,
- 0.665527, 0.268311, -0.337891, 0.195557, 0.140503, 0.014465, -0.043671, 0.031677,
- 0.073059, 0.085144, 0.014290, -0.046967, 0.033356, 0.004177, 0.102844, 0.015259,
- 0.026627, -0.005032, 0.111694, -0.010590, 0.029816, 0.108154, -0.072327, 0.056213,
- 0.022903, 0.053772, 0.084473, -0.059845, -0.032776, -0.000015, -0.093872, -0.085815,
- 0.081604, 0.069336, 0.034149, -0.067322, -0.020859, 0.120911, 0.077209, -0.016388,
- 0.050140, -0.045563, -0.046326, 0.032623, -0.005009, 0.008003, 0.109192, 0.086548,
- 0.096558, 0.118530, 0.035034, 0.110352, -0.041748, 0.009178, 0.049957, 0.084839,
- 0.042053, -0.069153, -0.024796, -0.094604, -0.047028, -0.053802, 0.024979, 0.049591,
- -0.016373, -0.047607, -0.008797, -0.058868, 0.107178, 0.055695, 0.092407, 0.092346,
- 0.053894, 0.054657, -0.039703, -0.073792, 0.041779, -0.044159, 0.099182, 0.037109,
- 0.097778, 0.098206, -0.057831, -0.054016, -0.068604, -0.061584, -0.054382, 0.005268,
- 0.096008, -0.007118, -0.063049, 0.059113, 0.076904, 0.045288, -0.055695, -0.052612,
- -0.022110, 0.049103, 0.095276, 0.014572, 0.064819, 0.014671, 0.029800, 0.066284,
- -0.383301, 0.071838, -0.207275, 0.099365, 0.640137, 0.393311, -0.334229, 0.275391,
- -0.013977, -0.025269, -0.007065, -0.033478, -0.017349, 0.026764, 0.005192, 0.093384,
- 0.014313, 0.018906, 0.006962, 0.094849, 0.005390, 0.101624, -0.041199, 0.026245,
- 0.027588, 0.062408, 0.033356, -0.010826, 0.067993, -0.054199, 0.076416, 0.023315,
- -0.002886, -0.112061, -0.041473, -0.012703, 0.016022, 0.010506, -0.021362, -0.037750,
- 0.062927, 0.061920, 0.038177, -0.037201, -0.011620, 0.014015, -0.062164, -0.045441,
- -0.063416, -0.040100, 0.035950, 0.045563, -0.017227, -0.060547, -0.017593, 0.111877,
- 0.121521, 0.073853, 0.023331, -0.012428, 0.018478, -0.010948, 0.030716, 0.043427,
- 0.003117, -0.069092, 0.038361, -0.053497, 0.039154, -0.085754, 0.012642, -0.051208,
- 0.022934, 0.127197, 0.117920, 0.074036, 0.083313, -0.061951, 0.079224, 0.091248,
- 0.009132, 0.069946, 0.123474, 0.130127, 0.118835, 0.020874, -0.045380, -0.000111,
- 0.111206, 0.054688, 0.008995, 0.085693, 0.005562, 0.103088, -0.034698, 0.119934,
- -0.067200, 0.065430, -0.021942, 0.089783, 0.033112, -0.025467, 0.040161, -0.052155,
- -0.048920, 0.031250, 0.112549, 0.122192, 0.126587, 0.180908, 0.194946, 0.121704,
- 0.217529, 0.224243, 0.269287, 0.222656, 0.288086, 0.035492, 0.066711, -0.046600,
- 0.085144, 0.013855, -0.065979, -0.083252, -0.058289, 0.104126, 0.013702, -0.018188,
- 0.036591, 0.099854, 0.056061, 0.151855, 0.062134, 0.133789, 0.084045, 0.095825,
- 0.036987, 0.022308, 0.070923, 0.031036, 0.101868, 0.062347, 0.141235, 0.066650
-);
-
-@group(0) @binding(0) var static_features: texture_2d<u32>;
-@group(0) @binding(1) var layer_input: texture_2d<u32>;
-@group(0) @binding(2) var output_tex: texture_storage_2d<rgba32uint, write>;
-
-fn unpack_static_features(coord: vec2<i32>) -> array<f32, 8> {
- let packed = textureLoad(static_features, coord, 0);
- let v0 = unpack2x16float(packed.x);
- let v1 = unpack2x16float(packed.y);
- let v2 = unpack2x16float(packed.z);
- let v3 = unpack2x16float(packed.w);
- return array<f32, 8>(v0.x, v0.y, v1.x, v1.y, v2.x, v2.y, v3.x, v3.y);
-}
-
-fn unpack_layer_channels(coord: vec2<i32>) -> array<f32, 8> {
- let packed = textureLoad(layer_input, coord, 0);
- let v0 = unpack2x16float(packed.x);
- let v1 = unpack2x16float(packed.y);
- let v2 = unpack2x16float(packed.z);
- let v3 = unpack2x16float(packed.w);
- return array<f32, 8>(v0.x, v0.y, v1.x, v1.y, v2.x, v2.y, v3.x, v3.y);
-}
-
-fn pack_channels(values: array<f32, 8>) -> vec4<u32> {
- return vec4<u32>(
- pack2x16float(vec2<f32>(values[0], values[1])),
- pack2x16float(vec2<f32>(values[2], values[3])),
- pack2x16float(vec2<f32>(values[4], values[5])),
- pack2x16float(vec2<f32>(values[6], values[7]))
- );
-}
-
-@compute @workgroup_size(8, 8)
-fn main(@builtin(global_invocation_id) id: vec3<u32>) {
- let coord = vec2<i32>(id.xy);
- let dims = textureDimensions(static_features);
-
- if (coord.x >= i32(dims.x) || coord.y >= i32(dims.y)) {
- return;
- }
-
- // Load static features (always available)
- let static_feat = unpack_static_features(coord);
-
- // Convolution
- var output: array<f32, OUT_CHANNELS>;
- for (var c: u32 = 0u; c < OUT_CHANNELS; c++) {
- var sum: f32 = 0.0;
-
- for (var ky: i32 = -KERNEL_RADIUS; ky <= KERNEL_RADIUS; ky++) {
- for (var kx: i32 = -KERNEL_RADIUS; kx <= KERNEL_RADIUS; kx++) {
- let sample_coord = coord + vec2<i32>(kx, ky);
-
- // Border handling (clamp)
- let clamped = vec2<i32>(
- clamp(sample_coord.x, 0, i32(dims.x) - 1),
- clamp(sample_coord.y, 0, i32(dims.y) - 1)
- );
-
- // Load input features
- let static_local = unpack_static_features(clamped);
- let layer_local = unpack_layer_channels(clamped);
-
- // Weight index calculation
- let ky_idx = u32(ky + KERNEL_RADIUS);
- let kx_idx = u32(kx + KERNEL_RADIUS);
- let spatial_idx = ky_idx * KERNEL_SIZE + kx_idx;
-
- // Accumulate: static features (8D)
- for (var i: u32 = 0u; i < 8u; i++) {
- let w_idx = c * IN_CHANNELS * KERNEL_SIZE * KERNEL_SIZE +
- i * KERNEL_SIZE * KERNEL_SIZE + spatial_idx;
- sum += weights[w_idx] * static_local[i];
- }
-
- // Accumulate: layer input channels (if layer_idx > 0)
- let prev_channels = IN_CHANNELS - 8u;
- for (var i: u32 = 0u; i < prev_channels; i++) {
- let w_idx = c * IN_CHANNELS * KERNEL_SIZE * KERNEL_SIZE +
- (8u + i) * KERNEL_SIZE * KERNEL_SIZE + spatial_idx;
- sum += weights[w_idx] * layer_local[i];
- }
- }
- }
-
- output[c] = clamp(sum, 0.0, 1.0); // Sigmoid approximation
- }
-
- // Pack and store
- textureStore(output_tex, coord, pack_channels(output));
-}
diff --git a/workspaces/main/shaders/cnn_v2/cnn_v2_layer_template.wgsl b/workspaces/main/shaders/cnn_v2/cnn_v2_layer_template.wgsl
deleted file mode 100644
index 1bf6819..0000000
--- a/workspaces/main/shaders/cnn_v2/cnn_v2_layer_template.wgsl
+++ /dev/null
@@ -1,68 +0,0 @@
-// CNN v2 Layer Template (placeholder for generated shaders)
-// This file documents the structure - actual layers generated by export script
-
-// Example: Layer 0 (1×1 kernel, 8→16 channels)
-// const KERNEL_SIZE: u32 = 1u;
-// const IN_CHANNELS: u32 = 8u; // 7 features + bias
-// const OUT_CHANNELS: u32 = 16u;
-// const weights: array<f32, 128> = array(...);
-
-@group(0) @binding(0) var static_features: texture_2d<u32>;
-@group(0) @binding(1) var layer_input: texture_2d<u32>; // Previous layer output
-@group(0) @binding(2) var output_tex: texture_storage_2d<rgba32uint, write>;
-
-fn unpack_static_features(coord: vec2<i32>) -> array<f32, 8> {
- let packed = textureLoad(static_features, coord, 0);
- let v0 = unpack2x16float(packed.x);
- let v1 = unpack2x16float(packed.y);
- let v2 = unpack2x16float(packed.z);
- let v3 = unpack2x16float(packed.w);
- return array<f32, 8>(v0.x, v0.y, v1.x, v1.y, v2.x, v2.y, v3.x, v3.y);
-}
-
-fn unpack_layer_channels(coord: vec2<i32>) -> array<f32, 8> {
- let packed = textureLoad(layer_input, coord, 0);
- let v0 = unpack2x16float(packed.x);
- let v1 = unpack2x16float(packed.y);
- let v2 = unpack2x16float(packed.z);
- let v3 = unpack2x16float(packed.w);
- return array<f32, 8>(v0.x, v0.y, v1.x, v1.y, v2.x, v2.y, v3.x, v3.y);
-}
-
-fn pack_channels(values: array<f32, 8>) -> vec4<u32> {
- return vec4<u32>(
- pack2x16float(vec2<f32>(values[0], values[1])),
- pack2x16float(vec2<f32>(values[2], values[3])),
- pack2x16float(vec2<f32>(values[4], values[5])),
- pack2x16float(vec2<f32>(values[6], values[7]))
- );
-}
-
-@compute @workgroup_size(8, 8)
-fn main(@builtin(global_invocation_id) id: vec3<u32>) {
- let coord = vec2<i32>(id.xy);
- let dims = textureDimensions(static_features);
-
- if (coord.x >= i32(dims.x) || coord.y >= i32(dims.y)) {
- return;
- }
-
- // Load static features (always available)
- let static_feat = unpack_static_features(coord);
-
- // Convolution loop (example for generated code)
- // var output: array<f32, OUT_CHANNELS>;
- // for (var c: u32 = 0u; c < OUT_CHANNELS; c++) {
- // var sum: f32 = 0.0;
- // for (var ky: i32 = -radius; ky <= radius; ky++) {
- // for (var kx: i32 = -radius; kx <= radius; kx++) {
- // let sample_coord = coord + vec2<i32>(kx, ky);
- // // Load static + prev layer, multiply weights, accumulate
- // }
- // }
- // output[c] = max(0.0, sum); // ReLU
- // }
-
- // Placeholder output
- textureStore(output_tex, coord, vec4<u32>(0u));
-}
diff --git a/workspaces/main/shaders/cnn_v2/cnn_v2_static.wgsl b/workspaces/main/shaders/cnn_v2/cnn_v2_static.wgsl
deleted file mode 100644
index 309e832..0000000
--- a/workspaces/main/shaders/cnn_v2/cnn_v2_static.wgsl
+++ /dev/null
@@ -1,75 +0,0 @@
-// CNN v2 Static Features Compute Shader
-// Generates 8D parametric features: [p0, p1, p2, p3, uv.x, uv.y, sin20_y, bias]
-// p0-p3: Parametric features from specified mip level (0=mip0, 1=mip1, 2=mip2, 3=mip3)
-// Note: Input image RGBD (mip0) fed separately to Layer 0
-//
-// TODO: Binary format should support arbitrary layout and ordering for feature vector (7D).
-// Current layout is hardcoded. Future versions should allow runtime-specified
-// feature combinations (e.g., [R, G, B, dx, dy, uv_x, bias] or custom encodings).
-
-struct StaticFeatureParams {
- mip_level: u32,
- padding0: u32,
- padding1: u32,
- padding2: u32,
-}
-
-@group(0) @binding(0) var input_tex: texture_2d<f32>;
-@group(0) @binding(1) var input_tex_mip1: texture_2d<f32>;
-@group(0) @binding(2) var input_tex_mip2: texture_2d<f32>;
-@group(0) @binding(3) var depth_tex: texture_2d<f32>;
-@group(0) @binding(4) var output_tex: texture_storage_2d<rgba32uint, write>;
-@group(0) @binding(5) var<uniform> params: StaticFeatureParams;
-@group(0) @binding(6) var linear_sampler: sampler;
-
-@compute @workgroup_size(8, 8)
-fn main(@builtin(global_invocation_id) id: vec3<u32>) {
- let coord = vec2<i32>(id.xy);
- let dims = textureDimensions(input_tex);
-
- if (coord.x >= i32(dims.x) || coord.y >= i32(dims.y)) {
- return;
- }
-
- // Parametric features (p0-p3) - bilinear sample from specified mip level
- // Use UV coordinates for bilinear interpolation
- // Note: Use textureSampleLevel (not textureSample) in compute shaders
- let uv = (vec2<f32>(coord) + 0.5) / vec2<f32>(dims);
- var rgba: vec4<f32>;
- if (params.mip_level == 0u) {
- rgba = textureSampleLevel(input_tex, linear_sampler, uv, 0.0);
- } else if (params.mip_level == 1u) {
- rgba = textureSampleLevel(input_tex_mip1, linear_sampler, uv, 0.0);
- } else if (params.mip_level == 2u) {
- rgba = textureSampleLevel(input_tex_mip2, linear_sampler, uv, 0.0);
- } else {
- // Mip 3 or higher: use mip 2 as fallback
- rgba = textureSampleLevel(input_tex_mip2, linear_sampler, uv, 0.0);
- }
-
- let p0 = rgba.r;
- let p1 = rgba.g;
- let p2 = rgba.b;
- let p3 = textureLoad(depth_tex, coord, 0).r;
-
- // UV coordinates (normalized [0,1], top-left origin - matches training)
- let uv_x = f32(coord.x) / f32(dims.x);
- let uv_y = f32(coord.y) / f32(dims.y);
-
- // Multi-frequency position encoding
- let sin20_y = sin(20.0 * uv_y);
-
- // Bias dimension (always 1.0)
- let bias = 1.0;
-
- // Pack 8×f16 into 4×u32 (rgba32uint)
- // [p0, p1, p2, p3, uv_x, uv_y, sin20_y, bias]
- let packed = vec4<u32>(
- pack2x16float(vec2<f32>(p0, p1)),
- pack2x16float(vec2<f32>(p2, p3)),
- pack2x16float(vec2<f32>(uv_x, uv_y)),
- pack2x16float(vec2<f32>(sin20_y, bias))
- );
-
- textureStore(output_tex, coord, packed);
-}
diff --git a/workspaces/main/timeline.seq b/workspaces/main/timeline.seq
index 05d9026..b4663bb 100644
--- a/workspaces/main/timeline.seq
+++ b/workspaces/main/timeline.seq
@@ -29,12 +29,12 @@ SEQUENCE 16.00 2 "Hybrid3D + CNN"
EFFECT + ParticleSprayEffect 0.00 2.00
EFFECT = ParticlesEffect 2.00 4.00
EFFECT + Hybrid3DEffect 0.00 4.00
- EFFECT + CNNEffect 0.00 4.00 layers=3 blend=.9
+ EFFECT + CNNv1Effect 0.00 4.00 layers=3 blend=.9
SEQUENCE 20.00 0 "CNN effect"
EFFECT + HeptagonEffect 0.00 8.00
EFFECT + Scene1Effect 0.00 8.00
- EFFECT + CNNEffect 6.00 8.00 layers=3 blend=.5
+ EFFECT + CNNv1Effect 6.00 8.00 layers=3 blend=.5
SEQUENCE 28.00 0 "buggy"
EFFECT + HeptagonEffect 0.00 2.00