Vulkan-ValidationLayers
Vulkan-ValidationLayers copied to clipboard
VUID-VkImageCopy-dstOffset and copying form UINT format to DXT (BC)
[From LunarXchange] Operating System | Win 10 Graphics Card | any Driver | any SDK Version 2.141.0
There could be an issue with VL when copying from uncompressed (UINT) formats to comrpessed (DXT), or I'm doing something wrong there. :/ (There are some problems with lower mipmaps, size less than 4x4). Here...
Validation Error: [ VUID-VkImageCopy-dstOffset-00150 ] Object 0: handle = 0x22931790, type = VK_OBJECT_TYPE_COMMAND_BUFFER; | MessageID = 0x5c912440 | vkCmdCopyImage(): Dest image pRegion 0 x-dimension offset [0] + extent [4] exceeds subResource width [2]. The Vulkan spec states: dstOffset.x and (extent.width + dstOffset.x) must both be greater than or equal to 0 and less than or equal to the destination image subresource width (https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VUID-VkImageCopy-dstOffset-00150)
Validation Error: [ VUID-VkImageCopy-dstOffset-00151 ] Object 0: handle = 0x22931790, type = VK_OBJECT_TYPE_COMMAND_BUFFER; | MessageID = 0xb73b73ad | vkCmdCopyImage(): Dest image pRegion 0 y-dimension offset [0] + extent [4] exceeds subResource height [2]. The Vulkan spec states: dstOffset.y and (extent.height + dstOffset.y) must both be greater than or equal to 0 and less than or equal to the destination image subresource height (https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VUID-VkImageCopy-dstOffset-00151)
pvkCmdCopyImage( vkCmdBuf, vkSrcImage, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, vkDstImage, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, &vkImgCopy);
- vkImgCopy {srcSubresource={aspectMask=1 mipLevel=0 baseArrayLayer=0 ...} srcOffset={x=0 y=0 z=0 } dstSubresource=...} const VkImageCopy
- srcSubresource {aspectMask=1 mipLevel=0 baseArrayLayer=0 ...} VkImageSubresourceLayers aspectMask 1 unsigned int mipLevel 0 unsigned int baseArrayLayer 0 unsigned int layerCount 1 unsigned int
- srcOffset {x=0 y=0 z=0 } VkOffset3D x 0 int y 0 int z 0 int
- dstSubresource {aspectMask=1 mipLevel=8 baseArrayLayer=0 ...} VkImageSubresourceLayers aspectMask 1 unsigned int mipLevel 8 unsigned int baseArrayLayer 0 unsigned int layerCount 1 unsigned int
- dstOffset {x=0 y=0 z=0 } VkOffset3D x 0 int y 0 int z 0 int
- extent {width=1 height=1 depth=1 } VkExtent3D width 1 unsigned int height 1 unsigned int depth 1 unsigned int
vkSrcImage cration info:
Type VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO (14) VkStructureType pNext 0x0000000000000000 const void * flags 0 unsigned int imageType VK_IMAGE_TYPE_2D (1) VkImageType format VK_FORMAT_R16G16B16A16_UINT (95) VkFormat
- extent {width=512 height=512 depth=1 } VkExtent3D mipLevels 1 unsigned int arrayLayers 1 unsigned int samples VK_SAMPLE_COUNT_1_BIT (1) VkSampleCountFlagBits tiling VK_IMAGE_TILING_OPTIMAL (0) VkImageTiling usage 23 unsigned int sharingMode VK_SHARING_MODE_EXCLUSIVE (0) VkSharingMode queueFamilyIndexCount 0 unsigned int
- pQueueFamilyIndices 0x0000000000000000 {???} const unsigned int * initialLayout VK_IMAGE_LAYOUT_UNDEFINED (0) VkImageLayout
vkDstImage cration info:
sType VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO (14) VkStructureType pNext 0x0000000063b2f238 const void * flags 8 unsigned int imageType VK_IMAGE_TYPE_2D (1) VkImageType format VK_FORMAT_BC1_RGB_UNORM_BLOCK (131) VkFormat
- extent {width=512 height=512 depth=1 } VkExtent3D mipLevels 10 unsigned int arrayLayers 350 unsigned int samples VK_SAMPLE_COUNT_1_BIT (1) VkSampleCountFlagBits tiling VK_IMAGE_TILING_OPTIMAL (0) VkImageTiling usage 7 unsigned int sharingMode VK_SHARING_MODE_EXCLUSIVE (0) VkSharingMode queueFamilyIndexCount 0 unsigned int
- pQueueFamilyIndices 0x0000000000000000 {???} const unsigned int * initialLayout VK_IMAGE_LAYOUT_UNDEFINED (0) VkImageLayout
Same problem. Any news on this?
Ran into this in test_copy_texture_bc_rgba in vkd3d-proton.
Update (aka finally working on this)
here is a test to reproduce
TEST_F(PositiveCopyBufferImage, CopyCompressLowestMip) {
TEST_DESCRIPTION("https://github.com/KhronosGroup/Vulkan-ValidationLayers/issues/1946");
RETURN_IF_SKIP(Init());
VkImageCreateInfo image_ci = vku::InitStructHelper();
image_ci.flags = 0u;
image_ci.imageType = VK_IMAGE_TYPE_2D;
image_ci.format = VK_FORMAT_BC1_RGB_UNORM_BLOCK;
image_ci.extent = {512u, 512u, 1u};
image_ci.mipLevels = 10u;
image_ci.arrayLayers = 1u;
image_ci.samples = VK_SAMPLE_COUNT_1_BIT;
image_ci.tiling = VK_IMAGE_TILING_OPTIMAL;
image_ci.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
image_ci.usage = VK_IMAGE_USAGE_TRANSFER_DST_BIT;
if (!ImageFormatIsSupported(instance(), Gpu(), image_ci, VK_FORMAT_FEATURE_TRANSFER_DST_BIT)) {
GTEST_SKIP() << "image format not supported";
}
vkt::Image dst_image(*m_device, image_ci);
image_ci.format = VK_FORMAT_R16G16B16A16_UINT;
image_ci.usage = VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
image_ci.mipLevels = 1;
if (!ImageFormatIsSupported(instance(), Gpu(), image_ci, VK_FORMAT_FEATURE_TRANSFER_SRC_BIT)) {
GTEST_SKIP() << "image format not supported";
}
vkt::Image src_image(*m_device, image_ci);
m_command_buffer.Begin();
src_image.SetLayout(m_command_buffer, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL);
dst_image.SetLayout(m_command_buffer, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL);
VkImageCopy image_copy;
image_copy.srcSubresource = {1u, 0u, 0u, 1u};
image_copy.srcOffset = {0, 0, 0};
image_copy.dstSubresource = {1u, 8u, 0u, 1u};
image_copy.dstOffset = {0, 0, 0};
image_copy.extent = {1u, 1u, 1u};
vk::CmdCopyImage(m_command_buffer, src_image, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, dst_image,
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1u, &image_copy);
m_command_buffer.End();
}
and the current errors you will get
Validation Error: [ VUID-vkCmdCopyImage-dstOffset-00150 ] | MessageID = 0x38b5face
vkCmdCopyImage(): pRegions[0].dstOffset.x (0) + extent (4) exceeds miplevel 8 width (2).
Validation Error: [ VUID-vkCmdCopyImage-dstOffset-00151 ] | MessageID = 0x4bb17a0e
vkCmdCopyImage(): pRegions[0].dstOffset.y (0) + extent (4) exceeds miplevel 8 height (2).
@HansKristian-Work I didn't get to 100% confirm with test_copy_texture_bc_rgba yet, but 99% sure we have fixed the problem