mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-05 03:24:56 +08:00
engine: imagelib: add IL_HOST_ENDIAN flag to mark on-disk data that's already in host endianness
This commit is contained in:
@@ -87,6 +87,7 @@ typedef enum
|
|||||||
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)
|
IL_KTX2_RAW = BIT(8), // renderer can consume raw KTX2 files (e.g. ref_vk)
|
||||||
IL_ALLOW_WAD3_LUMA = BIT(9), // allow usage of luma textures in wad3 (tilde textures)
|
IL_ALLOW_WAD3_LUMA = BIT(9), // allow usage of luma textures in wad3 (tilde textures)
|
||||||
|
IL_HOST_ENDIAN = BIT(10), // buffer is already in host endian, skip byte-swapping
|
||||||
} ilFlags_t;
|
} ilFlags_t;
|
||||||
|
|
||||||
// goes into rgbdata_t->encode
|
// goes into rgbdata_t->encode
|
||||||
|
|||||||
@@ -437,7 +437,8 @@ qboolean Image_LoadMIP( const char *name, const byte *buffer, fs_offset_t filesi
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
memcpy( &mip, buffer, sizeof( mip ));
|
memcpy( &mip, buffer, sizeof( mip ));
|
||||||
le_struct_swap( mip_swap, &mip );
|
if( !Image_CheckFlag( IL_HOST_ENDIAN ))
|
||||||
|
le_struct_swap( mip_swap, &mip );
|
||||||
image.width = mip.width;
|
image.width = mip.width;
|
||||||
image.height = mip.height;
|
image.height = mip.height;
|
||||||
|
|
||||||
|
|||||||
@@ -2723,6 +2723,7 @@ static void Mod_InitSkyClouds( model_t *mod, const mip_t *mt, texture_t *tx, qbo
|
|||||||
if( custom_palette )
|
if( custom_palette )
|
||||||
size += sizeof( short ) + 768;
|
size += sizeof( short ) + 768;
|
||||||
|
|
||||||
|
Image_SetForceFlags( IL_HOST_ENDIAN );
|
||||||
r_sky = FS_LoadImage( texname, (byte *)mt, size );
|
r_sky = FS_LoadImage( texname, (byte *)mt, size );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -2905,7 +2906,7 @@ static void Mod_LoadTextureData( model_t *mod, dbspmodel_t *bmod, int textureInd
|
|||||||
const size_t size = Mod_CalculateMipTexSize( mipTex, usesCustomPalette );
|
const size_t size = Mod_CalculateMipTexSize( mipTex, usesCustomPalette );
|
||||||
|
|
||||||
Q_snprintf( texName, sizeof( texName ), "#%s:%s.mip", loadstat.name, mipTex->name );
|
Q_snprintf( texName, sizeof( texName ), "#%s:%s.mip", loadstat.name, mipTex->name );
|
||||||
Image_SetForceFlags( texture_force_flags );
|
Image_SetForceFlags( texture_force_flags | IL_HOST_ENDIAN );
|
||||||
texture->gl_texturenum = ref.dllFuncs.GL_LoadTexture( texName, (byte *)mipTex, size, txFlags );
|
texture->gl_texturenum = ref.dllFuncs.GL_LoadTexture( texName, (byte *)mipTex, size, txFlags );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2938,7 +2939,7 @@ static void Mod_LoadTextureData( model_t *mod, dbspmodel_t *bmod, int textureInd
|
|||||||
|
|
||||||
Q_snprintf( texName, sizeof( texName ), "#%s:%s_luma.mip", loadstat.name, mipTex->name );
|
Q_snprintf( texName, sizeof( texName ), "#%s:%s_luma.mip", loadstat.name, mipTex->name );
|
||||||
|
|
||||||
Image_SetForceFlags( texture_force_flags );
|
Image_SetForceFlags( texture_force_flags | IL_HOST_ENDIAN );
|
||||||
|
|
||||||
if( mipTex->offsets[0] > 0 )
|
if( mipTex->offsets[0] > 0 )
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user