diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-11 07:16:51 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-11 07:16:51 +0100 |
| commit | badf6907dd071afa7a5438fdf575d73c4c417e3f (patch) | |
| tree | ff2627cdf3201333a6127b6108c0caa3ce606048 /tools | |
| parent | d594609420b3d0ca43d760ff043b3750e2be55ca (diff) | |
debug: Add shader load verification and GPU sync to CNN test tool
Debug additions:
- Print loaded shader size (confirms assets work: 2274 bytes)
- Add wgpuDevicePoll after each layer for GPU sync
- Verify shader loading with null/empty checks
Findings:
- Shader loads correctly (2274 bytes)
- GPU commands execute without validation errors
- Pipeline compiles successfully
- Output remains all-black despite correct architecture
Likely causes:
- Render setup differs from demo's CNNEffect
- Possible issue with bind group bindings
- Fragment shader may not be executing
- Texture sampling might be failing
Next steps:
- Create minimal solid-color render test
- Compare bind group setup with working CNNEffect
- Add fragment shader debug output (if possible)
- Test with demo's CNN effect to verify weights/shader work
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/cnn_test.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/cnn_test.cc b/tools/cnn_test.cc index bb4a824..c44606c 100644 --- a/tools/cnn_test.cc +++ b/tools/cnn_test.cc @@ -151,6 +151,13 @@ static WGPURenderPipeline create_cnn_pipeline(WGPUDevice device, bool is_final_layer) { const char* shader_code = SafeGetAsset(AssetId::ASSET_SHADER_CNN_LAYER); + // Debug: check if shader loaded + if (!shader_code || shader_code[0] == '\0') { + fprintf(stderr, "ERROR: CNN shader asset not loaded!\n"); + return nullptr; + } + printf("Loaded CNN shader: %zu bytes\n", strlen(shader_code)); + WGPUBindGroupLayout bgl = BindGroupLayoutBuilder() .sampler(0, WGPUShaderStage_Fragment) @@ -425,6 +432,9 @@ int main(int argc, char** argv) { WGPUCommandBuffer commands = wgpuCommandEncoderFinish(encoder, nullptr); wgpuQueueSubmit(queue, 1, &commands); + // Wait for GPU to complete this layer before proceeding + wgpuDevicePoll(device, true, nullptr); + wgpuCommandBufferRelease(commands); wgpuRenderPassEncoderRelease(pass); wgpuCommandEncoderRelease(encoder); |
