I create a very small image of VK_FORMAT_R32_SFLOAT
with an extent of {3, 3, 1}
and linear tiling.
Without any alignment-requirements my image should thus need 36 bytes.
Of course there are alignment-requirements, which i checked, and they are 32 bytes.
Thus, an overall memory-size of 64 bytes would seem logical to me, since this would be the first size that could fit my data and fulfill the alignment-requirements.
However, the VkMemoryRequirements
tells me that my image requires a size of 96 bytes.
I fear that i may be misunderstanding the alignment-requirements or may be overlooking some implementation-freedom here, and hope that someone can clarify this issue for me.
Thanks in advance!
vkGetImageSubresourceLayout
should give this information for linearly tiled images.
To be a bit more specific, implementations are allowed to vary the specification for linear images in a few specific ways. In particular, the byte offset from row-to-row, plane-to-plane, and array-layer-to-array-layer is not standardized. You must query it, and the data you provide must conform to what that implementation requires. You do this through vkGetImageSubresourceLayout
So odds are good that the rowPitch
of your image is not 3 * the size of the pixel (aka: 12). It’s probably something bigger, like 8 * the size of the pixel.
8x3x(32/8) indeed seems to check out. It is a thing of the GPU memory that it likes to work with 8x8 blocks.
Nb, alignment should not matter I think. That only changes where the allocation starts. Though the query returns offset
, where the driver might have some metadata.
This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.