Fix ktxTexture2_DecodeAstc error returns and document them. #961
+30
−8
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This started due to a warning when building documentation that
astc_encode.cpp
was not being found. After fixing that I noticed issues with the documentation forktxTexture2_DecodeAstc
which I fixed in c16537c. That commit also fixed an issue where the function would fail withKTX_INVALID_OPERATION
if a zlib or zstd supercompressed file had been opened without specifying the LOAD_DATA flag by removing the check forKTX_SS_NONE
.Subsequently I realized there still some supercompression scheme situations that need to be guarded against and I realized the function documentation was not listing the possible return values. While fixing these I spotted a write to stdout that this PR comments out. Libraries potentially used by GUI apps should not write to stdout. We could potentially add a flag parameter to request the ouput.
@wasimabbas-arm please review this PR.
Why do decoder failures return
KTX_INVALID_OPERATION
? Could you analyze the astcenc error and potentially map to other KTX_ errors? Alternatively should we add a new error such asKTX_ASTC_DECODE_FAILED
?KTX_INVALID_OPERATION
is intended for cases where the application has set things up in way that is invalid for the operation it is requesting.Adding unit tests for this function to texturetests would be a good thing. Tests of the encode function would be good too, if not already existing.