vulkano-rs / vulkano

Safe and rich Rust wrapper around the Vulkan API
Apache License 2.0
4.48k stars 433 forks source link

Task graph [4/10]: compilation #2560

Closed marc0246 closed 6 days ago

marc0246 commented 3 weeks ago

Follow-up to #2548, implementing the task graph compiler.

I gave up on subresource-granularity sync because it was making everything complicated and I just didn't want to deal with it anymore. The only reason I did it in the first place was because the old sync did it. But that's also what we're trying to replace, so maybe it was just not meant to be. Few things come to mind that couldn't be worked around with whole-resource-granularity sync anyway. A nice side-effect is that this is a whole lot faster both when compiling and executing the task graph.

I converted the async-update example as a very very very (very) early test. Mainly because the kind of syncronization it does was the biggest thorn in my ass.

Changelog:

### Additions
- Added `AccessFlags::{contains_reads,contains_writes}`.
Rua commented 6 days ago

When I run the async example, I get this validation layer error whenever I press space:

UNASSIGNED-CoreValidation-DrawState-InvalidImageLayout(ERROR / SPEC): msgNum: 1303270965 - Validation Error: [ UNASSIGNED-CoreValidation-DrawState-InvalidImageLayout ] Object 0: handle = 0x64f9f7847980, type = VK_OBJECT_TYPE_COMMAND_BUFFER; Object 1: handle = 0xdd3a8a0000000015, type = VK_OBJECT_TYPE_IMAGE; | MessageID = 0x4dae5635 | vkQueueSubmit(): pSubmits[0].pCommandBuffers[0] command buffer VkCommandBuffer 0x64f9f7847980[] expects VkImage 0xdd3a8a0000000015[] (subresource: aspectMask 0x1 array layer 0, mip level 0) to be in layout VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL--instead, current layout is VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL. Objects: 2 [0] 0x64f9f7847980, type: 6, name: NULL [1] 0xdd3a8a0000000015, type: 10, name: NULL

Is that ok/still todo?

marc0246 commented 6 days ago

I'm 99.99% sure that's a hallucination.

Rua commented 6 days ago

I wonder if RenderDoc or such can clarify what's going on. I'll merge it but hopefully we can fix the error at some point, otherwise people are going to report it as a Vulkano bug.

marc0246 commented 6 days ago

Then you'll be "glad" to learn how many hallucinations I encoutered :sweat_smile: while working on this. If it is a hallucination and someone reports it to us, we'll just tell them to go complain to the validation layers. We're not in the business of working around debugging tools. They are supposed to make ours lives easier not harder...