#Cannot use image with specific layout

26 messages · Page 1 of 1 (latest)

summer plover
#

I write to an image in a compute shader and then copy it to a swapchain image with cmd_copy_image. However when I do that I get:

Even though I transitioned layout of the image to VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL with cmd_pipeline_barrier in a command buffer that was submitted before the command buffer where I copy the image.

What can be the problem ?

https://github.com/Smif-N-Wessun/Voxel-Editor/blob/main/src/vulkan.rs#L213

summer niche
#

I think you might want to set the srcAccess to VK_ACCESS_SHADER_WRITE_BIT, cause that is the stage after which the barrier should wait

summer plover
#

Do you mean the barrier that transitions raytrace_output_image ? It should transition only once in the program and before compute shader starts writing to it

left falcon
#

Either the barrier is wrong, or incorrectly defined so it hasn't completed yet, or it hasn't been submitted.

summer plover
#

Weird, it seems like it the image got transitioned because after the error that I mentioned I get another: vkQueueSubmit(): pSubmits[0].pCommandBuffers[0] command buffer VkCommandBuffer 0x132c71032d0[] expects VkImage 0xdd3a8a0000000015[] (subresource: aspectMask 0x1 array layer 0, mip level 0) to be in layout VK_IMAGE_LAYOUT_GENERAL--instead, current layout is VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL.

#

seems like the layout has been transitioned after all

#

and I can't understand why it expects general layout

left falcon
#

Have you got a src/dst somewhere backward?

summer plover
#

Just checked, they are on the right place, I also transition layout of swpchain images and there is no problem

summer plover
#

I think the problem is with the descriptor set, do I need to update it after I transition layout of the image ?

#

No, it says it can't by anything else but in general layout

summer plover
#

@left falcon I looked at my older project and saw that it had VkPhysicalDeviceDescriptorIndexingFeatures enabled and descriptor pool was created with vk::DescriptorPoolCreateFlags::FREE_DESCRIPTOR_SET | vk::DescriptorPoolCreateFlags::UPDATE_AFTER_BIND , destriptor set layout was created with vk::DescriptorSetLayoutCreateFlags::UPDATE_AFTER_BIND_POOL flags. I enabled those and the erros went away. Though I still don't understand what caused the error and how enabling that extension fixes it

left falcon
#

Is there an earlier warning you're ignoring? Because just that extension/those flags shouldn't fix it.

#

If you were updating-after-bind, and that feature wasn't enabled, that would explain it. But I'd expect a warning about the update-after-bind not being supported.

summer plover
#

A moment, I can show the whole output I was getting from the layers

#

This is all I get when I don't have any extensions enabled

#

I didn't think that it was caused by some extension not being enabled since the layers usually tell if that's the case

#

the rust warnings are from variables not being used

left falcon
#

Well, your descriptor set is invalid I assume.

#

Because you don't have update-after-bind enabled

#

And you update it after binding it

summer plover
#

I'm confused, I bind them here but I don't touch them afterwards

#

And I update them before they are bound, that is when I create raytrace_output_image