Open LeonMatthes opened 1 year ago
GpuFuture
is likely to be deprecated and removed sometime in the future. In Vulkano 0.32, new methods were added to Queue
that mirror the plain Vulkan API functions more directly. There are currently only _unchecked
variants of these functions (which only show up in the documentation if you enable the document_unchecked
feature), there is no safe implementation yet. A safe implementation requires a much more thorough representation of Vulkan synchronization. This is in the works, but it has to start at the bottom, in command buffers. There is currently a new CommandBufferBuilder
in development for that purpose, but it will take a while before it's done.
@Rua thanks for the answer, this makes a lot of sense. I've already found these functions on Queue and the fact that queue takes care of a lot of resource handling already. I'll start using the unchecked functions then for now.
Is there some sort of milestone or issue that tracks these upcoming changes? I'd like to contribute but don't really know what to implement and what the next issues are. 😊 Let me know what some good first issues would be.
I don't think there is anything you can do for the moment. The synchronization code in the new command buffer is quite difficult, and I'm studying how the official validation layer does it, so that I can get an idea what to do for Vulkano. I can list the things I want to do at some point though:
clear_attachments
, execute_commands
and set_event
/wait_events
.PrimaryCommandBufferAbstract
for it, so that it can actually be used for queue submissions. I would like to have this done for the 0.33 release of Vulkano. This will also deprecate UnsafeCommandBuffer
.UnsafeCommandBufferBuilder
with CommandBufferBuilder
as the inner type of SyncCommandBufferBuilder
.PrimaryAutoCommandBuffer
, SecondaryAutoCommandBuffer
and SyncCommandBuffer
, and use PrimaryCommandBuffer
/SecondaryCommandBuffer
as the only built command buffer types.AutoCommandBufferBuilder
and SyncCommandBufferBuilder
, with the methods of the latter becoming _unchecked
versions of the former.AutoCommandBufferBuilder
re-use the validation methods of CommandBufferBuilder
.Queue
.Taking inspiration from the validation layers makes a lot of sense :)
Alright, if there are any concrete issues apart from CommandBuffers, which you're already working on, let me know. I'll keep an eye out for new issues marked as "easy" or "good first issue"
Hi,
I'm currently using vulkano in a personal project as my main access to Vulkan. In many ways it's so much nicer than normal ash or other direct vulkan access, whilst retaining a tight level of control. Especially coming from OpenGL, whilst Vulkan means more boilerplate, I also finally understand how everything ties together.
One aspect of Vulkano that I've avoided in my project until now is the use of
GpuFuture
. Whilst the API is simple to use, I also feel it oversimplifies vulkan synchronization and results in some strange behavior like #1705 .I've spent some time trying to narrow down this disconnect between Vulkan <-> GpuFuture recently, as I'd like to be comfortable using the simpler GpuFuture API (especially as the raw Submit API has been changed after vulkano 0.31).
From my research the main issue seems to be that GpuFuture actually takes care of multiple concerns, that may be better adressed individually:
flush
).then_execute
,then_signal_semaphore
,then_signal_fence
).cleanup_finished
,signal_finished
, etc.).Because GpuFuture takes care of all three of these, it ends up handling none of them perfectly. GpuFuture also ends up creating a tree, instead of a DAG, which is what synchronization with multiple queues actually is.
Of course I'm willing to contribute myself but don't want to waste time implementing something that other maintainers don't agree on. This is why I'm asking for comments and suggestions in this issue before I start implementing.
My current thoughts look something like this:
SubmitCommandBufferBuilder
. This approach seems to be even outlined inDESIGN.md
.GpuFuture
to only represent an event that has been submitted and will happen in the future on a GPU.We can create futures for the vulkan synchronization primitives to allow for manual synchronization. This would also allow us to use type restrictions for inter-future dependencies. e.g.:
SemaphoreFutures
orTimelineSemaphoreFutures
.Proposed API - triangle example
Compare this to the old API:
Whilst the old API is shorter, it also tries to hide some important details:
swapchain_present
cannot signal a fence, sothen_signal_fence_and_flush
has to add an empty queue submission (possibly on the wrong queue).ToDo
.What this tries to solve
1705
signal_semaphore
possible)TimelineSemaphoreFuture
and appropriate functions to SubmissionBuilder)Open Questions
SemaphoreFuture
is just dropped? Nothing ever waits for the Semaphore... Do we just panic? - I believe this is already an issue today.SemaphoreFuture
and aFenceFuture
would refer to the same submission. If any of them finish, the others would be finished as well.New GpuFuture trait:
Should include the following: