-
Notifications
You must be signed in to change notification settings - Fork 543
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
[RFC] ll based render API #1281
Comments
Excellent summary! I agree with everything except listed below:
I'd like to see multiple queues exposed in
What concerns me here is how sending command buffers between threads will work. Perhaps, we'll send the buffer itself, but the command buffer encoder (which is what needs the command pool) will be non-sendable? let queue = match queue {
... // depending on the capabilities you need (compute?)
}; We may have sugar to avoid this for a general case of graphics-only work. E.g. |
Good to hear! Thanks for the fast feedback!
If I understand it (vulkan) correctly, command buffers are not really supposed to be sent across threads as access to them (ie vkCmd....) requires external synchronization of the underlying command pool, so probably a lock per call. That's why I'm also exposing command buffers as non-
Yep, already implemented! Queues can be downcasted in the hierarchy if they support the required functionalities. Regarding the command queues I have to think a bit. My motivation behind this was that the people who want to use multiple queues or async compute will probably go straight towards the Cheers! |
Sounds good!
There is a lot of convenience in using |
Fair enough! We can keep it the way it's done in core and try something else if it's too complicated. |
Another question: how to manage resources? |
@davll the |
yes, smart pointer approach is much safer and more friendly than pure integer IDs. However, I'm worried about its less flexibility and inefficiency for game engine design. The reason is that smart pointers should contain Device references for destructors and therefore cannot be sended (due to Device might not be sendable), leading to inflexible usage. IMO users are responsible to manage resources by themselves as if using entity-component system (where an world only contains entities and user should notify worlds to create or destroy entities). In a nut shell I prefer data oriented approach :P To clarify: I'm not questioning how gfx_render should be. I'm trying to find out how to manage resources in my 2D rendering engine. :) |
@davll there are multiple ways to get smart resource pointers without holding the device:
FWIW, Froggy manages components automatically, so smart resource pointers would make total sense there. It's not an ECS though. |
1281: Rename `level_count` to `mip_level_count` r=kvark a=grovesNL **Description** This PR renames `level_count` to `mip_level_count` on `TextureViewDescriptor`. This follows the naming in the specification, located at https://gpuweb.github.io/gpuweb/#texture-view-creation **Testing** `cargo build` and `cargo test` only, naming changes will be made downstream in wgpu-rs too. Co-authored-by: Joshua Groves <[email protected]>
Motivation
With the current low-level API (
ll
) rewrite of thecore
a lot of stuff changes towards a vulkan-based API.This requires some changes to the layers above the core, in particular
app
andrender
.app
is a wrapper for writing our examples easier, which takes care of backend specific device initialization and handling of the main loop.render
provides some additional layers and macros for more safety and convenience. Theencoder
wraps the command buffer and extend it with useful implementations.pso
macro is used for easier definition and creation of pipeline state objects.Design
The low level API misses several safety nets compared to the old core (e.g. tracking resources, memory management, ..).
ll
is not supposed to be directly used by most of the users due to it's increased complexity and might easier result in synchronization issues etc.Therefore I would propose to transform
render
into a d3d11-styled layer on top of thell
core, which should solve the following aspects:render
layer. Also, should try to hide image layouts and resource states to avoid pipeline layouts.GeneralQueue
(if compute is supported) or aGraphicsQueue
. This also reduces potential synchronization issues.render
layer.ll
API interferes with the 'legacy' backends.Based on concept above, we need to adjust the device setup a bit as we only want to expose one queue and probably hide some parts of the memory management (e.g explicit heaps).
Example API:
Other
render
parts like the PSO macros should stay and it should be able to use them even if the users directly target thell
backend.app
will still remain but the main tasks will be to create the windows for each platform, handle window events and advancing to the next frame.Drawbacks
The mentioned design above limits the possbilities of the users a bit, but otherwise it would be too low-level and require careful handling of synchronization.
Probably also hard to implement some aspects like memory management if we want to reach performance of d3d11 drivers for example.
The text was updated successfully, but these errors were encountered: