summaryrefslogtreecommitdiff
path: root/workspaces/main/shaders/cnn_v2/cnn_v2_static.wgsl
diff options
context:
space:
mode:
Diffstat (limited to 'workspaces/main/shaders/cnn_v2/cnn_v2_static.wgsl')
-rw-r--r--workspaces/main/shaders/cnn_v2/cnn_v2_static.wgsl23
1 files changed, 13 insertions, 10 deletions
diff --git a/workspaces/main/shaders/cnn_v2/cnn_v2_static.wgsl b/workspaces/main/shaders/cnn_v2/cnn_v2_static.wgsl
index dd07f19..7a9e6de 100644
--- a/workspaces/main/shaders/cnn_v2/cnn_v2_static.wgsl
+++ b/workspaces/main/shaders/cnn_v2/cnn_v2_static.wgsl
@@ -1,5 +1,7 @@
// CNN v2 Static Features Compute Shader
-// Generates 7D features + bias: [R, G, B, D, uv.x, uv.y, sin10_x, 1.0]
+// Generates 8D parametric features: [p0, p1, p2, p3, uv.x, uv.y, sin10_x, bias]
+// p0-p3: Parametric features (currently RGBD from mip0, could be mip1/2, gradients, etc.)
+// Note: Input image RGBD (mip0) fed separately to Layer 0
@group(0) @binding(0) var input_tex: texture_2d<f32>;
@group(0) @binding(1) var input_tex_mip1: texture_2d<f32>;
@@ -16,14 +18,14 @@ fn main(@builtin(global_invocation_id) id: vec3<u32>) {
return;
}
- // Sample RGBA from mip 0
+ // Parametric features (p0-p3)
+ // TODO: Experiment with mip1 grayscale, Sobel gradients, etc.
+ // For now, use RGBD from mip 0 (same as input, but could differ)
let rgba = textureLoad(input_tex, coord, 0);
- let r = rgba.r;
- let g = rgba.g;
- let b = rgba.b;
-
- // Sample depth
- let d = textureLoad(depth_tex, coord, 0).r;
+ 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], bottom-left origin)
let uv_x = f32(coord.x) / f32(dims.x);
@@ -36,9 +38,10 @@ fn main(@builtin(global_invocation_id) id: vec3<u32>) {
let bias = 1.0;
// Pack 8×f16 into 4×u32 (rgba32uint)
+ // [p0, p1, p2, p3, uv_x, uv_y, sin10_x, bias]
let packed = vec4<u32>(
- pack2x16float(vec2<f32>(r, g)),
- pack2x16float(vec2<f32>(b, d)),
+ pack2x16float(vec2<f32>(p0, p1)),
+ pack2x16float(vec2<f32>(p2, p3)),
pack2x16float(vec2<f32>(uv_x, uv_y)),
pack2x16float(vec2<f32>(sin10_x, bias))
);