KhronosGroup / KhronosGroup/Vulkan-Docs
Clarify behaviour of `vkCmdCopyImage` with non-whole texel blocks
@fluppeteer is already working on this.
Since Apr 11, 2022.
- Dominant language
- JavaScript
- Stars
- 3.3k
- Forks
- 549
- Avg merge
- 5d 5h
- Merged PRs (30d)
- 2
Description
vkCmdCopyImage allows copying between uncompressed and compressed formats as long as the block sizes of the two formats match. VUID-vkCmdCopyImage-srcImage-01728 states in this regard:
If
srcImageis a blocked image, then for each element ofpRegions,extent.widthmust be a multiple of the compressed texel block width or (extent.width+srcOffset.x) must equal the width of the specifiedsrcSubresourceofsrcImage
The second half of this VUID seems to mean that if I'm copying the whole subresource width, then the width does not have to be an exact multiple of the texel block width. In this case, what data ends up being copied? Copying only a part of a compressed texel block seems broken. It matters in particular when copying to an uncompressed format, because of this part of the spec:
When copying between compressed and uncompressed formats the
extentmembers represent the texel dimensions of the source image and not the destination. When copying from a compressed image to an uncompressed image the image texel dimensions written to the uncompressed image will be source extent divided by the compressed texel block dimensions. When copying from an uncompressed image to a compressed image the image texel dimensions written to the compressed image will be the source extent multiplied by the compressed texel block dimensions. In both cases the number of bytes read and the number of bytes written will be identical.
Let's say I copy from VK_FORMAT_BC3_UNORM_BLOCK to VK_FORMAT_R32G32B32A32_UINT, both with a 16 byte block size. The former has a texel block width of 4, the latter of 1. If the subresource being copied from the source is, let's say, 3 texels wide, then what width does this represent on the destination image? 3/4 of a texel? Knowing this is important because one needs to check if the copied offset and width doesn't exceed the width of the destination image.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.