Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: example_emscripten_wgpu WGPUInstance failed to be created #6748

Closed

Conversation

smileorigin
Copy link

The current example_emscripten_wgpu demo cannot run properly and will have the following errors:

The way to fix it is to use wgpuCreateInstance(nullptr) to create wgpu::Surface, and also add the logic to obtain the best format for the current browser(Surface:: GetPreferredFormat()).

@ocornut
Copy link
Owner

ocornut commented Aug 24, 2023

Hello,
Thanks for the PR. Seems like this is aimed to solve #6640.

and also add the logic to obtain the best format for the current browser(Surface:: GetPreferredFormat())

Can you clarify this? as I understand, it is unrelated to the first change? It is required? (asking for future reference)

@smileorigin
Copy link
Author

Hello, Thanks for the PR. Seems like this is aimed to solve #6640.

and also add the logic to obtain the best format for the current browser(Surface:: GetPreferredFormat())

Can you clarify this? as I understand, it is unrelated to the first change? It is required? (asking for future reference)

Yes, in order to resolve #6640

and also add the logic to obtain the best format for the current browser(Surface:: GetPreferredFormat()

This is not necessary, just to resolve the warning in the browser.
By using GetPreferredFormat(), we can obtain the best format supported by the browser for optimal performance.

If you feel that the content is not related to the PR label, I can also split it into two PRs for submission.

ocornut pushed a commit that referenced this pull request Aug 25, 2023
@ocornut
Copy link
Owner

ocornut commented Aug 25, 2023

If you feel that the content is not related to the PR label, I can also split it into two PRs for submission.

It's ok. My worry is that preferred browser format might be incompatible with some of our needs, but I guess we'll find out.

Merged as 981abb4. Thank you!

@ocornut ocornut closed this Aug 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants