From 25c01b62bb5f8f55da2165ca3f2fbfad1abb89c7 Mon Sep 17 00:00:00 2001 From: cxgeorge <> Date: Tue, 1 Jan 2002 01:09:40 +0000 Subject: [PATCH] force16bpp textures available in publish build --- panda/src/dxgsg/config_dxgsg.cxx | 2 +- panda/src/dxgsg/config_dxgsg.h | 2 +- panda/src/dxgsg/dxGraphicsStateGuardian.cxx | 2 +- panda/src/dxgsg/dxTextureContext.cxx | 22 ++++++--------------- 4 files changed, 9 insertions(+), 19 deletions(-) diff --git a/panda/src/dxgsg/config_dxgsg.cxx b/panda/src/dxgsg/config_dxgsg.cxx index e773fa5caf..78a5697e2d 100644 --- a/panda/src/dxgsg/config_dxgsg.cxx +++ b/panda/src/dxgsg/config_dxgsg.cxx @@ -74,11 +74,11 @@ bool dx_ignore_mipmaps = config_dxgsg.GetBool("dx-ignore-mipmaps", false); // if this is set, more accurate but more expensive fog computations are performed bool dx_use_rangebased_fog = config_dxgsg.GetBool("dx-use-rangebased-fog", false); +bool dx_force_16bpptextures = config_dxgsg.GetBool("dx-force-16bpptextures", false); #ifdef _DEBUG float dx_global_miplevel_bias = config_dxgsg.GetFloat("dx-global-miplevel-bias", 0.0); bool dx_debug_view_mipmaps = config_dxgsg.GetBool("dx-debug-view-mipmaps", false); -bool dx_force_16bpptextures = config_dxgsg.GetBool("dx-force-16bpptextures", false); bool dx_force_anisotropic_filtering = config_dxgsg.GetBool("dx-force-anisotropic-filtering", false); //int dx_print_texstats = config_dxgsg.GetBool("dx-print-texstats", 0); #endif diff --git a/panda/src/dxgsg/config_dxgsg.h b/panda/src/dxgsg/config_dxgsg.h index 3c3559b0e7..6b101b4af8 100644 --- a/panda/src/dxgsg/config_dxgsg.h +++ b/panda/src/dxgsg/config_dxgsg.h @@ -39,6 +39,7 @@ extern const bool link_tristrips; extern bool dx_ignore_mipmaps; extern bool dx_mipmap_everything; extern bool dx_show_transforms; +extern bool dx_force_16bpptextures; #ifndef NDEBUG extern int dx_force_backface_culling; @@ -47,7 +48,6 @@ extern int dx_force_backface_culling; #ifdef _DEBUG extern float dx_global_miplevel_bias; extern bool dx_debug_view_mipmaps; -extern bool dx_force_16bpptextures; extern bool dx_force_anisotropic_filtering; #endif diff --git a/panda/src/dxgsg/dxGraphicsStateGuardian.cxx b/panda/src/dxgsg/dxGraphicsStateGuardian.cxx index 4a02caafb9..340aa48b01 100644 --- a/panda/src/dxgsg/dxGraphicsStateGuardian.cxx +++ b/panda/src/dxgsg/dxGraphicsStateGuardian.cxx @@ -574,7 +574,7 @@ dx_init( LPDIRECTDRAW7 context, assert(_pTexPixFmts!=NULL); if (pDevice->EnumTextureFormats(EnumTexFmtsCallback, this) != S_OK) { - dxgsg_cat.error() << "EnumTextureFormats failed!!\n"; + dxgsg_cat.error() << "EnumTextureFormats failed!\n"; } if (FAILED(hr = pDevice->GetCaps(&_D3DDevDesc))) { diff --git a/panda/src/dxgsg/dxTextureContext.cxx b/panda/src/dxgsg/dxTextureContext.cxx index 3605cfd816..cd3659fcb7 100644 --- a/panda/src/dxgsg/dxTextureContext.cxx +++ b/panda/src/dxgsg/dxTextureContext.cxx @@ -1218,9 +1218,7 @@ CreateTexture(LPDIRECT3DDEVICE7 pd3dDevice, int cNumTexPixFmts, LPDDPIXELFORMAT assert(cNumAlphaBits==0); // dont know how to handle non-zero alpha for 24bit total -#ifdef _DEBUG if(!dx_force_16bpptextures) -#endif for(i=0,pCurPixFmt=pTexPixFmts;idwFlags & DDPF_RGB)&&(pCurPixFmt->dwRGBBitCount==24)) { ConvNeeded=((cNumColorChannels==3) ? Conv24to24 : Conv32to24); @@ -1228,13 +1226,10 @@ CreateTexture(LPDIRECT3DDEVICE7 pd3dDevice, int cNumTexPixFmts, LPDDPIXELFORMAT } } -#ifdef _DEBUG - if(!dx_force_16bpptextures) -#endif - - // no 24-bit fmt. look for 32 bit fmt (note: this is memory-hogging choice - // instead I could look for memory-conserving 16-bit fmt). - // check mask to ensure ARGB, not RGBA (which I am not handling here) + if(!dx_force_16bpptextures) { + // no 24-bit fmt. look for 32 bit fmt (note: this is memory-hogging choice + // instead I could look for memory-conserving 16-bit fmt). + // check mask to ensure ARGB, not RGBA (which I am not handling here) for(i=0,pCurPixFmt=pTexPixFmts;idwRGBBitCount==32) && (pCurPixFmt->dwFlags & DDPF_RGB) && ((pCurPixFmt->dwRBitMask|pCurPixFmt->dwGBitMask|pCurPixFmt->dwBBitMask)==0xFFFFFF) @@ -1244,6 +1239,7 @@ CreateTexture(LPDIRECT3DDEVICE7 pd3dDevice, int cNumTexPixFmts, LPDDPIXELFORMAT goto found_matching_format; } } + } // no 24-bit or 32 fmt. look for 16 bit fmt for(i=0,pCurPixFmt=&pTexPixFmts[cNumTexPixFmts-1];idwRGBBitCount==16) && (pCurPixFmt->dwFlags & DDPF_ALPHAPIXELS) && (pCurPixFmt->dwFlags & DDPF_LUMINANCE)) { @@ -1373,9 +1365,7 @@ CreateTexture(LPDIRECT3DDEVICE7 pd3dDevice, int cNumTexPixFmts, LPDDPIXELFORMAT // look for native lum fmt assert(cNumAlphaBits==0); // dont handle those other 8bit lum fmts like 4-4, since 16 8-8 is usually supported too -#ifdef _DEBUG if(!dx_force_16bpptextures) -#endif { for(i=0,pCurPixFmt=&pTexPixFmts[cNumTexPixFmts-1];idwRGBBitCount==8) && (pCurPixFmt->dwFlags & DDPF_LUMINANCE) &&