external/the-forge/Common_3/ThirdParty/OpenSource/tinyktx/tinyktx.h
bool TinyKtx_IsMipMapLevelUnpacked(TinyKtx_ContextHandle handle, uint32_t mipmaplevel) {
	TinyKtx_Context *ctx = (TinyKtx_Context *) handle;
	if (ctx == NULL)
		return false;
	if (ctx->headerValid == false) {
		ctx->callbacks.errorFn(ctx->user, "Header data hasn't been read yet or its invalid");
		return false;
	}

	if (ctx->header.glTypeSize < 4 &&
			TinyKtx_ByteDividableFromGLType(ctx->header.glType)) {

		uint32_t const s = ctx->header.glTypeSize;
		uint32_t const n = TinyKtx_ElementCountFromGLFormat(ctx->header.glFormat);
		if (n == 0) {
			ctx->callbacks.errorFn(ctx->user, "TinyKtx_ElementCountFromGLFormat error");
			return false;
		}

		uint32_t const w = TinyKtx_MipMapReduce(ctx->header.pixelWidth, mipmaplevel);
		uint32_t const snl = s * n * w;
		uint32_t const k = ((snl + 3u) & ~3u);

		if(k != snl) {
			return true;
		}
	}
	return false;
}
// KTX specifys GL_UNPACK_ALIGNMENT = 4 which means some files have unexpected padding
// that probably means you can't just memcpy the data out if you aren't using a GL
// texture with GL_UNPACK_ALIGNMENT of 4
// this will be true if this mipmap level is 'unpacked' so has padding on each row
// you will need to handle.
KTX specifys GL_UNPACK_ALIGNMENT = 4 which means some files have unexpected padding
that probably means you can't just memcpy the data out if you aren't using a GL
texture with GL_UNPACK_ALIGNMENT of 4
this will be true if this mipmap level is 'unpacked' so has padding on each row
you will need to handle.
KTX specifys GL_UNPACK_ALIGNMENT = 4 which means some files have unexpected padding that probably means you can ' t just memcpy the data out if you aren ' t using a GL texture with GL_UNPACK_ALIGNMENT of 4 this will be true if this mipmap level is ' unpacked ' so has padding on each row you will need to handle .
bool TinyKtx_IsMipMapLevelUnpacked(TinyKtx_ContextHandle handle, uint32_t mipmaplevel) {
	TinyKtx_Context *ctx = (TinyKtx_Context *) handle;
	if (ctx == NULL)
		return false;
	if (ctx->headerValid == false) {
		ctx->callbacks.errorFn(ctx->user, "Header data hasn't been read yet or its invalid");
		return false;
	}
	if (ctx->header.glTypeSize < 4 &&
			TinyKtx_ByteDividableFromGLType(ctx->header.glType)) {
		uint32_t const s = ctx->header.glTypeSize;
		uint32_t const n = TinyKtx_ElementCountFromGLFormat(ctx->header.glFormat);
		if (n == 0) {
			ctx->callbacks.errorFn(ctx->user, "TinyKtx_ElementCountFromGLFormat error");
			return false;
		}
		uint32_t const w = TinyKtx_MipMapReduce(ctx->header.pixelWidth, mipmaplevel);
		uint32_t const snl = s * n * w;
		uint32_t const k = ((snl + 3u) & ~3u);
		if(k != snl) {
			return true;
		}
	}
	return false;
}
bool TinyKtx_IsMipMapLevelUnpacked ( TinyKtx_ContextHandle handle , uint32_t mipmaplevel ) { TinyKtx_Context * ctx = ( TinyKtx_Context * ) handle ; if ( ctx == NULL ) return false ; if ( ctx -> headerValid == false ) { ctx -> callbacks . errorFn ( ctx -> user , " " ) ; return false ; } if ( ctx -> header . glTypeSize < 4 && TinyKtx_ByteDividableFromGLType ( ctx -> header . glType ) ) { uint32_t const s = ctx -> header . glTypeSize ; uint32_t const n = TinyKtx_ElementCountFromGLFormat ( ctx -> header . glFormat ) ; if ( n == 0 ) { ctx -> callbacks . errorFn ( ctx -> user , " " ) ; return false ; } uint32_t const w = TinyKtx_MipMapReduce ( ctx -> header . pixelWidth , mipmaplevel ) ; uint32_t const snl = s * n * w ; uint32_t const k = ( ( snl + 3u ) & ~ 3u ) ; if ( k != snl ) { return true ; } } return false ; }
KTX specifys GL_UNPACK_ALIGNMENT = 4 which means some files have unexpected padding
that probably means you can't just memcpy the data out if you aren't using a GL
texture with GL_UNPACK_ALIGNMENT of 4
this will be true if this mipmap level is 'unpacked' so has padding on each row
you will need to handle.
KTX specifys GL_UNPACK_ALIGNMENT = 4 which means some files have unexpected padding that probably means you can ' t just memcpy the data out if you aren ' t using a GL texture with GL_UNPACK_ALIGNMENT of 4 this will be true if this mipmap level is ' unpacked ' so has padding on each row you will need to handle .