-
Notifications
You must be signed in to change notification settings - Fork 421
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
Adapt WGPU limits to ggez Backend configuration #1249
base: devel
Are you sure you want to change the base?
Conversation
89237ae
to
d754bb3
Compare
As I understand |
Yes, that's right. It limits the wgpu device to the requested limits so that you can't accidentally use the compute shader feature on devices that may not support it. I used the same philosophy in this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An alternative strategy would be to test compute shaders availability in new_from_instance
from Adapter::limits
, and enable them when requesting a device.
This is more complex but more robust.
This allows the usage of more complex and advanced features like compute shaders on backend platforms that allow it.
d754bb3
to
0fad7cd
Compare
That approach would be dynamic, right? With that I mean dependent on the current hardware environment and its GPU capabilities. If so, I'd avoid that, because any feature (which compute shaders are) usable has to be guaranteed to work under all possible environments, in order to align with |
Problem
I want to be able to write and use compute shaders in ggez projects, as long as the configured backend allows their usage. Currently this is impossible, because the device limits are always set to
downlevel_webgl2_defaults
which disallows compute shaders.Solution
This PR dynamically changes these device limits based on the configured backends. It does this in a way, that is consistent across all possible backends according to configuration. (
Backend:All
disallows compute shaders because it may target WebGL2,Backend::OnlyPrimary
on the other hand always enables them).