Skip to content

Consider renaming BufferCopyView.imageHeight #148

Closed

Description

@kainino0x

@kainino0x:

Looking at it in this CL, I don't love the name imageHeight - it's kind of confusing what it means. We can update that later in sketch.webidl though, it doesn't block this CL.

maybe imagePitchInRows? slicePitchInRows? slicePitchHeight? "slice" may sort of collide with the 2darray meaning of "slice", but that's technically correct (I think) and "image" seems worse.

Brandon Jones (Intel):

I agree. Above all I'd like consistency with rowPitch, so columnPitch?

Additionally, units should match (both in bytes, or both in texels).

@Kangz:

rowPitchInTexels is weird because we still need to keep the 256 byte alignment and that wouldn't be possible to express for 3-byte formats if we ever support them (256 is 85.3333.. texels).

columnPitchInBytes is weird too because it has to be a multiple of rowPitchInBytes so why not just express it as columnPitchInRowPitches which is the same as columnPitchInTexels?

Anyway that's a good question, can you raise an issue / PR and we can discuss it in the next meeting.

Original discussion here

Activity

  1. kainino0x commented on Dec 11, 2018

    @kainino0x
    ContributorAuthor

    To add on, I don't think "column" is the right name because the "spacing" from one column to the next is just the spacing from one texel to the next (within a row).

    i.e. from (x, y, z),
    column+1 is (x+1, y, z)
       row+1 is (x, y+1, z)
     slice+1 is (x, y, z+1)
    
  2. kvark commented on Dec 13, 2018

    @kvark
    Contributor

    How about rowCount?

  3. litherum commented on Dec 13, 2018

    @litherum
    Contributor

    I vote for height, meaning "a collection of rowPitches." This is how every other graphics API I've used describes it.

  4. kainino0x commented on Dec 13, 2018

    @kainino0x
    ContributorAuthor

    It seems misleading to me to refer to a stride/pitch as a "height" or "row count". Doesn't "height" kind of make it sound like the BufferCopyView.height and the Extent3D.height have to be equal?

  5. litherum commented on Dec 13, 2018

    @litherum
    Contributor

    Isn't that what it is?

    If not, then I change my vote to imagePitch to match rowPitch.

  6. kainino0x commented on Dec 13, 2018

    @kainino0x
    ContributorAuthor

    No, it doesn't have to be the same, I'm pretty sure. Just like the row pitch can be larger than the length of the actual data in a row, the image pitch can be larger than the height of an the actual data in an image. If it does have to be the same, we shouldn't have both.

    imagePitch or slicePitch is okay with me, but I still don't love using the "image" terminology here because it feels unnecessarily overloaded (e.g. a VkImage is a texture, and can be 3d).

  7. kainino0x commented on Dec 13, 2018

    @kainino0x
    ContributorAuthor

    Vulkan uses:

    rowPitch describes the number of bytes between each row of texels in an image.
    arrayPitch describes the number of bytes between each array layer of an image.
    depthPitch describes the number of bytes between each slice of 3D image.

  8. aloucks commented on Jun 9, 2019

    @aloucks

    Vulkan uses:

    rowPitch describes the number of bytes between each row of texels in an image.
    arrayPitch describes the number of bytes between each array layer of an image.
    depthPitch describes the number of bytes between each slice of 3D image.

    But, that's not what it uses when copying the buffer data.

    typedef struct VkBufferImageCopy {
        VkDeviceSize                bufferOffset;
        uint32_t                    bufferRowLength;
        uint32_t                    bufferImageHeight;
        VkImageSubresourceLayers    imageSubresource;
        VkOffset3D                  imageOffset;
        VkExtent3D                  imageExtent;
    } VkBufferImageCopy;
    

    bufferRowLength and bufferImageHeight specify in texels a subregion of a larger two- or three-dimensional image in buffer memory, and control the addressing calculations. If either of these values is zero, that aspect of the buffer memory is considered to be tightly packed according to the imageExtent.

    As a non-expert, the suggested names in the previous comments are confusing. imageHeight is pretty straight forward. Having having rowPitch in bytes and imageHeight in texels is also super weird.

    https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VUID-VkBufferImageCopy-bufferRowLength-00195

    bufferRowLength must be 0, or greater than or equal to the width member of imageExtent

    Changing rowPitch to rowLength and specifying in texels makes more sense to me than changing the imageHeight name. Again, I'm not an expert and I don't fully understand the alignment concerns, but conceptually it's much easier to understand when, in the typical case, these values translate to image width and height in pixels.

  9. kdashg commented on Jun 11, 2019

    @kdashg
    Contributor

    FWIW, rowPitch in bytes and imageHeight in rows-of-texels is what I'd expect them to be, and shouldn't be too confusing for those with experience from other APIs. (which is the primary expected audience)

    That said, Vulkan's clearly using texel-per-row there, as does D3D12:
    https://docs.microsoft.com/en-us/windows/desktop/api/d3d12/nf-d3d12-id3d12graphicscommandlist-copytextureregion

    Metal appears to use bytes-per-row and even bytes-per-image:
    https://developer.apple.com/documentation/metal/mtlblitcommandencoder

  10. kainino0x commented on Jun 11, 2019

    @kainino0x
    ContributorAuthor

    flyby: I haven't yet been able to figure out how Vulkan/D3D12's texels-per-row works, given the problem quoted above:

    rowPitchInTexels is weird because we still need to keep the 256 byte alignment and that wouldn't be possible to express for 3-byte formats if we ever support them (256 is 85.3333.. texels).

  11. kdashg commented on Jun 13, 2019

    @kdashg
    Contributor

    Vulkan appears to require bytesPerRow to be tightly strided, that is N*bytesPerTexel/Block.

  12. kainino0x commented on Jun 25, 2019

    @kainino0x
    ContributorAuthor

    That makes it seem like we need the same restriction, and we could represent row pitch the same way.

  13. kainino0x commented on Dec 14, 2019

    @kainino0x
    ContributorAuthor

    I stumbled on this again (#517) and I want to do something about it.

    How does zPitch or zPitchInRows sound, where it's in units of "rowPitch bytes"? "z" encompasses both "layer" and "depth" elsewhere in the API already.

    I think we should stick with rowPitch being in bytes. I, at least, find it more intuitive since I'm already thinking about the buffer in bytes.

  14. added a commit that references this issue on Jan 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions