src/ktx/libktx/vkloader.c
/**
 * @internal
 * @~English
 * @brief Callback for optimally tiled textures with no source row padding.
 *
 * Images must be preloaded into the staging buffer. Each iteration, i.e.
 * the value of @p faceLodSize must be for a complete mip level, regardless of
 * texture type. This should be used only with @c ktx_Texture_IterateLevels.
 *
 * Sets up a region to copy the data from the staging buffer to the final
 * image.
 *
 * @note @p pixels is not used.
 *
 * @copydetails PFNKTXITERCB
 */
@internal
@~English
@brief Callback for optimally tiled textures with no source row padding.

Images must be preloaded into the staging buffer.

Sets up a region to copy the data from the staging buffer to the final
image.

@note @p pixels is not used.

@copydetails PFNKTXITERCB
@internal @~English @brief Callback for optimally tiled textures with no source row padding . Images must be preloaded into the staging buffer . Sets up a region to copy the data from the staging buffer to the final image . @note @p pixels is not used . @copydetails PFNKTXITERCB
static KTX_error_code
optimalTilingCallback(int miplevel, int face,
                      int width, int height, int depth,
                      ktx_uint64_t faceLodSize,
                      void* pixels, void* userdata)
{
    user_cbdata_optimal* ud = (user_cbdata_optimal*)userdata;
#if defined(_DEBUG)
    assert(ud->region < ud->regionsArrayEnd);
#endif
    ud->region->bufferOffset = ud->offset;
    ud->offset += faceLodSize;
    ud->region->bufferRowLength = 0;
    ud->region->bufferImageHeight = 0;
    ud->region->imageSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
    ud->region->imageSubresource.mipLevel = miplevel;
    ud->region->imageSubresource.baseArrayLayer = face;
    ud->region->imageSubresource.layerCount = ud->numLayers * ud->numFaces;
    ud->region->imageOffset.x = 0;
    ud->region->imageOffset.y = 0;
    ud->region->imageOffset.z = 0;
    ud->region->imageExtent.width = width;
    ud->region->imageExtent.height = height;
    ud->region->imageExtent.depth = depth;
    ud->region += 1;
    return KTX_SUCCESS;
}
static KTX_error_code optimalTilingCallback ( int miplevel , int face , int width , int height , int depth , ktx_uint64_t faceLodSize , void * pixels , void * userdata ) { user_cbdata_optimal * ud = ( user_cbdata_optimal * ) userdata ; #if defined ( _DEBUG ) assert ( ud -> region < ud -> regionsArrayEnd ) ; #endif ud -> region -> bufferOffset = ud -> offset ; ud -> offset += faceLodSize ; ud -> region -> bufferRowLength = 0 ; ud -> region -> bufferImageHeight = 0 ; ud -> region -> imageSubresource . aspectMask = VK_IMAGE_ASPECT_COLOR_BIT ; ud -> region -> imageSubresource . mipLevel = miplevel ; ud -> region -> imageSubresource . baseArrayLayer = face ; ud -> region -> imageSubresource . layerCount = ud -> numLayers * ud -> numFaces ; ud -> region -> imageOffset . x = 0 ; ud -> region -> imageOffset . y = 0 ; ud -> region -> imageOffset . z = 0 ; ud -> region -> imageExtent . width = width ; ud -> region -> imageExtent . height = height ; ud -> region -> imageExtent . depth = depth ; ud -> region += 1 ; return KTX_SUCCESS ; }
@internal
 @~English
 @brief Callback for optimally tiled textures with no source row padding.
@internal @~English @brief Callback for optimally tiled textures with no source row padding .
// Set up copy to destination region in final image // These 2 are expressed in texels.