andy-thomason / Vookoo

A set of utilities for taking the pain out of Vulkan in header only modern C++
MIT License
522 stars 52 forks source link

vku::VertexBuffer: add vk::BufferUsageFlagBits::eTransferDst to fix validation error #39

Closed mvd4 closed 3 years ago

mvd4 commented 3 years ago

When using vku::VertexBuffer::upload I get the following Vulkan validation message at runtime:

VUID-vkCmdCopyBuffer-dstBuffer-00120(ERROR / SPEC): msgNum: 1355715885 - Validation Error: [ VUID-vkCmdCopyBuffer-dstBuffer-00120 ] Object 0: handle = 0x6dc7200000000005, type = VK_OBJECT_TYPE_BUFFER; | MessageID = 0x50ce952d | Invalid usage flag for VkBuffer 0x6dc7200000000005[] used by vkCmdCopyBuffer(). In this case, VkBuffer should have VK_BUFFER_USAGE_TRANSFER_DST_BIT set during creation. The Vulkan spec states: dstBuffer must have been created with VK_BUFFER_USAGE_TRANSFER_DST_BIT usage flag (https://vulkan.lunarg.com/doc/view/1.2.170.0/windows/1.2-extensions/vkspec.html#VUID-vkCmdCopyBuffer-dstBuffer-00120)

I think this is due to the fact that the GenericBuffer base is created without setting the vk::BufferUsageFlagBits::eTransferDst flag. Hence this PR.

Thanks a lot for this library!

lhog commented 3 years ago

Sounds good. Thanks!

mvd4 commented 3 years ago

Just noticed that the same issue exists for vku::IndexBuffer, should I open another PR?

lhog commented 3 years ago

Yeah would be great while you are on it