[ros-diffs] [gbrunmar] 32541: Implemented IDirect3D:CheckDeviceFormat()

gbrunmar at svn.reactos.org gbrunmar at svn.reactos.org
Sun Mar 9 12:32:45 CET 2008


Author: gbrunmar
Date: Sun Mar  2 13:29:35 2008
New Revision: 32541

URL: http://svn.reactos.org/svn/reactos?rev=3D32541&view=3Drev
Log:
Implemented IDirect3D:CheckDeviceFormat()

Modified:
    trunk/reactos/dll/directx/d3d9/d3d9_impl.c
    trunk/reactos/dll/directx/d3d9/d3d9_private.h
    trunk/reactos/dll/directx/d3d9/format.c
    trunk/reactos/dll/directx/d3d9/format.h
    trunk/reactos/include/psdk/d3d9types.h

Modified: trunk/reactos/dll/directx/d3d9/d3d9_impl.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/d3d9/d3d9=
_impl.c?rev=3D32541&r1=3D32540&r2=3D32541&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/reactos/dll/directx/d3d9/d3d9_impl.c (original)
+++ trunk/reactos/dll/directx/d3d9/d3d9_impl.c Sun Mar  2 13:29:35 2008
@@ -363,7 +363,7 @@
 * One of the D3DFORMAT enum members except D3DFMT_UNKNOWN for the display =
adapter mode to be checked.
 *
 * @param D3DFORMAT BackBufferFormat
-* One of the D3DFORMAT enum membersfor the render target mode to be checke=
d. D3DFMT_UNKNOWN is only allowed in windowed mode.
+* One of the D3DFORMAT enum members for the render target mode to be check=
ed. D3DFMT_UNKNOWN is only allowed in windowed mode.
 *
 * @param BOOL Windowed
 * If this value is TRUE, the D3DFORMAT check will be done for windowed mod=
e and FALSE equals fullscreen mode.
@@ -426,19 +426,200 @@
         return D3DERR_NOTAVAILABLE;
     }
 =

-    hResult =3D CheckDeviceFormat(&This->DisplayAdapters[Adapter].DriverCa=
ps, DisplayFormat, BackBufferFormat, Windowed);
+    hResult =3D CheckDeviceType(&This->DisplayAdapters[Adapter].DriverCaps=
, DisplayFormat, BackBufferFormat, Windowed);
 =

     UNLOCK_D3D9();
     return hResult;
 }
 =

