eliemichel / LearnWebGPU-Code

The accompanying code of the Learn WebGPU C++ programming guide
https://eliemichel.github.io/LearnWebGPU
MIT License
106 stars 28 forks source link

Texture GPUExtent3D limits exceeded, InvalidDimension #12

Closed danvas closed 1 year ago

danvas commented 1 year ago

https://github.com/eliemichel/LearnWebGPU-Code/blob/8997998723013856313afbca054fac29221b6f7c/main.cpp#LL92C1-L92C1

I keep getting these panic errors at runtime:

Device error: type 4 (message: InvalidDimension(LimitExceeded { dim: X, given: 640, limit: 0 }))
thread '<unnamed>' panicked at 'invalid TextureId', src/lib.rs:222:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5
Device error: type 4 (message: InvalidDimension(LimitExceeded { dim: Z, given: 1, limit: 0 }))

but managed to fix them by setting the max limits on the texture's extent width and number of array layers:

  requiredLimits.limits.maxTextureDimension2D = 640;
  requiredLimits.limits.maxTextureArrayLayers = 1;

as shown in my code https://github.com/danvas/webgpu-cpp/commit/eaff39e191aacc5d6958b4c9d5b26602f6757b97

Why there was no need to set them in your implementation?

eliemichel commented 1 year ago

I started updating all chapters to include this fix, thx for reporting!