eliemichel / LearnWebGPU-Code

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

Step032 crashing on MacOS with native backend #54

Closed yeti424 closed 4 weeks ago

yeti424 commented 1 month ago

Hi,

as mentioned in the header Step032 crashes on MacOS (Macbook Pro M1). Error messages:

thread '<unnamed>' panicked at src/lib.rs:586:5:
Error in wgpuSurfaceConfigure: Validation Error

Caused by:
    `Surface` width and height must be within the maximum supported texture size. Requested was (640, 480), maximum extent is 0.

note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5

The codeline where it happens it this one (in Application::Initialize):

surface.configure(config);

BTW: I tested Step033 - same issue...

Best Regards, Yeti

hardcore-thinking commented 1 month ago

Hi,

Can you provide the initialization of the config variable ? With just that I would say that you didn't set the device's required limits correctly. You can probably fix that by setting requiredLimits.limits.maxTextureDimension1D to 640 and requiredLimits.limits.maxTextureDimension2D to 480. This should do the trick.

Best regards, ajvp

yeti424 commented 1 month ago

Hi

Thanks for the quick reply! Sorry to bother you again: When I try to set the limits as proposed by you I get these error messages:

deviceDesc.requiredLimits->limits.maxTextureDimension1D = 640;

/Users/peter/Develop/WebGPU/Step030/main.cpp:135: Fehler: cannot assign to non-static data member 'requiredLimits' with const-qualified type 'const WGPURequiredLimits ' /Users/peter/Develop/WebGPU/Step030/main.cpp:135:61: error: cannot assign to non-static data member 'requiredLimits' with const-qualified type 'const WGPURequiredLimits ' deviceDesc.requiredLimits->limits.maxTextureDimension1D = 640;


/Users/peter/Develop/WebGPU/Step030/webgpu/include/webgpu/webgpu.h:1285:46: note: non-static data member 'requiredLimits' declared const here
    WGPU_NULLABLE WGPURequiredLimits const * requiredLimits;
                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~

I’m sorry for asking these (stupid) questions, I’m trying to learn WebGPU and it’s not easy from time to time… 🥹

Best Regards,
yeti

> Am 14.09.2024 um 19:09 schrieb hardcore-thinking ***@***.***>:
> 
> 
> Hi,
> 
> Can you provide the initialization of the config variable ? With just that I would say that you didn't set the device's required limits correctly. You can probably fix that by setting requiredLimits.limits.maxTextureDimension1D to 640 and requiredLimits.limits.maxTextureDimension2D to 480. This should do the trick.
> 
> Best regards,
> ajvp
> 
> —
> Reply to this email directly, view it on GitHub <https://github.com/eliemichel/LearnWebGPU-Code/issues/54#issuecomment-2351064267>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/BLHYH3PCH2AHVPFS4XKPB6DZWRUVXAVCNFSM6AAAAABOFS5ZE6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNJRGA3DIMRWG4>.
> You are receiving this because you authored the thread.
> 
hardcore-thinking commented 1 month ago

Hi,

From the error, I would say you're trying to reassign a constant variable. Can you provide the code where you initialize the requiredLimits variable and the initialization of its members ? Also it's a pointer to WGPURequiredLimits. Is there any reason why you made it a pointer ? Thank you.

Best regard, ajvp

yeti424 commented 4 weeks ago

Hi,

Just wanted to let you know that it’s working now (I try to assign values to the wrong variables - my fault).

Thanks anyway for your help,

Yeti

Am 15.09.2024 um 11:59 schrieb hardcore-thinking @.***>:

Hi,

From the error, I would say you're trying to reassign a constant variable. Can you provide the code where you initialize the requiredLimits variable and the initialization of its members ? Also it's a pointer to WGPURequiredLimits. Is there any reason why you made it a pointer ? Thank you.

Best regard, ajvp

— Reply to this email directly, view it on GitHub https://github.com/eliemichel/LearnWebGPU-Code/issues/54#issuecomment-2351507982, or unsubscribe https://github.com/notifications/unsubscribe-auth/BLHYH3MAT7A2SN4RHULGEY3ZWVK6LAVCNFSM6AAAAABOFS5ZE6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNJRGUYDOOJYGI. You are receiving this because you authored the thread.

yeti424 commented 3 weeks ago

Hi Elie,

Thanks for closing this issue!

Since a few weeks I’m trying to learn WebGPU (and C++, too). Your course is very helpful for me and I’m keen to follow it further. But there are a few points in the examples which stopped me from time to time and now I’m wondering if you plan to update the examples (I know that this course is still in progress).

The points I noticed which prevented some programs to compile or made them crash are:

Apologies if I’m telling you anything new here, but I'm really interested in following your course further on!

Best regards,

Yeti (Peter)

Am 17.09.2024 um 23:56 schrieb Elie Michel @.***>:

