Browse Source

force16bpp textures available in publish build

cxgeorge 24 years ago
parent
commit
25c01b62bb

+ 1 - 1
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

+ 1 - 1
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
 

+ 1 - 1
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))) {

+ 6 - 16
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;i<cNumTexPixFmts;i++,pCurPixFmt++) {
                     if((pCurPixFmt->dwFlags & 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;i<cNumTexPixFmts;i++,pCurPixFmt++) {
                     if((pCurPixFmt->dwRGBBitCount==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];i<cNumTexPixFmts;i++,pCurPixFmt--) {
@@ -1269,11 +1265,7 @@ CreateTexture(LPDIRECT3DDEVICE7 pd3dDevice, int cNumTexPixFmts, LPDDPIXELFORMAT
 
             if(ddsd.ddpfPixelFormat.dwFlags & DDPF_LUMINANCE) {
            // look for native lum fmt
-#ifdef _DEBUG
-                if(!dx_force_16bpptextures)
-#endif
-                {
-
+                if(!dx_force_16bpptextures) {
                     for(i=0,pCurPixFmt=&pTexPixFmts[cNumTexPixFmts-1];i<cNumTexPixFmts;i++,pCurPixFmt--) {
                         if((pCurPixFmt->dwRGBBitCount==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];i<cNumTexPixFmts;i++,pCurPixFmt--) {
                         if((pCurPixFmt->dwRGBBitCount==8) && (pCurPixFmt->dwFlags & DDPF_LUMINANCE) &&