vulkano-rs/vulkano

Resources management suggestion

Closed this issue · 1 comments

This is mostly a post-it so that I don't forget this idea.

It should be possible to transition resources between states encoded in the type system, like this:

struct Buffer {
    ...
}

struct FenceLockedBuffer {
    ...
}

struct LockedBuffer {
    ...
}

You could only modify a Buffer. When executing a command, the user could choose between creating a fence or not. If creating a fence, the Buffer would turn into a FenceLockedBuffer. If not creating a fence, the Buffer would turn into a LockedBuffer.

A FenceLockedBuffer could be turned back into a Buffer by blocking. Both FenceLockedBuffer and LockedBuffer could be used when executing commands.

However this system doesn't say how to handle the relationship between buffers/textures and command buffers.

Vulkan doesn't guarantee that command buffers will be executed in the order you submit them, so this idea is discarded.