Closed #54 https://github.com/eliemichel/LearnWebGPU-Code/issues/54 as completed.

— Reply to this email directly, view it on GitHub https://github.com/eliemichel/LearnWebGPU-Code/issues/54#event-14298054106, or unsubscribe https://github.com/notifications/unsubscribe-auth/BLHYH3IUW2NCUGCIYLMTAT3ZXCQSHAVCNFSM6AAAAABOFS5ZE6VHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJUGI4TQMBVGQYTANQ. You are receiving this because you authored the thread.

eliemichel commented 3 weeks ago

Hi Peter, thanks a lot for your feedback!

yeti424 commented 3 weeks ago

Hi Elie,

Thanks for the quick reply!

When I try to compile Step032 (for example) I get these error messages for member variable „device“. Solution is to assign a nullptr in the definition like this;

Device device = nullptr;

/Users/peter/Develop/WebGPU/Step032/main.cpp:67: Fehler: call to implicitly-deleted default constructor of 'Application' /Users/peter/Develop/WebGPU/Step032/main.cpp:67:17: error: call to implicitly-deleted default constructor of 'Application' Application app; ^ /Users/peter/Develop/WebGPU/Step032/main.cpp:56:12: note: default constructor of 'Application' is implicitly deleted because field 'device' has no default constructor Device device; ^

Regards,

Peter

Am 23.09.2024 um 10:10 schrieb Elie Michel @.***>:

Hi Peter, thanks a lot for your feedback!

Outdated things starting from step035 is a known issue, this is where the latest wave of update is progressing. wgpuDevicePoll's extra parameters were optional last time I checked IIRC, maybe they are no longer in the last update of wgpu-native missing initialization of member variables: what error do you have when compiling? — Reply to this email directly, view it on GitHub https://github.com/eliemichel/LearnWebGPU-Code/issues/54#issuecomment-2367503647, or unsubscribe https://github.com/notifications/unsubscribe-auth/BLHYH3PXJZKA3BDAEZJCME3ZX7EHBAVCNFSM6AAAAABOFS5ZE6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNRXGUYDGNRUG4. You are receiving this because you authored the thread.

eliemichel commented 3 weeks ago

I see, this used to be an error indeed but it should have get fixed some time ago (in 77771fe). Could you check that your version of webgpu.hpp is in sync with this? Did you get your WebGPU distribution more than 6 months ago? Otherwise do you remember which link you used because I may have forgotten to update one of them!

yeti424 commented 3 weeks ago

I can’t remember exactly, but I think it was two or three weeks ago when I downloaded WebGPU.zip from the link in your course. This one contains webgpu.hpp….

BTW: Where do I get the current version now? Do I need to get wgpu.h, too?

Am 23.09.2024 um 10:21 schrieb Elie Michel @.***>:

I see, this used to be an error indeed but it should have get fixed some time ago (in 77771fe https://github.com/eliemichel/WebGPU-Cpp/commit/77771fe1dd730b3e0a77391618b471aa343a121b). Could you check that your version of webgpu.hpp is in sync with this? Did you get your WebGPU distribution more than 6 months ago? Otherwise do you remember which link you used because I may have forgotten to update one of them!

— Reply to this email directly, view it on GitHub https://github.com/eliemichel/LearnWebGPU-Code/issues/54#issuecomment-2367526295, or unsubscribe https://github.com/notifications/unsubscribe-auth/BLHYH3PA5QJIDNLVFSM5KHLZX7FRPAVCNFSM6AAAAABOFS5ZE6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNRXGUZDMMRZGU. You are receiving this because you authored the thread.

eliemichel commented 3 weeks ago

Indeed the wgpu release linked in the guide misses this update, my bad! The link to accompagnying code at each chapters do use the right version though.

In general, latest version is in WebGPU-distribution. I am currently simplifying this repo so that instead of having multiple branches we only have 1 with CMake scripts to fetch either of the backend at configure time. For a quick update in your case, check out the wgpu branch!

yeti424 commented 3 weeks ago

Great, thanks! Will give it a try later and let you know….

Am 23.09.2024 um 10:51 schrieb Elie Michel @.***>:

Indeed the wgpu release linked in the guide misses this update, my bad! The link to accompagnying code at each chapters do use the right version though.

In general, latest version is in WebGPU-distribution https://github.com/eliemichel/WebGPU-distribution. I am currently simplifying this repo so that instead of having multiple branches we only have 1 with CMake scripts to fetch either of the backend at configure time. For a quick update in your case, check out the wgpu branch!

— Reply to this email directly, view it on GitHub https://github.com/eliemichel/LearnWebGPU-Code/issues/54#issuecomment-2367592343, or unsubscribe https://github.com/notifications/unsubscribe-auth/BLHYH3JDHSPPVOSG5ROJMBDZX7JCZAVCNFSM6AAAAABOFS5ZE6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNRXGU4TEMZUGM. You are receiving this because you authored the thread.