-
-
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
Add AdapterInfo to WgpuOptions #3832
Conversation
I think Does it ever make sense for the user to set a custom value for the adapter_info? If not, it would be better to have it in a private field with a public method to access the value, instead of leaving it open. |
I went with a public field, because |
I think |
So....does the default value of |
No, it means wgpu is allowed to pick between those backends based on the hardware available and the other limits. There are no notion of order.
I would prefer a new resource. There's no need to keep in sync with |
Ah…ok, thanks for explaining.
Then a new resource it will be, will do that tomorrow after i got my beauty sleep. 🙃😴 |
49f5e1f
to
990ccf2
Compare
OK...i've added |
AdapterInfo, Backends, Features as WgpuFeatures, Limits as WgpuLimits, PowerPreference, | ||
}; | ||
|
||
/// Provides information about the current renderer and the values it was configured with. |
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 is very, very useful for debugging. Can we link this from the module level docs of bevy_render
?
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.
Sure, can you point me to the module level docs? I can't seem to find them, bevy_render/lib.rs
doesn't seem to have any? 😅
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.
Based on what's showing up on docs.rs, they appear to be found at
bevy/crates/bevy_internal/src/lib.rs
Line 115 in 130953c
//! Cameras, meshes, textures, shaders, and pipelines. |
Tossing in another line under there should work fine for 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.
Taking the way through doc.rs didn't come to my mind, thanks for pointing that out.
Something like this?
Information about the current renderer can be accessed through the resource [renderer::RendererInfo].
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.
Native English speaker: the doc strings are perfect :) This design is very useful, and should be highlighted in our teaching materials.
f9dfc08
to
41409fb
Compare
@Weasy666 oh! I’d missed this PR. I was literally doing the same thing - splitting out the configuration and the result. Chatting with @cart about it he asked the question “why can’t we use RenderDevice for this?” I had missed that it had limits and features methods and is already present in both the main and render worlds so inserting another resource with a copy of it is unnecessary duplication and it’s probably better that the wgpu Device be the sole source of truth. Then the missing information about which GPU and backend are used is the AdapterInfo, so that just needs inserting into both worlds. As such, I think #3931 is probably the preferred solution but as I made that PR, I’ll defer to @cart or someone else to make the judgement. Sorry for missing this PR and duplicating your effort! If it’s preferred then I can close that PR and we can perhaps update this one? |
I initially did nearly the same thing as you did in your PR. But i changed it to its own resource, to make clear, that it is only intended to be a "view" for diagnostics, or some such, on the active renderer and its configuration, and nothing to set up or configure it. |
I think
That leaves AdapterInfo. Given that wgpu already has a type for that (and separates it conceptually from Devices), I think it makes the most sense to just insert that as an ECS resource. |
Ok, then we can close this PR in favor of #3931, as that PR does tick nearly all boxes (except the rename). |
Objective
Make it easy to access adapter info in a bevy program. Can be useful to display such information in a dev ui or to send it with an error report.
Solution
Add
AdapterInfo
toWgpuOptions
after an adapter is set up. <- chanded this to its own "view" resourceRendererInfo