From c7f18d7abe87c5abd7616d11073ec47905b57c82 Mon Sep 17 00:00:00 2001 From: ncuxonaT Date: Tue, 25 Nov 2025 00:21:17 +0300 Subject: [PATCH] dds volume texture fix - img_dds.c --- engine/common/imagelib/img_dds.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/engine/common/imagelib/img_dds.c b/engine/common/imagelib/img_dds.c index fa840345..9678c348 100644 --- a/engine/common/imagelib/img_dds.c +++ b/engine/common/imagelib/img_dds.c @@ -218,14 +218,15 @@ static void Image_DXTGetPixelFormat( dds_t *hdr, dds_header_dxt10_t *headerExt ) static size_t Image_DXTCalcMipmapSize( dds_t *hdr ) { size_t buffsize = 0; - int i, width, height; + int i, width, height, depth; // now correct buffer size for( i = 0; i < Q_max( 1, ( hdr->dwMipMapCount )); i++ ) { width = Q_max( 1, ( hdr->dwWidth >> i )); height = Q_max( 1, ( hdr->dwHeight >> i )); - buffsize += Image_ComputeSize( image.type, width, height, image.depth ); + depth = Q_max( 1, ( image.depth >> i )); + buffsize += Image_ComputeSize( image.type, width, height, depth ); } return buffsize; @@ -368,6 +369,9 @@ qboolean Image_LoadDDS( const char *name, const byte *buffer, fs_offset_t filesi SetBits( image.flags, IMAGE_HAS_ALPHA ); if( !FBitSet( header.dsPixelFormat.dwFlags, DDS_LUMINANCE )) SetBits( image.flags, IMAGE_HAS_COLOR ); + if (image.type == PF_BGRA_32 || image.type == PF_RGBA_32) + SetBits( image.flags, IMAGE_HAS_ALPHA ); + break; }