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

Profiles example has bad copy because buffer is not large enough #1290

Open
spencer-lunarg opened this issue Mar 7, 2025 · 0 comments
Open

Comments

@spencer-lunarg
Copy link
Contributor

The profiles demo on RADV looks like this

Image

With

Validation Error: [ VUID-vkCmdCopyBufferToImage-pRegions-00171 ] | MessageID = 0x6f4d3c00
vkCmdCopyBufferToImage(): pRegions[0] is trying to copy 16 bytes + 0 offset to/from the (VkBuffer 0x210d07000000003a) which exceeds the VkBuffer total size of 8 bytes.
The Vulkan spec states: srcBuffer must be large enough to contain all buffer locations that are accessed according to Buffer and Image Addressing, for each element of pRegions (https://docs.vulkan.org/spec/latest/chapters/copies.html#VUID-vkCmdCopyBufferToImage-pRegions-00171)
Objects: 2
    [0] VkCommandBuffer 0x58293520cef0
    [1] VkBuffer 0x210d07000000003a

The following change fixes it because the create_staging_buffer is doing sizeof(VkDeviceSize) underneath and is only creating an 8 byte buffer instead of 16 like it should

diff --git a/samples/tooling/profiles/profiles.cpp b/samples/tooling/profiles/profiles.cpp
index c583ff9..18401e9 100644
--- a/samples/tooling/profiles/profiles.cpp
+++ b/samples/tooling/profiles/profiles.cpp
@@ -253,7 +253,8 @@ void Profiles::generate_textures()
        image_view.subresourceRange.baseArrayLayer = 0;
        image_view.subresourceRange.layerCount     = 1;
 
-       auto staging_buffer = vkb::core::BufferC::create_staging_buffer(get_device(), image_info.extent.width * image_info.extent.height * sizeof(uint32_t));
+       uint32_t dummy[16];
+       auto staging_buffer = vkb::core::BufferC::create_staging_buffer(get_device(), image_info.extent.width * image_info.extent.height * sizeof(uint32_t), &dummy);
 
        textures.resize(32);
        for (size_t i = 0; i < textures.size(); i++)
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