summaryrefslogtreecommitdiff
path: root/src/gpu/effects/cnn_v2_effect.h
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-13 16:48:02 +0100
committerskal <pascal.massimino@gmail.com>2026-02-13 16:48:02 +0100
commitced248b0a8973db6d11b79e8290e2f5bb17ffcaa (patch)
tree938899c02408895124fb8e9751dbd36b50d4a0ba /src/gpu/effects/cnn_v2_effect.h
parent3eed58f0cd602298681a2313946ba2a5824d6c6e (diff)
CNN v2: Add mip-level support to runtime effect
Binary format v2 includes mip_level in header (20 bytes, was 16). Effect reads mip_level and passes to static features shader via uniform. Shader samples from correct mip texture based on mip_level. Changes: - export_cnn_v2_weights.py: Header v2 with mip_level field - cnn_v2_effect.h: Add StaticFeatureParams, mip_level member, params buffer - cnn_v2_effect.cc: Read mip_level from weights, create/bind params buffer, update per-frame - cnn_v2_static.wgsl: Accept params uniform, sample from selected mip level Binary format v2: - Header: 20 bytes (magic, version=2, num_layers, total_weights, mip_level) - Backward compatible: v1 weights load with mip_level=0 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Diffstat (limited to 'src/gpu/effects/cnn_v2_effect.h')
-rw-r--r--src/gpu/effects/cnn_v2_effect.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/gpu/effects/cnn_v2_effect.h b/src/gpu/effects/cnn_v2_effect.h
index 28aec8c..47dedf5 100644
--- a/src/gpu/effects/cnn_v2_effect.h
+++ b/src/gpu/effects/cnn_v2_effect.h
@@ -47,6 +47,11 @@ private:
float blend_amount;
};
+ struct StaticFeatureParams {
+ uint32_t mip_level;
+ uint32_t padding[3];
+ };
+
void create_textures();
void create_pipelines();
void load_weights();
@@ -55,6 +60,7 @@ private:
// Static features compute
WGPUComputePipeline static_pipeline_;
WGPUBindGroup static_bind_group_;
+ WGPUBuffer static_params_buffer_;
WGPUTexture static_features_tex_;
WGPUTextureView static_features_view_;
@@ -75,5 +81,6 @@ private:
float blend_amount_ = 1.0f;
bool beat_modulated_ = false;
float beat_scale_ = 1.0f;
+ uint32_t mip_level_ = 0;
bool initialized_;
};