-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Get raw window handle only after Resume event #3639
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
this feels like recoding what https://docs.rs/wgpu/0.12.0/wgpu/struct.Instance.html#method.request_adapter should be doing
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.
Yep, it's a copy-pasted code from
wgpu
. But we should enumerate adapters here to make sure that we can use default texture format and default depth format as a render target for the selected adapter (for example, on my Android device Vulkan adapter can't use Depth32Float as a render target).request adapter
just return first adapter which meets requirements ofRequestAdapterOptions
.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.
that makes me sad... I think we should either:
Depth32Float
toDepth24Plus
as the comment suggest, and which should be supported on Vulkan android (maybe with a cfg to check target architecture?)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.
As far as I know, only
VK_FORMAT_D16_UNORM
supported across all Vulkan powered devices (99% based on gpuinfo https://vulkan.gpuinfo.org/listoptimaltilingformats.php?platform=android)request_adapter
is implemented following by WebGPU spec. I don't think we can change it.That's why
wgpu-rs
exposedenumerate_adapters
function. It's allowed users to select adapter based on their options. Perhaps in the future, we will need to check if the adapter supports any other features.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.
Should we really be picking devices based on what texture / depth formats they support? That seems like a pretty trivial criteria relative to things like gpu features and performance. Wouldn't it make more sense to do runtime queries of supported formats and then pick the best one? Every device will support "something".
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.
@cart I implemented this behavior because bevy uses
Depth32Float
as a default depth format and it's required forbevy_renderer
. When I tested this on a real device, it haveDepth32Float
format on OpenGL adapter, but Vulkan adapter doesn't support it. (Android 8.0).We can remove this part from PR. It unblocks some Android devices (maybe most of the devices, but definitely not all of them).
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.
Yeah short term if we can move this forward without this behavior I think we should. I do acknowledge that this is a problem that needs solving, but I think it should be solved via querying supported depth formats at runtime after we've selected our device based on more substantial criteria.
Anything that currently consumes hard-coded Depth32Float constants could call something like
RenderDevice::get_preferred_depth_format()
instead.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.
Sorry, maybe I confused you. We can query depth format only from adapter (correct me, if I'am wrong). For example, on real device:
What we should do in this case?
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.
We would choose vulkan (if that is what wgpu recommends based on the wgpu config) and pick a different depth format supported by the device.