Skip to content

Commit

Permalink
Fix MSVC and GCC compile errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkCallow committed Dec 12, 2024
1 parent ec32f1a commit 13cc51e
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions lib/astc_codec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -592,25 +592,31 @@ mapAstcError(astcenc_error astc_error) {
return KTX_SUCCESS;
case ASTCENC_ERR_OUT_OF_MEM:
return KTX_OUT_OF_MEMORY;
case ASTCENC_ERR_BAD_BLOCK_SIZE: [[fallthrough]];
case ASTCENC_ERR_BAD_DECODE_MODE: [[fallthrough]];
case ASTCENC_ERR_BAD_FLAGS: [[fallthrough]];
case ASTCENC_ERR_BAD_PARAM: [[fallthrough]];
case ASTCENC_ERR_BAD_PROFILE: [[fallthrough]];
case ASTCENC_ERR_BAD_QUALITY: [[fallthrough]];
case ASTCENC_ERR_BAD_BLOCK_SIZE: //[[fallthrough]];
case ASTCENC_ERR_BAD_DECODE_MODE: //[[fallthrough]];
case ASTCENC_ERR_BAD_FLAGS: //[[fallthrough]];
case ASTCENC_ERR_BAD_PARAM: //[[fallthrough]];
case ASTCENC_ERR_BAD_PROFILE: //[[fallthrough]];
case ASTCENC_ERR_BAD_QUALITY: //[[fallthrough]];
case ASTCENC_ERR_BAD_SWIZZLE:
assert(false && "libktx passing bad parameter to astcenc");
return KTX_INVALID_VALUE;
case ASTCENC_ERR_BAD_CONTEXT:
assert(false && "libktx has set up astcenc context incorrectly");
return KTX_INVALID_OPERATION;
case ASTCENC_ERR_BAD_CPU_FLOAT:
assert(false && "Code compiled in way that float operations do not meet codec's assumptions.");
assert(false && "Code compiled such that float operations do not meet codec's assumptions.");
// Most likely compiled with fast match enabled.
return KTX_INVALID_OPERATION;
case ASTCENC_ERR_NOT_IMPLEMENTED:
assert(false && "ASTCENC_BLOCK_MAX_TEXELS not enough for specified block size");
return KTX_UNSUPPORTED_FEATURE;
// gcc fails to detect that the switch handles all astcenc_error
// enumerators and raises a return-type error, "control reaches end of
// non-void function", hence this
default:
assert(false && "Unhandled astcenc error");
return KTX_INVALID_OPERATION;
}
}

Expand Down

0 comments on commit 13cc51e

Please sign in to comment.