Skip to content
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

"Predictive" lock for buffers #1912

Closed
AndrewB330 opened this issue Jun 7, 2022 · 1 comment
Closed

"Predictive" lock for buffers #1912

AndrewB330 opened this issue Jun 7, 2022 · 1 comment

Comments

@AndrewB330
Copy link

I'm trying to use DeviceLocalBuffer in compute shader (instead of CpuAccessibleBuffer, to speed up memory access), but I need to update it every frame, so I created a few "staging" CpuAccessibleBuffer buffers with {storage_buffer: true, transfer_source: true}, and my DeviceLocalBuffer is {storage_buffer: true, transfer_destination: true}.
Then on each frame I'm building a command buffer, first I'm copying needed segment of a buffer from a CpuAccessibleBuffer to DeviceLocalBuffer with copy_buffer_dimensions, and then using this buffer in descriptor set of my compute pipeline. But I'm getting an error that device buffer is already GPU locked. It seesms that it happens because vulkano thinks that buffer is in "read" access by previous frame but then I'm building a new frame where I'm writing to this buffer with copy_buffer_dimensions command, so it returns me this error. Is it possible to fix this? Somehow detect that when we will start writing to the buffer, read access will expire already, because compute shader will finish until then.

self.copy_buffer_dimensions(...).unwrap() // here I'm writing to the device buffer from host buffer
    .bind_pipeline_compute(...)
    .push_constants(...)
    .bind_descriptor_sets(...)
    .dispatch(...).unwrap() // here I'm reading from device buffer in compute shader
@AndrewB330
Copy link
Author

Addressed in design proposal here: #1914
I'm going to implement it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant