imagelib: check flags for DDS and KTX2 support
- Checks for `IL_DDS_HARDWARE` support for compressed formats in KTX2 - Checks for `IL_KTX2_RAW` before providing raw KTX2 data
This commit is contained in:
parent
ee81a7228d
commit
1834f388b8
|
@ -69,6 +69,7 @@ typedef enum
|
||||||
IL_LOAD_DECAL = BIT(5), // special mode for load gradient decals
|
IL_LOAD_DECAL = BIT(5), // special mode for load gradient decals
|
||||||
IL_OVERVIEW = BIT(6), // overview required some unque operations
|
IL_OVERVIEW = BIT(6), // overview required some unque operations
|
||||||
IL_LOAD_PLAYER_DECAL = BIT(7), // special mode for player decals
|
IL_LOAD_PLAYER_DECAL = BIT(7), // special mode for player decals
|
||||||
|
IL_KTX2_RAW = BIT(8), // renderer can consume raw KTX2 files (e.g. ref_vk)
|
||||||
} ilFlags_t;
|
} ilFlags_t;
|
||||||
|
|
||||||
// goes into rgbdata_t->encode
|
// goes into rgbdata_t->encode
|
||||||
|
|
|
@ -114,6 +114,11 @@ static qboolean Image_KTX2Parse( const ktx2_header_t *header, const byte *buffer
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( !Image_CheckFlag( IL_DDS_HARDWARE ) && ImageCompressed( image.type )) {
|
||||||
|
Con_DPrintf(S_WARN "%s: has compressed format, but support is not advertized\n", __FUNCTION__);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (header->pixelDepth > 1) {
|
if (header->pixelDepth > 1) {
|
||||||
Con_DPrintf(S_ERROR "%s: unsupported KTX2 pixelDepth %d\n", __FUNCTION__, header->pixelDepth);
|
Con_DPrintf(S_ERROR "%s: unsupported KTX2 pixelDepth %d\n", __FUNCTION__, header->pixelDepth);
|
||||||
return false;
|
return false;
|
||||||
|
@ -197,6 +202,9 @@ qboolean Image_LoadKTX2( const char *name, const byte *buffer, fs_offset_t files
|
||||||
image.num_mips = 1;
|
image.num_mips = 1;
|
||||||
|
|
||||||
if (!Image_KTX2Parse(&header, buffer, filesize)) {
|
if (!Image_KTX2Parse(&header, buffer, filesize)) {
|
||||||
|
if (!Image_CheckFlag( IL_KTX2_RAW ))
|
||||||
|
return false;
|
||||||
|
|
||||||
// If KTX2 to imagelib conversion failed, try passing the file as raw data.
|
// If KTX2 to imagelib conversion failed, try passing the file as raw data.
|
||||||
// This is useful for ref_vk which can directly support hundreds of formats which we don't convert to pixformat_t here
|
// This is useful for ref_vk which can directly support hundreds of formats which we don't convert to pixformat_t here
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ void initTextures( void ) {
|
||||||
vk_numTextures = 0;
|
vk_numTextures = 0;
|
||||||
|
|
||||||
// TODO really check device caps for this
|
// TODO really check device caps for this
|
||||||
gEngine.Image_AddCmdFlags( IL_DDS_HARDWARE );
|
gEngine.Image_AddCmdFlags( IL_DDS_HARDWARE | IL_KTX2_RAW );
|
||||||
|
|
||||||
tglob.default_sampler_fixme = pickSamplerForFlags(0);
|
tglob.default_sampler_fixme = pickSamplerForFlags(0);
|
||||||
ASSERT(tglob.default_sampler_fixme != VK_NULL_HANDLE);
|
ASSERT(tglob.default_sampler_fixme != VK_NULL_HANDLE);
|
||||||
|
|
Loading…
Reference in New Issue