+
+/*++
+* @name IDirect3D9::CheckDeviceFormat
+* @implemented
+*
+* The function IDirect3D9Impl_CheckDeviceFormat checks if a specific D3DFO=
RMAT
+* can be used for a specific purpose like texture, depth/stencil buffer or=
 as a render target
+* on the specified display adapter.
+*
+* @param LPDIRECT3D iface
+* Pointer to the IDirect3D object returned from Direct3DCreate9()
+*
+* @param UINT Adapter
+* Adapter index to get information about. D3DADAPTER_DEFAULT is the primar=
y display.
+* The maximum value for this is the value returned by IDirect3D::GetAdapte=
rCount().
+*
+* @param D3DDEVTYPE DeviceType
+* One of the D3DDEVTYPE enum members.
+*
+* @param D3DFORMAT AdapterFormat
+* One of the D3DFORMAT enum members except D3DFMT_UNKNOWN for the display =
adapter mode to be checked.
+*
+* @param DWORD Usage
+* Valid values are any of the D3DUSAGE_QUERY constants or any of these D3D=
USAGE constants:
+* D3DUSAGE_AUTOGENMIPMAP, D3DUSAGE_DEPTHSTENCIL, D3DUSAGE_DMAP, D3DUSAGE_D=
YNAMIC,
+* D3DUSAGE_NONSECURE, D3DUSAGE_RENDERTARGET and D3DUSAGE_SOFTWAREPROCESSIN=
G.
+*
+* @param D3DRESOURCETYPE RType
+* One of the D3DRESOURCETYPE enum members. Specifies what format will be u=
sed for.
+*
+* @param D3DFORMAT CheckFormat
+* One of the D3DFORMAT enum members for the surface format to be checked.
+*
+* @return HRESULT
+* If the format is compatible with the specified usage and resource type, =
the method returns D3D_OK.
+* If the format isn't compatible with the specified usage and resource typ=
e - the return value will be D3DERR_NOTAVAILABLE.
+* If Adapter is out of range, DeviceType is invalid, AdapterFormat or Chec=
kFormat is invalid,
+* Usage and RType isn't compatible - the return value will be D3DERR_INVAL=
IDCALL.
+*
+*/
 static HRESULT WINAPI IDirect3D9Impl_CheckDeviceFormat(LPDIRECT3D9 iface, =
UINT Adapter, D3DDEVTYPE DeviceType,
                                                        D3DFORMAT AdapterFo=
rmat, DWORD Usage, D3DRESOURCETYPE RType,
                                                        D3DFORMAT CheckForm=
at)
 {
-    UNIMPLEMENTED
-
-    return D3D_OK;
+    LPD3D9_DRIVERCAPS pDriverCaps;
+    BOOL bIsTextureRType =3D FALSE;
+    HRESULT hResult;
+
+    LPDIRECT3D9_INT This =3D impl_from_IDirect3D9(iface);
+    LOCK_D3D9();
+
+    if (Adapter >=3D This->NumDisplayAdapters)
+    {
+        DPRINT1("Invalid Adapter number specified");
+        UNLOCK_D3D9();
+        return D3DERR_INVALIDCALL;
+    }
+
+    if (DeviceType !=3D D3DDEVTYPE_HAL &&
+        DeviceType !=3D D3DDEVTYPE_REF &&
+        DeviceType !=3D D3DDEVTYPE_SW)
+    {
+        DPRINT1("Invalid DeviceType specified");
+        UNLOCK_D3D9();
+        return D3DERR_INVALIDCALL;
+    }
+
+    if (AdapterFormat =3D=3D D3DFMT_UNKNOWN ||
+        CheckFormat =3D=3D D3DFMT_UNKNOWN)
+    {
+        DPRINT1("Invalid D3DFORMAT specified");
+        UNLOCK_D3D9();
+        return D3DERR_NOTAVAILABLE;
+    }
+
+    if ((Usage & (D3DUSAGE_DONOTCLIP | D3DUSAGE_NPATCHES | D3DUSAGE_POINTS=
 | D3DUSAGE_RTPATCHES | D3DUSAGE_TEXTAPI | D3DUSAGE_WRITEONLY)) !=3D 0)
+    {
+        DPRINT1("Invalid Usage specified");
+        UNLOCK_D3D9();
+        return D3DERR_INVALIDCALL;
+    }
+
+    if (RType =3D=3D D3DRTYPE_TEXTURE ||
+        RType =3D=3D D3DRTYPE_VOLUMETEXTURE ||
+        RType =3D=3D D3DRTYPE_CUBETEXTURE)
+    {
+        bIsTextureRType =3D TRUE;
+    }
+    else if (RType =3D=3D D3DRTYPE_SURFACE &&
+            (Usage & (D3DUSAGE_DEPTHSTENCIL | D3DUSAGE_RENDERTARGET)) =3D=
=3D 0 &&
+            Usage !=3D 0)
+    {
+        DPRINT1("When RType is set to D3DRTYPE_SURFACE, Usage must be 0 or=
 have set D3DUSAGE_DEPTHSTENCIL or D3DUSAGE_RENDERTARGET");
+        UNLOCK_D3D9();
+        return D3DERR_INVALIDCALL;
+    }
+
+    if ((Usage & D3DUSAGE_DEPTHSTENCIL) !=3D 0)
+    {
+        if (FALSE =3D=3D IsZBufferFormat(CheckFormat))
+        {
+            DPRINT1("Invalid CheckFormat Z-Buffer format");
+            UNLOCK_D3D9();
+            return D3DERR_INVALIDCALL;
+        }
+
+        if ((Usage & D3DUSAGE_AUTOGENMIPMAP) !=3D 0)
+        {
+            DPRINT1("Invalid Usage specified, D3DUSAGE_DEPTHSTENCIL and D3=
DUSAGE_AUTOGENMIPMAP can't be combined.");
+            UNLOCK_D3D9();
+            return D3DERR_INVALIDCALL;
+        }
+    }
+
+    if (FALSE =3D=3D bIsTextureRType &&
+        RType !=3D D3DRTYPE_SURFACE &&
+        RType !=3D D3DRTYPE_VOLUME)
+    {
+        DPRINT1("Invalid RType specified");
+        UNLOCK_D3D9();
+        return D3DERR_INVALIDCALL;
+    }
+
+    if ((Usage & (D3DUSAGE_AUTOGENMIPMAP | D3DUSAGE_DEPTHSTENCIL | D3DUSAG=
E_RENDERTARGET)) !=3D 0)
+    {
+        if (RType =3D=3D D3DRTYPE_VOLUME || RType =3D=3D D3DRTYPE_VOLUMETE=
XTURE)
+        {
+            DPRINT1("Invalid Usage specified, D3DUSAGE_AUTOGENMIPMAP, D3DU=
SAGE_DEPTHSTENCIL and D3DUSAGE_RENDERTARGET can't be combined with RType D3=
DRTYPE_VOLUME or D3DRTYPE_VOLUMETEXTURE");
+            UNLOCK_D3D9();
+            return D3DERR_INVALIDCALL;
+        }
+    }
+
+    if (FALSE =3D=3D bIsTextureRType &&
+        (Usage & D3DUSAGE_QUERY_VERTEXTEXTURE) !=3D 0)
+    {
+        DPRINT1("Invalid Usage specified, D3DUSAGE_QUERY_VERTEXTEXTURE can=
 only be used with a texture RType");
+        UNLOCK_D3D9();
+        return D3DERR_INVALIDCALL;
+    }
+
+    if ((Usage & D3DUSAGE_AUTOGENMIPMAP) !=3D 0 &&
+        TRUE =3D=3D IsMultiElementFormat(CheckFormat))
+    {
+        DPRINT1("Invalid Usage specified, D3DUSAGE_AUTOGENMIPMAP can't be =
used with a multi-element format");
+        UNLOCK_D3D9();
+        return D3DERR_INVALIDCALL;
+    }
+
+    pDriverCaps =3D &This->DisplayAdapters[Adapter].DriverCaps;
+    if ((Usage & D3DUSAGE_DYNAMIC) !=3D 0 && bIsTextureRType =3D=3D TRUE)
+    {
+        if ((pDriverCaps->DriverCaps9.Caps2 & D3DCAPS2_DYNAMICTEXTURES) =
=3D=3D 0)
+        {
+            DPRINT1("Driver doesn't support dynamic textures");
+            UNLOCK_D3D9();
+            return D3DERR_NOTAVAILABLE;
+        }
+
+        if ((Usage & (D3DUSAGE_DEPTHSTENCIL | D3DUSAGE_RENDERTARGET)) !=3D=
 0)
+        {
+            DPRINT1("Invalid Usage specified, D3DUSAGE_DEPTHSTENCIL and D3=
DUSAGE_RENDERTARGET can't be combined with D3DUSAGE_DYNAMIC and a texture R=
Type");
+            UNLOCK_D3D9();
+            return D3DERR_INVALIDCALL;
+        }
+    }
+
+    if ((Usage & D3DUSAGE_DMAP) !=3D 0)
+    {
+        if ((pDriverCaps->DriverCaps9.DevCaps2 & (D3DDEVCAPS2_PRESAMPLEDDM=
APNPATCH | D3DDEVCAPS2_DMAPNPATCH)) =3D=3D 0)
+        {
+            DPRINT1("Driver doesn't support displacement mapping");
+            UNLOCK_D3D9();
+            return D3DERR_NOTAVAILABLE;
+        }
+
+        if (RType !=3D D3DRTYPE_TEXTURE)
+        {
+            DPRINT1("Invalid Usage speficied, D3DUSAGE_DMAP must be combin=
ed with RType D3DRTYPE_TEXTURE");
+            UNLOCK_D3D9();
+            return D3DERR_INVALIDCALL;
+        }
+    }
+
+    hResult =3D CheckDeviceFormat(pDriverCaps, AdapterFormat, Usage, RType=
, CheckFormat);
+
+    UNLOCK_D3D9();
+    return hResult;
 }
 =

 static HRESULT WINAPI IDirect3D9Impl_CheckDeviceMultiSampleType(LPDIRECT3D=
9 iface, UINT Adapter, D3DDEVTYPE DeviceType,

Modified: trunk/reactos/dll/directx/d3d9/d3d9_private.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/d3d9/d3d9=
_private.h?rev=3D32541&r1=3D32540&r2=3D32541&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/reactos/dll/directx/d3d9/d3d9_private.h (original)
+++ trunk/reactos/dll/directx/d3d9/d3d9_private.h Sun Mar  2 13:29:35 2008
@@ -222,8 +222,8 @@
 /* 0x227c */    DWORD unknown002207;
 /* 0x2280 */    DWORD unknown002208;
 /* 0x2284 */    DWORD unknown002209;
-/* 0x2288 */    DWORD unknown002210;
-/* 0x228c */    DWORD unknown002211;
+/* 0x2288 */    DWORD NumSupportedRefFormatOps;
+/* 0x228c */    LPDDSURFACEDESC pSupportedRefFormatOps;
 /* 0x2290 */    DWORD unknown002212;
 /* 0x2294 */    DWORD unknown002213;
 /* 0x2298 */    DWORD unknown002214;
@@ -1286,8 +1286,8 @@
 /* 0x331c */    DWORD unknown003271;
 /* 0x3320 */    DWORD unknown003272;
 /* 0x3324 */    DWORD unknown003273;
-/* 0x3328 */    DWORD unknown003274;
-/* 0x332c */    DWORD unknown003275;
+/* 0x3328 */    DWORD NumSupportedSoftwareFormatOps;
+/* 0x332c */    LPDDSURFACEDESC pSupportedSoftwareFormatOps;
 /* 0x3330 */    DWORD unknown003276;
 /* 0x3334 */    DWORD unknown003277;
 /* 0x3338 */    DWORD unknown003278;

Modified: trunk/reactos/dll/directx/d3d9/format.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/d3d9/form=
at.c?rev=3D32541&r1=3D32540&r2=3D32541&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/reactos/dll/directx/d3d9/format.c (original)
+++ trunk/reactos/dll/directx/d3d9/format.c Sun Mar  2 13:29:35 2008
@@ -8,6 +8,7 @@
 =

 #include "format.h"
 #include <ddrawi.h>
+#include <debug.h>
 =

 BOOL IsBackBufferFormat(D3DFORMAT Format)
 {
@@ -18,6 +19,18 @@
 BOOL IsExtendedFormat(D3DFORMAT Format)
 {
     return (Format =3D=3D D3DFMT_A2R10G10B10);
+}
+
+BOOL IsZBufferFormat(D3DFORMAT Format)
+{
+    UNIMPLEMENTED
+
+    return TRUE;
+}
+
+BOOL IsMultiElementFormat(D3DFORMAT Format)
+{
+    return (Format =3D=3D D3DFMT_MULTI2_ARGB8);
 }
 =

 BOOL IsSupportedFormatOp(LPD3D9_DRIVERCAPS pDriverCaps, D3DFORMAT DisplayF=
ormat, DWORD FormatOp)
@@ -38,7 +51,7 @@
     return FALSE;
 }
 =

-HRESULT CheckDeviceFormat(LPD3D9_DRIVERCAPS pDriverCaps, D3DFORMAT Display=
Format, D3DFORMAT BackBufferFormat, BOOL Windowed)
+HRESULT CheckDeviceType(LPD3D9_DRIVERCAPS pDriverCaps, D3DFORMAT DisplayFo=
rmat, D3DFORMAT BackBufferFormat, BOOL Windowed)
 {
     if (FALSE =3D=3D IsSupportedFormatOp(pDriverCaps, DisplayFormat, D3DFO=
RMAT_OP_DISPLAYMODE | D3DFORMAT_OP_3DACCELERATION))
     {
@@ -89,3 +102,222 @@
 =

     return D3D_OK;
 }
+
+static D3DFORMAT GetStencilFormat(LPD3D9_DRIVERCAPS pDriverCaps, D3DFORMAT=
 CheckFormat)
+{
+    switch (CheckFormat)
+    {
+    case D3DFMT_D15S1:
+    case D3DFMT_D24S8:
+    case D3DFMT_D24X8:
+    case D3DFMT_D24X4S4:
+        if (IsSupportedFormatOp(pDriverCaps, CheckFormat - 1, 0))
+            return CheckFormat - 1;
+        break;
+
+    case D3DFMT_D16:
+        if (IsSupportedFormatOp(pDriverCaps, CheckFormat, 0))
+            return CheckFormat;
+        else
+            return D3DFMT_D16_LOCKABLE;
+
+    default:
+        /* StencilFormat same as CheckFormat */
+        break;
+    }
+
+    return CheckFormat;
+}
+
+static D3DFORMAT RemoveAlphaChannel(D3DFORMAT CheckFormat)
+{
+    switch (CheckFormat)
+    {
+    case D3DFMT_A8R8G8B8:
+        return D3DFMT_X8R8G8B8;
+
+    case D3DFMT_A1R5G5B5:
+        return D3DFMT_X1R5G5B5;
+
+    case D3DFMT_A4R4G4B4:
+        return D3DFMT_X4R4G4B4;
+
+    case D3DFMT_A8B8G8R8:
+        return D3DFMT_X8B8G8R8;
+
+    default:
+        /* CheckFormat has not relevant alpha channel */
+        break;
+    }
+
+    return CheckFormat;
+}
+
+HRESULT CheckDeviceFormat(LPD3D9_DRIVERCAPS pDriverCaps, D3DFORMAT Adapter=
Format, DWORD Usage, D3DRESOURCETYPE RType, D3DFORMAT CheckFormat)
+{
+    const DWORD NumFormatOps =3D pDriverCaps->NumSupportedFormatOps;
+    DWORD NonCompatibleOperations =3D 0, MustSupportOperations =3D 0;
+    BOOL bSupportedWithAutogen =3D FALSE;
+    DWORD FormatOpIndex;
+
+    if (FALSE =3D=3D IsSupportedFormatOp(pDriverCaps, AdapterFormat, D3DFO=
RMAT_OP_DISPLAYMODE | D3DFORMAT_OP_3DACCELERATION))
+    {
+        return D3DERR_NOTAVAILABLE;
+    }
+
+    /* Check for driver auto generated mip map support if requested */
+    if ((Usage & (D3DUSAGE_AUTOGENMIPMAP)) !=3D 0)
+    {
+        switch (RType)
+        {
+        case D3DRTYPE_TEXTURE:
+            if ((pDriverCaps->DriverCaps9.TextureCaps & D3DPTEXTURECAPS_MI=
PMAP) =3D=3D 0)
+                return D3DERR_NOTAVAILABLE;
+
+            break;
+
+        case D3DRTYPE_VOLUME:
+        case D3DRTYPE_VOLUMETEXTURE:
+            if ((pDriverCaps->DriverCaps9.TextureCaps & D3DPTEXTURECAPS_MI=
PVOLUMEMAP) =3D=3D 0)
+                return D3DERR_NOTAVAILABLE;
+
+            break;
+
+        case D3DRTYPE_CUBETEXTURE:
+            if ((pDriverCaps->DriverCaps9.TextureCaps & D3DPTEXTURECAPS_MI=
PCUBEMAP) =3D=3D 0)
+                return D3DERR_NOTAVAILABLE;
+
+            break;
+
+        default:
+            /* Do nothing */
+            break;
+        }
+
+        MustSupportOperations |=3D D3DFORMAT_OP_AUTOGENMIPMAP;
+    }
+
+    /* Translate from RType and Usage parameters to FormatOps */
+    switch (RType)
+    {
+    case D3DRTYPE_TEXTURE:
+        MustSupportOperations |=3D D3DFORMAT_OP_TEXTURE;
+        break;
+
+    case D3DRTYPE_VOLUME:
+    case D3DRTYPE_VOLUMETEXTURE:
+        MustSupportOperations |=3D D3DFORMAT_OP_VOLUMETEXTURE;
+        break;
+
+    case D3DRTYPE_CUBETEXTURE:
+        MustSupportOperations |=3D D3DFORMAT_OP_CUBETEXTURE;
+        break;
+
+    default:
+        /* Do nothing */
+        break;
+    }
+
+    if (Usage =3D=3D 0 && RType =3D=3D D3DRTYPE_SURFACE)
+    {
+        MustSupportOperations |=3D D3DFORMAT_OP_OFFSCREENPLAIN;
+    }
+
+    if ((Usage & D3DUSAGE_DEPTHSTENCIL) !=3D 0)
+    {
+        MustSupportOperations |=3D D3DFORMAT_OP_ZSTENCIL;
+    }
+
+    if ((Usage & D3DUSAGE_DMAP) !=3D 0)
+    {
+        MustSupportOperations |=3D D3DFORMAT_OP_DMAP;
+    }
+
+    if ((Usage & D3DUSAGE_QUERY_LEGACYBUMPMAP) !=3D 0)
+    {
+        MustSupportOperations |=3D D3DFORMAT_OP_BUMPMAP;
+    }
+
+    if ((Usage & D3DUSAGE_QUERY_SRGBREAD) !=3D 0)
+    {
+        MustSupportOperations |=3D D3DFORMAT_OP_SRGBREAD;
+    }
+
+    if ((Usage & D3DUSAGE_QUERY_SRGBWRITE) !=3D 0)
+    {
+        MustSupportOperations |=3D D3DFORMAT_OP_SRGBWRITE;
+    }
+
+    if ((Usage & D3DUSAGE_QUERY_VERTEXTEXTURE) !=3D 0)
+    {
+        MustSupportOperations |=3D D3DFORMAT_OP_VERTEXTEXTURE;
+    }
+
+    CheckFormat =3D GetStencilFormat(pDriverCaps, CheckFormat);
+
+    if ((Usage & D3DUSAGE_RENDERTARGET) !=3D 0)
+    {
+        if (AdapterFormat =3D=3D CheckFormat)
+        {
+            MustSupportOperations |=3D D3DFORMAT_OP_SAME_FORMAT_RENDERTARG=
ET;
+        }
+        else
+        {
+            D3DFORMAT NonAlphaAdapterFormat;
+            D3DFORMAT NonAlphaCheckFormat;
+
+            NonAlphaAdapterFormat =3D RemoveAlphaChannel(AdapterFormat);
+            NonAlphaCheckFormat =3D RemoveAlphaChannel(CheckFormat);
+
+            if (NonAlphaAdapterFormat =3D=3D NonAlphaCheckFormat &&
+                NonAlphaCheckFormat !=3D D3DFMT_UNKNOWN)
+            {
+                MustSupportOperations |=3D D3DFORMAT_OP_SAME_FORMAT_UP_TO_=
ALPHA_RENDERTARGET;
+            }
+            else
+            {
+                MustSupportOperations |=3D D3DFORMAT_OP_OFFSCREEN_RENDERTA=
RGET;
+            }
+        }
+    }
+
+    if ((Usage & D3DUSAGE_QUERY_FILTER) !=3D 0)
+    {
+        NonCompatibleOperations |=3D D3DFORMAT_OP_OFFSCREENPLAIN;
+    }
+
+    if ((Usage & D3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING) !=3D 0)
+    {
+        NonCompatibleOperations |=3D D3DFORMAT_OP_NOALPHABLEND;
+    }
+
+    if ((Usage & D3DUSAGE_QUERY_WRAPANDMIP) !=3D 0)
+    {
+        NonCompatibleOperations |=3D D3DFORMAT_OP_NOTEXCOORDWRAPNORMIP;
+    }
+
+    for (FormatOpIndex =3D 0; FormatOpIndex < NumFormatOps; FormatOpIndex+=
+)
+    {
+        DWORD dwOperations;
+        LPDDSURFACEDESC pSurfaceDesc =3D &pDriverCaps->pSupportedFormatOps=
[FormatOpIndex];
+
+        if (pSurfaceDesc->ddpfPixelFormat.dwFourCC !=3D CheckFormat)
+            continue;
+
+        dwOperations =3D pSurfaceDesc->ddpfPixelFormat.dwOperations;
+
+        if ((dwOperations & NonCompatibleOperations) !=3D 0)
+            continue;
+
+        if ((dwOperations & MustSupportOperations) =3D=3D MustSupportOpera=
tions)
+            return D3D_OK;
+        =

+        if (((dwOperations & MustSupportOperations) | D3DFORMAT_OP_AUTOGEN=
MIPMAP) =3D=3D MustSupportOperations)
+            bSupportedWithAutogen =3D TRUE;
+    }
+
+    if (TRUE =3D=3D bSupportedWithAutogen)
+        return D3DOK_NOAUTOGEN;
+
+    return D3DERR_NOTAVAILABLE;
+}

Modified: trunk/reactos/dll/directx/d3d9/format.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/d3d9/form=
at.h?rev=3D32541&r1=3D32540&r2=3D32541&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/reactos/dll/directx/d3d9/format.h (original)
+++ trunk/reactos/dll/directx/d3d9/format.h Sun Mar  2 13:29:35 2008
@@ -12,12 +12,25 @@
 #include <d3d9.h>
 #include "d3d9_private.h"
 =

+#define D3DFORMAT_OP_DMAP                   0x00020000L
+
+/* MSVC compile fix */
+#ifndef D3DFORMAT_OP_NOTEXCOORDWRAPNORMIP
+#define D3DFORMAT_OP_NOTEXCOORDWRAPNORMIP   0x01000000L
+#endif
+
 BOOL IsBackBufferFormat(D3DFORMAT Format);
 =

 BOOL IsExtendedFormat(D3DFORMAT Format);
 =

+BOOL IsZBufferFormat(D3DFORMAT Format);
+
+BOOL IsMultiElementFormat(D3DFORMAT Format);
+
 BOOL IsSupportedFormatOp(LPD3D9_DRIVERCAPS pDriverCaps, D3DFORMAT DisplayF=
ormat, DWORD FormatOp);
 =

-HRESULT CheckDeviceFormat(LPD3D9_DRIVERCAPS pDriverCaps, D3DFORMAT Display=
Format, D3DFORMAT BackBufferFormat, BOOL Windowed);
+HRESULT CheckDeviceType(LPD3D9_DRIVERCAPS pDriverCaps, D3DFORMAT DisplayFo=
rmat, D3DFORMAT BackBufferFormat, BOOL Windowed);
+
+HRESULT CheckDeviceFormat(LPD3D9_DRIVERCAPS pDriverCaps, D3DFORMAT Adapter=
Format, DWORD Usage, D3DRESOURCETYPE RType, D3DFORMAT CheckFormat);
 =

 #endif // _FORMAT_H_

Modified: trunk/reactos/include/psdk/d3d9types.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/d3d9type=
s.h?rev=3D32541&r1=3D32540&r2=3D32541&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/reactos/include/psdk/d3d9types.h (original)
+++ trunk/reactos/include/psdk/d3d9types.h Sun Mar  2 13:29:35 2008
@@ -110,6 +110,9 @@
 #define D3DUSAGE_DYNAMIC            0x00000200L
 #define D3DUSAGE_AUTOGENMIPMAP      0x00000400L
 #define D3DUSAGE_DMAP               0x00004000L
+#ifndef D3D_DISABLE_9EX
+#define D3DUSAGE_TEXTAPI            0x10000000L
+#endif
 =

 #define D3DUSAGE_QUERY_FILTER                   0x00020000L
 #define D3DUSAGE_QUERY_LEGACYBUMPMAP            0x00008000L




More information about the Ros-diffs mailing list