浏览代码

select 4444 texfmt over 1555

georges 25 年之前
父节点
当前提交
03861526f2
共有 2 个文件被更改,包括 15 次插入10 次删除
  1. 6 6
      panda/src/dxgsg/dxGraphicsStateGuardian.cxx
  2. 9 4
      panda/src/dxgsg/dxTextureContext.cxx

+ 6 - 6
panda/src/dxgsg/dxGraphicsStateGuardian.cxx

@@ -404,27 +404,27 @@ init_dx(  LPDIRECTDRAW7		context,
 
 
   if(((D3DDevDesc.dpcTriCaps.dwSrcBlendCaps & REQUIRED_BLENDCAPS)!=REQUIRED_BLENDCAPS) ||
   if(((D3DDevDesc.dpcTriCaps.dwSrcBlendCaps & REQUIRED_BLENDCAPS)!=REQUIRED_BLENDCAPS) ||
      ((D3DDevDesc.dpcTriCaps.dwDestBlendCaps & REQUIRED_BLENDCAPS)!=REQUIRED_BLENDCAPS)) {
      ((D3DDevDesc.dpcTriCaps.dwDestBlendCaps & REQUIRED_BLENDCAPS)!=REQUIRED_BLENDCAPS)) {
-         dxgsg_cat.error() << "device is missing alpha blending capabilities, blending may not work correctly: SrcBlendCaps: "<< (void*) D3DDevDesc.dpcTriCaps.dwSrcBlendCaps << "  DestBlendCaps: "<< (void*) D3DDevDesc.dpcTriCaps.dwDestBlendCaps << endl;
+         dxgsg_cat.error() << "device is missing alpha blending capabilities, blending may not work correctly: SrcBlendCaps: 0x"<< (void*) D3DDevDesc.dpcTriCaps.dwSrcBlendCaps << "  DestBlendCaps: "<< (void*) D3DDevDesc.dpcTriCaps.dwDestBlendCaps << endl;
   }
   }
 
 
   if(!(D3DDevDesc.dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_TRANSPARENCY)) {
   if(!(D3DDevDesc.dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_TRANSPARENCY)) {
-         dxgsg_cat.error() << "device is missing texture transparency capability, transparency will work correctly!!!\n";
+         dxgsg_cat.error() << "device is missing texture transparency capability, transparency may not work correctly!  TextureCaps: 0x"<< (void*) D3DDevDesc.dpcTriCaps.dwTextureCaps << endl;
   }
   }
 
 
   // just require trilinear.  if it can do that, it can probably do all the lesser point-sampling variations too
   // just require trilinear.  if it can do that, it can probably do all the lesser point-sampling variations too
 #define REQUIRED_TEXFILTERCAPS (D3DPTFILTERCAPS_MAGFLINEAR |  D3DPTFILTERCAPS_MINFLINEAR | D3DPTFILTERCAPS_LINEAR)
 #define REQUIRED_TEXFILTERCAPS (D3DPTFILTERCAPS_MAGFLINEAR |  D3DPTFILTERCAPS_MINFLINEAR | D3DPTFILTERCAPS_LINEAR)
   if((D3DDevDesc.dpcTriCaps.dwTextureFilterCaps & REQUIRED_TEXFILTERCAPS)!=REQUIRED_TEXFILTERCAPS) {
   if((D3DDevDesc.dpcTriCaps.dwTextureFilterCaps & REQUIRED_TEXFILTERCAPS)!=REQUIRED_TEXFILTERCAPS) {
-         dxgsg_cat.error() << "device is missing texture bilinear filtering capability, textures may appear blocky!!!\n";
+         dxgsg_cat.error() << "device is missing texture bilinear filtering capability, textures may appear blocky!  TextureFilterCaps: 0x"<< (void*) D3DDevDesc.dpcTriCaps.dwTextureFilterCaps << endl;
   }
   }
 
 
 #define REQUIRED_MIPMAP_TEXFILTERCAPS (D3DPTFILTERCAPS_MIPFLINEAR | D3DPTFILTERCAPS_LINEARMIPLINEAR)
 #define REQUIRED_MIPMAP_TEXFILTERCAPS (D3DPTFILTERCAPS_MIPFLINEAR | D3DPTFILTERCAPS_LINEARMIPLINEAR)
   if((D3DDevDesc.dpcTriCaps.dwTextureFilterCaps & REQUIRED_MIPMAP_TEXFILTERCAPS)!=REQUIRED_MIPMAP_TEXFILTERCAPS) {
   if((D3DDevDesc.dpcTriCaps.dwTextureFilterCaps & REQUIRED_MIPMAP_TEXFILTERCAPS)!=REQUIRED_MIPMAP_TEXFILTERCAPS) {
-         dxgsg_cat.error() << "device is missing tri-linear mipmap filtering capability, texture mipmaps may not supported!!!\n";
+         dxgsg_cat.error() << "device is missing tri-linear mipmap filtering capability, texture mipmaps may not supported! TextureFilterCaps: 0x"<< (void*) D3DDevDesc.dpcTriCaps.dwTextureFilterCaps << endl;
   }
   }
 
 
 #define REQUIRED_TEXBLENDCAPS (D3DTEXOPCAPS_MODULATE | D3DTEXOPCAPS_SELECTARG1 | D3DTEXOPCAPS_SELECTARG2)
 #define REQUIRED_TEXBLENDCAPS (D3DTEXOPCAPS_MODULATE | D3DTEXOPCAPS_SELECTARG1 | D3DTEXOPCAPS_SELECTARG2)
   if((D3DDevDesc.dwTextureOpCaps & REQUIRED_TEXBLENDCAPS)!=REQUIRED_TEXBLENDCAPS) {
   if((D3DDevDesc.dwTextureOpCaps & REQUIRED_TEXBLENDCAPS)!=REQUIRED_TEXBLENDCAPS) {
-         dxgsg_cat.error() << "device is missing some required texture blending capabilities, texture blending may not work properly!!!\n";
+         dxgsg_cat.error() << "device is missing some required texture blending capabilities, texture blending may not work properly! TextureOpCaps: 0x"<< (void*) D3DDevDesc.dwTextureOpCaps << endl;
   }
   }
 
 
   SetRect(&clip_rect, 0,0,0,0);		// no clip rect set
   SetRect(&clip_rect, 0,0,0,0);		// no clip rect set
@@ -4015,7 +4015,7 @@ apply_texture_immediate(DXTextureContext *tc) {
     //          we dont see this bug cause we never mix textured/untextured
     //          we dont see this bug cause we never mix textured/untextured
 
 
 	_d3dDevice->SetTexture(0, tc->_surface );
 	_d3dDevice->SetTexture(0, tc->_surface );
-#ifdef _DEBUG
+#if 0
     if(tc!=NULL) {
     if(tc!=NULL) {
        dxgsg_cat.spam() << "Setting active DX texture: " << tc->_tex->get_name() << "\n";
        dxgsg_cat.spam() << "Setting active DX texture: " << tc->_tex->get_name() << "\n";
     } 
     } 

+ 9 - 4
panda/src/dxgsg/dxTextureContext.cxx

@@ -31,6 +31,7 @@ static void DebugPrintPixFmt(DDPIXELFORMAT* pddpf) {
 
 
     if(pddpf->dwFlags & DDPF_RGB) {
     if(pddpf->dwFlags & DDPF_RGB) {
        *dbgout << " RGBmask:" << (void *) (pddpf->dwRBitMask | pddpf->dwGBitMask | pddpf->dwBBitMask);
        *dbgout << " RGBmask:" << (void *) (pddpf->dwRBitMask | pddpf->dwGBitMask | pddpf->dwBBitMask);
+       *dbgout << " Rmask:" << (void *) (pddpf->dwRBitMask);
     }
     }
 
 
     if(pddpf->dwFlags & DDPF_ALPHAPIXELS) {
     if(pddpf->dwFlags & DDPF_ALPHAPIXELS) {
@@ -296,6 +297,7 @@ CreateTexture( HDC hdc, LPDIRECT3DDEVICE7 pd3dDevice, int cNumTexPixFmts, LPDDPI
 #ifdef _DEBUG
 #ifdef _DEBUG
     { static BOOL bPrinted=FALSE;
     { static BOOL bPrinted=FALSE;
        if(!bPrinted) {
        if(!bPrinted) {
+            dxgsg_cat.debug() << "Gfx card supported TexFmts:\n";
             for(i=0;i<cNumTexPixFmts;i++) { DebugPrintPixFmt(&pTexPixFmts[i]); }
             for(i=0;i<cNumTexPixFmts;i++) { DebugPrintPixFmt(&pTexPixFmts[i]); }
             bPrinted=TRUE;
             bPrinted=TRUE;
        }
        }
@@ -356,15 +358,19 @@ CreateTexture( HDC hdc, LPDIRECT3DDEVICE7 pd3dDevice, int cNumTexPixFmts, LPDDPI
             for(i=0,pCurPixFmt=&pTexPixFmts[cNumTexPixFmts-1];i<cNumTexPixFmts;i++,pCurPixFmt--) {
             for(i=0,pCurPixFmt=&pTexPixFmts[cNumTexPixFmts-1];i<cNumTexPixFmts;i++,pCurPixFmt--) {
                 // assume ALPHAMASK is x8000 and RGBMASK is x7fff to simplify 32->16 conversion
                 // assume ALPHAMASK is x8000 and RGBMASK is x7fff to simplify 32->16 conversion
                 // this should be true on most cards.  
                 // this should be true on most cards.  
+#if 0
                 if((pCurPixFmt->dwRGBBitCount==16) && (pCurPixFmt->dwFlags & DDPF_ALPHAPIXELS)
                 if((pCurPixFmt->dwRGBBitCount==16) && (pCurPixFmt->dwFlags & DDPF_ALPHAPIXELS)
                    && (pCurPixFmt->dwRGBAlphaBitMask==0x8000)) {
                    && (pCurPixFmt->dwRGBAlphaBitMask==0x8000)) {
                       ConvNeeded=Conv32to16_1555;
                       ConvNeeded=Conv32to16_1555;
                       goto found_matching_format;
                       goto found_matching_format;
                   }
                   }
-#if 0
+#else
             // 32 bit RGBA was requested, but only 16 bit alpha fmts are avail
             // 32 bit RGBA was requested, but only 16 bit alpha fmts are avail
-            // by default, convert to 15-1, which is the most common fmt
+            // by default, convert to 4-4-4-4 which has 4-bit alpha for blurry edges
+            // egg fmt needs an indicator of alpha values, whether it is 1-bit alpha
+            // or multi-valued alpha buffer that requires more bits
 
 
+            // old comment:
             // 4-4-4-4 would be useful if we know pixelbuf contains non-binary alpha,
             // 4-4-4-4 would be useful if we know pixelbuf contains non-binary alpha,
             // but hard to infer that from RGBA request, and 15-1 is the better general choice
             // but hard to infer that from RGBA request, and 15-1 is the better general choice
 
 
@@ -535,7 +541,7 @@ CreateTexture( HDC hdc, LPDIRECT3DDEVICE7 pd3dDevice, int cNumTexPixFmts, LPDDPI
         DWORD x,y,dwPixel;
         DWORD x,y,dwPixel;
 
 
 #ifdef _DEBUG
 #ifdef _DEBUG
-        dxgsg_cat.spam() << "CreateTexture executing conversion " << ConvNameStrs[ConvNeeded] << "\n";    
+        dxgsg_cat.debug() << "CreateTexture executing conversion " << ConvNameStrs[ConvNeeded] << "\n";    
 #endif
 #endif
 
 
         switch(ConvNeeded) {
         switch(ConvNeeded) {
@@ -671,7 +677,6 @@ CreateTexture( HDC hdc, LPDIRECT3DDEVICE7 pd3dDevice, int cNumTexPixFmts, LPDDPI
            DWORD *pSrcWord = (DWORD *) pbuf->_image.p();
            DWORD *pSrcWord = (DWORD *) pbuf->_image.p();
            WORD *pDstWord;
            WORD *pDstWord;
     
     
-           assert(cNumAlphaBits==4);  
            assert(ddsd.ddpfPixelFormat.dwRGBAlphaBitMask==0xf000);  // assumes ARGB
            assert(ddsd.ddpfPixelFormat.dwRGBAlphaBitMask==0xf000);  // assumes ARGB
            assert(ddsd.ddpfPixelFormat.dwRBitMask==0x0f00);  // assumes ARGB
            assert(ddsd.ddpfPixelFormat.dwRBitMask==0x0f00);  // assumes ARGB