diff options
| -rw-r--r-- | log.txt | 23 | ||||
| -rw-r--r-- | src/gpu/effects/flash_effect.cc | 5 | ||||
| -rw-r--r-- | src/gpu/effects/flash_effect.h | 12 |
3 files changed, 34 insertions, 6 deletions
@@ -0,0 +1,23 @@ + +thread '<unnamed>' (15208210) panicked at src/lib.rs:606:5: +Error in wgpuQueueSubmit: Validation Error + +Caused by: + In a draw command, kind: Draw + Buffer is bound with size 24 where the shader expects 32 in group[0] compact index 0 + +note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace +fatal runtime error: failed to initiate panic, error 5, aborting +[GraphicsT=0.23, AudioT=0.13, Beat=0, Frac=0.26, Peak=1.00] +[SEQUENCE START] priority=0, start_time=0.00 + [EFFECT START] 15FlashCubeEffect (priority=-1, time=0.20-1.50) + [EFFECT START] 11FlashEffect (priority=0, time=0.00-1.00) + [EFFECT START] 10FadeEffect (priority=1, time=0.10-1.00) + [EFFECT START] 14SolarizeEffect (priority=2, time=0.00-2.00) +WebGPU Error: Validation Error + +Caused by: + In wgpuCommandEncoderFinish + In a draw command, kind: Draw + Buffer is bound with size 24 where the shader expects 32 in group[0] compact index 0 + diff --git a/src/gpu/effects/flash_effect.cc b/src/gpu/effects/flash_effect.cc index e02ea75..1bb4d93 100644 --- a/src/gpu/effects/flash_effect.cc +++ b/src/gpu/effects/flash_effect.cc @@ -85,8 +85,9 @@ void FlashEffect::render(WGPURenderPassEncoder pass, float time, float beat, const FlashUniforms u = { .flash_intensity = flash_intensity_, .intensity = intensity, - .color = {r, g, b}, // Time-dependent, computed every frame - ._pad = 0.0f}; + ._pad1 = {0.0f, 0.0f}, // Padding for vec3 alignment + .color = {r, g, b}, // Time-dependent, computed every frame + ._pad2 = 0.0f}; uniforms_.update(ctx_.queue, u); wgpuRenderPassEncoderSetPipeline(pass, pipeline_); diff --git a/src/gpu/effects/flash_effect.h b/src/gpu/effects/flash_effect.h index 8241557..373b48b 100644 --- a/src/gpu/effects/flash_effect.h +++ b/src/gpu/effects/flash_effect.h @@ -15,12 +15,16 @@ struct FlashEffectParams { }; // Uniform data sent to GPU shader +// IMPORTANT: Must match WGSL struct layout with proper alignment +// vec3<f32> in WGSL has 16-byte alignment, not 12-byte! struct FlashUniforms { - float flash_intensity; - float intensity; - float color[3]; // RGB flash color - float _pad; + float flash_intensity; // offset 0 + float intensity; // offset 4 + float _pad1[2]; // offset 8-15 (padding for vec3 alignment) + float color[3]; // offset 16-27 (vec3 aligned to 16 bytes) + float _pad2; // offset 28-31 }; +static_assert(sizeof(FlashUniforms) == 32, "FlashUniforms must be 32 bytes for WGSL alignment"); class FlashEffect : public PostProcessEffect { public: |
