Stefan Dösinger : wined3d: Whitelist pixelformats instead of blacklisting.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Jul 24 06:55:00 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: 127613bc6fc8d1b818af9354b2834a19b19155e3
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=127613bc6fc8d1b818af9354b2834a19b19155e3

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Sat Jul 22 01:58:19 2006 +0200

wined3d: Whitelist pixelformats instead of blacklisting.

---

 dlls/wined3d/directx.c |  191 ++++++++++++++++++++++++++++++++++--------------
 dlls/wined3d/utils.c   |    4 +
 2 files changed, 138 insertions(+), 57 deletions(-)

diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 35542af..62d681b 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -1414,6 +1414,46 @@ static HRESULT WINAPI IWineD3DImpl_Check
         return WINED3DERR_INVALIDCALL;
     }
 
+    if(Usage & WINED3DUSAGE_DEPTHSTENCIL) {
+        switch (CheckFormat) {
+            case WINED3DFMT_D16_LOCKABLE:
+            case WINED3DFMT_D32:
+            case WINED3DFMT_D15S1:
+            case WINED3DFMT_D24S8:
+            case WINED3DFMT_D24X8:
+            case WINED3DFMT_D24X4S4:
+            case WINED3DFMT_D16:
+            case WINED3DFMT_L16:
+            case WINED3DFMT_D32F_LOCKABLE:
+            case WINED3DFMT_D24FS8:
+                TRACE_(d3d_caps)("[OK]\n");
+                return D3D_OK;
+            default:
+                TRACE_(d3d_caps)("[FAILED]\n");
+                return WINED3DERR_NOTAVAILABLE;
+        }
+    } else if(Usage & WINED3DUSAGE_RENDERTARGET) {
+        switch (CheckFormat) {
+            case WINED3DFMT_R8G8B8:
+            case WINED3DFMT_A8R8G8B8:
+            case WINED3DFMT_X8R8G8B8:
+            case WINED3DFMT_R5G6B5:
+            case WINED3DFMT_X1R5G5B5:
+            case WINED3DFMT_A1R5G5B5:
+            case WINED3DFMT_A4R4G4B4:
+            case WINED3DFMT_R3G3B2:
+            case WINED3DFMT_X4R4G4B4:
+            case WINED3DFMT_A8B8G8R8:
+            case WINED3DFMT_X8B8G8R8:
+            case WINED3DFMT_P8:
+                TRACE_(d3d_caps)("[OK]\n");
+                return WINED3D_OK;
+            default:
+                TRACE_(d3d_caps)("[FAILED]\n");
+                return WINED3DERR_NOTAVAILABLE;
+        }
+    }
+
     if (GL_SUPPORT(EXT_TEXTURE_COMPRESSION_S3TC)) {
         switch (CheckFormat) {
         case D3DFMT_DXT1:
@@ -1429,65 +1469,106 @@ static HRESULT WINAPI IWineD3DImpl_Check
     }
 
     switch (CheckFormat) {
-    /*****
-     * check supported using GL_SUPPORT
-     */
-    case D3DFMT_DXT1:
-    case D3DFMT_DXT2:
-    case D3DFMT_DXT3:
-    case D3DFMT_DXT4:
-    case D3DFMT_DXT5:
-
-    /*****
-     *  supported
-     */
-      /*case D3DFMT_R5G6B5: */
-      /*case D3DFMT_X1R5G5B5:*/
-      /*case D3DFMT_A1R5G5B5: */
-      /*case D3DFMT_A4R4G4B4:*/
 
-    /*****
-     * unsupported
-     */
+        /*****
+         *  supported: RGB(A) formats
+         */
+        case WINED3DFMT_R8G8B8:
+        case WINED3DFMT_A8R8G8B8:
+        case WINED3DFMT_X8R8G8B8:
+        case WINED3DFMT_R5G6B5:
+        case WINED3DFMT_X1R5G5B5:
+        case WINED3DFMT_A1R5G5B5:
+        case WINED3DFMT_A4R4G4B4:
+        case WINED3DFMT_R3G3B2:
+        case WINED3DFMT_A8:
+        case WINED3DFMT_A8R3G3B2:
+        case WINED3DFMT_X4R4G4B4:
+        case WINED3DFMT_A8B8G8R8:
+        case WINED3DFMT_X8B8G8R8:
+        case WINED3DFMT_A2R10G10B10:
+        case WINED3DFMT_A2B10G10R10:
+            TRACE_(d3d_caps)("[OK]\n");
+            return WINED3D_OK;
+
+        /*****
+         *  supported: Palettized
+         */
+        case WINED3DFMT_P8:
+            TRACE_(d3d_caps)("[OK]\n");
+            return WINED3D_OK;
+
+        /*****
+         *  Supported: (Alpha)-Luminance
+         */
+        case WINED3DFMT_L8:
+        case WINED3DFMT_A8L8:
+        case WINED3DFMT_A4L4:
+            TRACE_(d3d_caps)("[OK]\n");
+            return WINED3D_OK;
+
+        /*****
+         *  Not supported for now: Bump mapping formats
+         *  Enable some because games often fail when they are not available
+         *  and are still playable even without bump mapping
+         */
+        case WINED3DFMT_V8U8:
+        case WINED3DFMT_V16U16:
+            WARN_(d3d_caps)("[Not supported, but pretended to do]\n");
+            return WINED3D_OK;
+
+        case WINED3DFMT_L6V5U5:
+        case WINED3DFMT_X8L8V8U8:
+        case WINED3DFMT_Q8W8V8U8:
+        case WINED3DFMT_W11V11U10:
+        case WINED3DFMT_A2W10V10U10:
+            TRACE_(d3d_caps)("[FAILED]\n");
+            return D3DERR_NOTAVAILABLE;
+
+        /*****
+         *  DXTN Formats: Handled above
+         * WINED3DFMT_DXT1
+         * WINED3DFMT_DXT2
+         * WINED3DFMT_DXT3
+         * WINED3DFMT_DXT4
+         * WINED3DFMT_DXT5
+         */
+
+        /*****
+         *  Odd formats - not supported
+         */
+        case WINED3DFMT_VERTEXDATA:
+        case WINED3DFMT_INDEX16:
+        case WINED3DFMT_INDEX32:
+        case WINED3DFMT_Q16W16V16U16:
+            TRACE_(d3d_caps)("[FAILED]\n"); /* Enable when implemented */
+            return D3DERR_NOTAVAILABLE;
+
+        /*****
+         *  Float formats: Not supported right now
+         */
+        case WINED3DFMT_R16F:
+        case WINED3DFMT_G16R16F:
+        case WINED3DFMT_A16B16G16R16F:
+        case WINED3DFMT_R32F:
+        case WINED3DFMT_G32R32F:
+        case WINED3DFMT_A32B32G32R32F:
+        case WINED3DFMT_CxV8U8:
+            TRACE_(d3d_caps)("[FAILED]\n"); /* Enable when implemented */
+            return D3DERR_NOTAVAILABLE;
+
+            /* Not supported */
+        case WINED3DFMT_G16R16:
+        case WINED3DFMT_A16B16G16R16:
+            TRACE_(d3d_caps)("[FAILED]\n"); /* Enable when implemented */
+            return D3DERR_NOTAVAILABLE;
 
-      /* color buffer */
-      /*case D3DFMT_X8R8G8B8:*/
-    case D3DFMT_A8R3G3B2:
-
-      /* Paletted */
-    case D3DFMT_P8:
-    case D3DFMT_A8P8:
-
-      /* Luminance */
-    case D3DFMT_L8:
-    case D3DFMT_A8L8:
-    case D3DFMT_A4L4:
-
-      /* Bump */
-#if 0
-    case D3DFMT_V8U8:
-    case D3DFMT_V16U16:
-#endif
-    case D3DFMT_L6V5U5:
-    case D3DFMT_X8L8V8U8:
-    case D3DFMT_Q8W8V8U8:
-    case D3DFMT_W11V11U10:
-
-    /****
-     * currently hard to support
-     */
-    case D3DFMT_UYVY:
-    case D3DFMT_YUY2:
-
-      /* Since we do not support these formats right now, don't pretend to. */
-      TRACE_(d3d_caps)("[FAILED]\n");
-      return WINED3DERR_NOTAVAILABLE;
-    default:
-      break;
+        default:
+            break;
     }
 
-    TRACE_(d3d_caps)("[OK]\n");
-    return WINED3D_OK;
+    TRACE_(d3d_caps)("[FAILED]\n");
+    return D3DERR_NOTAVAILABLE;
 }
 
 static HRESULT  WINAPI IWineD3DImpl_CheckDeviceFormatConversion(IWineD3D *iface, UINT Adapter, WINED3DDEVTYPE DeviceType,
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 8275953..6f11e13 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -71,11 +71,11 @@ static const PixelFormatDesc formats[] =
     {WINED3DFMT_A8          ,0x000000ff ,0x0        ,0x0        ,0x0        ,1      ,FALSE      ,GL_ALPHA8              ,GL_ALPHA           ,GL_ALPHA                       },
     {WINED3DFMT_A8R3G3B2    ,0x0000ff00 ,0x000000e0 ,0x0000001c ,0x00000003 ,2      ,FALSE      ,0                      ,0                  ,0                              },
     {WINED3DFMT_X4R4G4B4    ,0x0        ,0x00000f00 ,0x000000f0 ,0x0000000f ,2      ,FALSE      ,GL_RGB4                ,GL_BGRA            ,GL_UNSIGNED_SHORT_4_4_4_4_REV  },
-    {WINED3DFMT_A2B10G10R10 ,0xb0000000 ,0x000003ff ,0x000ffc00 ,0x3ff00000 ,4      ,FALSE      ,0                      ,0                  ,0                              },
+    {WINED3DFMT_A2B10G10R10 ,0xb0000000 ,0x000003ff ,0x000ffc00 ,0x3ff00000 ,4      ,FALSE      ,GL_RGB                 ,GL_RGBA            ,GL_UNSIGNED_INT_2_10_10_10_REV },
     {WINED3DFMT_A8B8G8R8    ,0xff000000 ,0x000000ff ,0x0000ff00 ,0x00ff0000 ,4      ,FALSE      ,GL_RGBA8               ,GL_RGBA            ,GL_UNSIGNED_INT_8_8_8_8_REV    },
     {WINED3DFMT_X8B8G8R8    ,0x0        ,0x000000ff ,0x0000ff00 ,0x00ff0000 ,4      ,FALSE      ,GL_RGB8                ,GL_RGBA            ,GL_UNSIGNED_INT_8_8_8_8_REV    },
     {WINED3DFMT_G16R16      ,0x0        ,0x0000ffff ,0xffff0000 ,0x0        ,4      ,FALSE      ,0                      ,0                  ,0                              },
-    {WINED3DFMT_A2R10G10B10 ,0xb0000000 ,0x3ff00000 ,0x000ffc00 ,0x000003ff ,4      ,FALSE      ,0                      ,0                  ,0                              },
+    {WINED3DFMT_A2R10G10B10 ,0xb0000000 ,0x3ff00000 ,0x000ffc00 ,0x000003ff ,4      ,FALSE      ,GL_RGBA                ,GL_BGRA            ,GL_UNSIGNED_INT_2_10_10_10_REV },
     {WINED3DFMT_A16B16G16R16,0x0        ,0x0000ffff ,0xffff0000 ,0x0        ,8      ,FALSE      ,GL_RGBA16_EXT          ,GL_RGBA            ,GL_UNSIGNED_SHORT              },
     /* Luminance */
     {WINED3DFMT_L8          ,0x0        ,0x0        ,0x0        ,0x0        ,1      ,FALSE      ,GL_LUMINANCE8          ,GL_LUMINANCE       ,GL_UNSIGNED_BYTE               },




More information about the wine-cvs mailing list