iopdia.blogg.se

Offset father of 4 zip vk
Offset father of 4 zip vk










#OFFSET FATHER OF 4 ZIP VK CODE#

Here's my code for mapping the image data: auto dds = load_dds("img.dds") Īuto *destData = static_cast(vkImageMapPtr) // Pointer to mapped memory of VkImageĭestData += layout.offset() // layout = VkImageLayout of the imageįor(auto y=decltype(hBlocks) y typeIndex is set to 1 In OpenGL I've used GL_COMPRESSED_RGBA_S3TC_DXT1_EXT as image format, for Vulkan I'm using VK_FORMAT_BC1_RGBA_UNORM_BLOCK, which should be equivalent. In OpenGL this can be done using glCompressedTexImage2D, and this has worked for me in the past. Since S3TC compression is directly supported by the hardware, it should be possible to use the image data without decompressing it first. My image is a normal 2D image (0 layers, 1 mipmap), so there's no arrayPitch or depthPitch. On implementations that store depth and stencil aspects interleaved, the same offset and size are returned and represent the interleaved memory allocation.

offset father of 4 zip vk

On implementations that store depth and stencil aspects separately, querying each of these subresource layouts will return a different offset and size representing the region of memory used for that aspect. For depth/stencil formats, aspect must be either VK_IMAGE_ASPECT_DEPTH_BIT or VK_IMAGE_ASPECT_STENCIL_BIT. depthPitch is defined only for 3D images.įor color formats, the aspectMask member of VkImageSubresource must be VK_IMAGE_ASPECT_COLOR_BIT. (x,y,z,layer) are in block coordinatesĪddress(x,y,z,layer) = layer arrayPitch + zdepthPitch + y rowPitch + xblockSize + offset ĪrrayPitch is undefined for images that were not created as arrays. depthPitch is the number of bytes between blocks in adjacent slices of a 3D image. arrayPitch is the number of bytes between blocks in adjacent array layers. (x,y,z,layer) are in texel coordinatesĪddress(x,y,z,layer) = layer arrayPitch + zdepthPitch + y rowPitch + xtexelSize + offsetįor compressed formats, the rowPitch is the number of bytes between compressed blocks in adjacent rows.

offset father of 4 zip vk

Expressed as an addressing formula, the starting byte of a texel in the subresource has address: depthPitch is the number of bytes between texels with the same x and y coordinate in adjacent slices of a 3D image (z coordinates differ by one). arrayPitch is the number of bytes between texels with the same x and y coordinate in adjacent array layers of the image (array layer values differ by one). For uncompressed formats, rowPitch is the number of bytes between texels with the same x coordinate in adjacent rows (y coordinates differ by one). The image is encoded as a normal 2D raster image in which each 4×4 block is treated as a single pixel.įor images created with linear tiling, rowPitch, arrayPitch and depthPitch describe the layout of the subresource in linear memory. Here is what the Vulkan specification says about compressed images:Ĭompressed texture images stored using the S3TC compressed image formats are represented as a collection of 4×4 texel blocks, where each block contains 64 or 128 bits of texel data. I've been trying to load compressed images with S3TC (BC/DXT) compression in Vulkan, but so far I haven't had much luck.










Offset father of 4 zip vk