Skip to content

Commit

Permalink
Fix ktxTexture2_DecodeAstc documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkCallow committed Nov 29, 2024
1 parent d1ad5cd commit c16537c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cmake/docs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ function( CreateDocLibKTX )
libktx.doc
lib/libktx_mainpage.md
include
lib/astc_encode.cpp
lib/astc_codec.cpp
lib/basis_encode.cpp
lib/basis_transcode.cpp
lib/miniz_wrapper.cpp
Expand Down
16 changes: 10 additions & 6 deletions lib/astc_codec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,7 @@ compressionWorkloadRunner(int threadCount, int threadId, void* payload) {
}

/**
* @internal
* @brief Worker thread helper payload for launchThreads.
*/
struct LaunchDesc {
Expand All @@ -528,6 +529,7 @@ struct LaunchDesc {
};

/**
* @internal
* @brief Helper function to translate thread entry points.
*
* Convert a (void*) thread entry to an (int, void*) thread entry, where the
Expand Down Expand Up @@ -902,6 +904,7 @@ struct decompression_workload
};

/**
* @internal
* @brief Runner callback function for a decompression worker thread.
*
* @param thread_count The number of threads in the worker pool.
Expand All @@ -923,19 +926,20 @@ static void decompression_workload_runner(int thread_count, int thread_id, void*
}

/**
* @brief Decodes the provided ktx2 texture if its astc encoded
* @ingroup reader
* @brief Decodes a ktx2 texture object, if it is ASTC encoded.
*
* Updates @p This with the decoded image.
*
* @param This The texture to decode
* @param vkformat The decoding format to use
*/
// will update "This" with the uncompressed copy
KTX_API KTX_error_code KTX_APIENTRY
KTX_error_code
ktxTexture2_DecodeAstc(ktxTexture2 *This, ktx_uint32_t vkformat) {
// Decompress This using astc-decoder
uint32_t* BDB = This->pDfd + 1;
khr_df_model_e colorModel = (khr_df_model_e)KHR_DFDVAL(BDB, MODEL);
if (colorModel != KHR_DF_MODEL_ASTC && This->supercompressionScheme != KTX_SS_NONE) // No supercompression supported yet
{
if (colorModel != KHR_DF_MODEL_ASTC) {
return KTX_INVALID_OPERATION; // Not in valid astc decodable format
}

Expand Down Expand Up @@ -1008,7 +1012,7 @@ ktxTexture2_DecodeAstc(ktxTexture2 *This, ktx_uint32_t vkformat) {

// if(params->perceptual) flags |= ASTCENC_FLG_USE_PERCEPTUAL;

uint32_t threadCount{1}; // Decompression isn't the bottlneck and only used when checking for psnr and ssim
uint32_t threadCount{1}; // Decompression isn't the bottleneck and only used when checking for psnr and ssim
astcenc_config astc_config;
astcenc_context *astc_context;
astcenc_error astc_error = astcenc_config_init(profile,
Expand Down

0 comments on commit c16537c

Please sign in to comment.