Merged
Conversation
Also command pools are no longer shared between command buffers.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Describe the pull request
The current implementation uses three integrated queues that it allocates when starting a backend. This is fine for applications that allocate commands in the order they need to be executed (after all Unity also uses only one queue), however it prevents more advanced GPU-side parallelism. For example, two queues could execute workloads in parallel until their results are required by a third queue. Additionally, it is now possible to use different dedicated transfer queues for host-device and device-host transfers. To support this, queues are now dynamically allocated and a new synchronization mechanism can be used to wait for fences on foreign queues.
The default queue interface has been removed and replaced with a newly unified method
defaultQueue, that takes aQueueTypeand returns a pointer to a queue:Internally the queues are managed in a way, that they are allocated, depending on device capabilities. If no dedicated queues are available, the pointers could all point to the same queue. This is most important for two queues of one type, where creating does not guarantee to return two distinct queues, if the device does not support it.
This is totally opaque to the caller, so use multiple queues, if you want to, but don't expect them to execute in parallel under all circumstances.
For synchronization, an additional overload for
waitForis available on a queue, that takes a reference to another queue and causes the queue to wait for a certain fence on the other one. This is a non-blocking call, meaning the program flow will immediately continue. However all submitted commands after the wait will be blocked, until the other queue has passed the provided fence.Render passes can now also be initialized on a certain queue instance. This allows for parallel render-graph implementations.
With multiple queues flying around, it can be hard to track which command buffer needs to submit to which queue. To streamline this process, a command buffer now remembers the queue it has been created on and provides an
submitmethod on its own:Related issues