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

Request for clarification of the usage notes on vkCmdCopyBufferToImage #676

Closed
haasn opened this issue Mar 10, 2018 · 3 comments
Closed

Request for clarification of the usage notes on vkCmdCopyBufferToImage #676

haasn opened this issue Mar 10, 2018 · 3 comments
Assignees

Comments

@haasn
Copy link

@haasn haasn commented Mar 10, 2018

The Valid Usage section of vkCmdCopyBufferToImage states the following:

The buffer region specified by each element of pRegions must be a region that is contained within srcBuffer

However, I'm having trouble answering this question about a corner case: Suppose I have a 64x64 2D image, and I present an upload operation that looks like this:

(VkBufferImageCopy) {
    .imageOffset = {0, 0, 0},
    .imageExtent = {2, 2, 1},
    .bufferRowLength = 64,
    ...
}

In other words, I'm uploading a 2x2 subregion, with a horizontal stride of 64. What is the minimum buffer size (in texels) for this to be a valid operation? Is it 128 (imageExtent.height * bufferRowLength) since I'm transferring two rows of a 2D image, or is it 66 (2 pixels + 62 pixels of padding + 2 more pixels) since that's the minimum contiguous region that contains all of the pixels to be transferred and no superfluous padding as a result of the stride?

In image processing it's often typical for the padding at the end of the last row of the included, that is, the total size is typically calculated as height * stride, rather than (height - 1) * stride + width. But it would seem to me that, strictly speaking, this extra padding isn't necessary. Is this correct?

@krOoze
Copy link
Contributor

@krOoze krOoze commented Mar 10, 2018

The spec works under the assumption that "region" is the copied part only (and the rest is left untouched).
So I would assume the later.

@jeffbolznv
Copy link
Contributor

@jeffbolznv jeffbolznv commented Apr 13, 2018

Right, the answer would be 66. We'll clarify this in the spec.

@oddhack
Copy link
Contributor

@oddhack oddhack commented Apr 21, 2018

This should be fixed in the 1.1.74 spec update.

@oddhack oddhack closed this Apr 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.