Commit 4735690d authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

ddraw: Introduce a helper function for initializing a D3DDEVICEDESC structure…

ddraw: Introduce a helper function for initializing a D3DDEVICEDESC structure from a D3DDEVICEDESC7 structure.
parent 7859509f
......@@ -1165,6 +1165,269 @@ static HRESULT WINAPI ddraw1_SetDisplayMode(IDirectDraw *iface, DWORD width, DWO
return ddraw7_SetDisplayMode(&ddraw->IDirectDraw7_iface, width, height, bpp, 0, 0);
}
void ddraw_d3dcaps1_from_7(D3DDEVICEDESC *caps1, D3DDEVICEDESC7 *caps7)
{
memset(caps1, 0, sizeof(*caps1));
caps1->dwSize = sizeof(*caps1);
caps1->dwFlags = D3DDD_COLORMODEL
| D3DDD_DEVCAPS
| D3DDD_TRANSFORMCAPS
| D3DDD_BCLIPPING
| D3DDD_LIGHTINGCAPS
| D3DDD_LINECAPS
| D3DDD_TRICAPS
| D3DDD_DEVICERENDERBITDEPTH
| D3DDD_DEVICEZBUFFERBITDEPTH
| D3DDD_MAXBUFFERSIZE
| D3DDD_MAXVERTEXCOUNT;
caps1->dcmColorModel = D3DCOLOR_RGB;
caps1->dwDevCaps = caps7->dwDevCaps;
caps1->dtcTransformCaps.dwSize = sizeof(caps1->dtcTransformCaps);
caps1->dtcTransformCaps.dwCaps = D3DTRANSFORMCAPS_CLIP;
caps1->bClipping = TRUE;
caps1->dlcLightingCaps.dwSize = sizeof(caps1->dlcLightingCaps);
caps1->dlcLightingCaps.dwCaps = D3DLIGHTCAPS_DIRECTIONAL
| D3DLIGHTCAPS_PARALLELPOINT
| D3DLIGHTCAPS_POINT
| D3DLIGHTCAPS_SPOT;
caps1->dlcLightingCaps.dwLightingModel = D3DLIGHTINGMODEL_RGB;
caps1->dlcLightingCaps.dwNumLights = caps7->dwMaxActiveLights;
caps1->dpcLineCaps = caps7->dpcLineCaps;
caps1->dpcTriCaps = caps7->dpcTriCaps;
caps1->dwDeviceRenderBitDepth = caps7->dwDeviceRenderBitDepth;
caps1->dwDeviceZBufferBitDepth = caps7->dwDeviceZBufferBitDepth;
caps1->dwMaxBufferSize = 0;
caps1->dwMaxVertexCount = 65536;
caps1->dwMinTextureWidth = caps7->dwMinTextureWidth;
caps1->dwMinTextureHeight = caps7->dwMinTextureHeight;
caps1->dwMaxTextureWidth = caps7->dwMaxTextureWidth;
caps1->dwMaxTextureHeight = caps7->dwMaxTextureHeight;
caps1->dwMinStippleWidth = 1;
caps1->dwMinStippleHeight = 1;
caps1->dwMaxStippleWidth = 32;
caps1->dwMaxStippleHeight = 32;
caps1->dwMaxTextureRepeat = caps7->dwMaxTextureRepeat;
caps1->dwMaxTextureAspectRatio = caps7->dwMaxTextureAspectRatio;
caps1->dwMaxAnisotropy = caps7->dwMaxAnisotropy;
caps1->dvGuardBandLeft = caps7->dvGuardBandLeft;
caps1->dvGuardBandTop = caps7->dvGuardBandTop;
caps1->dvGuardBandRight = caps7->dvGuardBandRight;
caps1->dvGuardBandBottom = caps7->dvGuardBandBottom;
caps1->dvExtentsAdjust = caps7->dvExtentsAdjust;
caps1->dwStencilCaps = caps7->dwStencilCaps;
caps1->dwFVFCaps = caps7->dwFVFCaps;
caps1->dwTextureOpCaps = caps7->dwTextureOpCaps;
caps1->wMaxTextureBlendStages = caps7->wMaxTextureBlendStages;
caps1->wMaxSimultaneousTextures = caps7->wMaxSimultaneousTextures;
}
HRESULT ddraw_get_d3dcaps(const struct ddraw *ddraw, D3DDEVICEDESC7 *caps)
{
WINED3DCAPS wined3d_caps;
HRESULT hr;
TRACE("ddraw %p, caps %p.\n", ddraw, caps);
memset(&wined3d_caps, 0, sizeof(wined3d_caps));
wined3d_mutex_lock();
hr = wined3d_get_device_caps(ddraw->wined3d, 0, WINED3D_DEVICE_TYPE_HAL, &wined3d_caps);
wined3d_mutex_unlock();
if (FAILED(hr))
{
WARN("Failed to get device caps, hr %#x.\n", hr);
return hr;
}
caps->dwDevCaps = wined3d_caps.DevCaps;
caps->dpcLineCaps.dwMiscCaps = wined3d_caps.PrimitiveMiscCaps;
caps->dpcLineCaps.dwRasterCaps = wined3d_caps.RasterCaps;
caps->dpcLineCaps.dwZCmpCaps = wined3d_caps.ZCmpCaps;
caps->dpcLineCaps.dwSrcBlendCaps = wined3d_caps.SrcBlendCaps;
caps->dpcLineCaps.dwDestBlendCaps = wined3d_caps.DestBlendCaps;
caps->dpcLineCaps.dwAlphaCmpCaps = wined3d_caps.AlphaCmpCaps;
caps->dpcLineCaps.dwShadeCaps = wined3d_caps.ShadeCaps;
caps->dpcLineCaps.dwTextureCaps = wined3d_caps.TextureCaps;
caps->dpcLineCaps.dwTextureFilterCaps = wined3d_caps.TextureFilterCaps;
caps->dpcLineCaps.dwTextureAddressCaps = wined3d_caps.TextureAddressCaps;
caps->dwMaxTextureWidth = wined3d_caps.MaxTextureWidth;
caps->dwMaxTextureHeight = wined3d_caps.MaxTextureHeight;
caps->dwMaxTextureRepeat = wined3d_caps.MaxTextureRepeat;
caps->dwMaxTextureAspectRatio = wined3d_caps.MaxTextureAspectRatio;
caps->dwMaxAnisotropy = wined3d_caps.MaxAnisotropy;
caps->dvMaxVertexW = wined3d_caps.MaxVertexW;
caps->dvGuardBandLeft = wined3d_caps.GuardBandLeft;
caps->dvGuardBandTop = wined3d_caps.GuardBandTop;
caps->dvGuardBandRight = wined3d_caps.GuardBandRight;
caps->dvGuardBandBottom = wined3d_caps.GuardBandBottom;
caps->dvExtentsAdjust = wined3d_caps.ExtentsAdjust;
caps->dwStencilCaps = wined3d_caps.StencilCaps;
caps->dwFVFCaps = wined3d_caps.FVFCaps;
caps->dwTextureOpCaps = wined3d_caps.TextureOpCaps;
caps->dwVertexProcessingCaps = wined3d_caps.VertexProcessingCaps;
caps->dwMaxActiveLights = wined3d_caps.MaxActiveLights;
/* Remove all non-d3d7 caps */
caps->dwDevCaps &= (
D3DDEVCAPS_FLOATTLVERTEX | D3DDEVCAPS_SORTINCREASINGZ | D3DDEVCAPS_SORTDECREASINGZ |
D3DDEVCAPS_SORTEXACT | D3DDEVCAPS_EXECUTESYSTEMMEMORY | D3DDEVCAPS_EXECUTEVIDEOMEMORY |
D3DDEVCAPS_TLVERTEXSYSTEMMEMORY | D3DDEVCAPS_TLVERTEXVIDEOMEMORY | D3DDEVCAPS_TEXTURESYSTEMMEMORY |
D3DDEVCAPS_TEXTUREVIDEOMEMORY | D3DDEVCAPS_DRAWPRIMTLVERTEX | D3DDEVCAPS_CANRENDERAFTERFLIP |
D3DDEVCAPS_TEXTURENONLOCALVIDMEM | D3DDEVCAPS_DRAWPRIMITIVES2 | D3DDEVCAPS_SEPARATETEXTUREMEMORIES |
D3DDEVCAPS_DRAWPRIMITIVES2EX | D3DDEVCAPS_HWTRANSFORMANDLIGHT | D3DDEVCAPS_CANBLTSYSTONONLOCAL |
D3DDEVCAPS_HWRASTERIZATION);
caps->dwStencilCaps &= (
D3DSTENCILCAPS_KEEP | D3DSTENCILCAPS_ZERO | D3DSTENCILCAPS_REPLACE |
D3DSTENCILCAPS_INCRSAT | D3DSTENCILCAPS_DECRSAT | D3DSTENCILCAPS_INVERT |
D3DSTENCILCAPS_INCR | D3DSTENCILCAPS_DECR);
/* FVF caps ?*/
caps->dwTextureOpCaps &= (
D3DTEXOPCAPS_DISABLE | D3DTEXOPCAPS_SELECTARG1 | D3DTEXOPCAPS_SELECTARG2 |
D3DTEXOPCAPS_MODULATE | D3DTEXOPCAPS_MODULATE2X | D3DTEXOPCAPS_MODULATE4X |
D3DTEXOPCAPS_ADD | D3DTEXOPCAPS_ADDSIGNED | D3DTEXOPCAPS_ADDSIGNED2X |
D3DTEXOPCAPS_SUBTRACT | D3DTEXOPCAPS_ADDSMOOTH | D3DTEXOPCAPS_BLENDTEXTUREALPHA |
D3DTEXOPCAPS_BLENDFACTORALPHA | D3DTEXOPCAPS_BLENDTEXTUREALPHAPM | D3DTEXOPCAPS_BLENDCURRENTALPHA |
D3DTEXOPCAPS_PREMODULATE | D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR | D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA |
D3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR | D3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA | D3DTEXOPCAPS_BUMPENVMAP |
D3DTEXOPCAPS_BUMPENVMAPLUMINANCE | D3DTEXOPCAPS_DOTPRODUCT3);
caps->dwVertexProcessingCaps &= (
D3DVTXPCAPS_TEXGEN | D3DVTXPCAPS_MATERIALSOURCE7 | D3DVTXPCAPS_VERTEXFOG |
D3DVTXPCAPS_DIRECTIONALLIGHTS | D3DVTXPCAPS_POSITIONALLIGHTS | D3DVTXPCAPS_LOCALVIEWER);
caps->dpcLineCaps.dwMiscCaps &= (
D3DPMISCCAPS_MASKPLANES | D3DPMISCCAPS_MASKZ | D3DPMISCCAPS_LINEPATTERNREP |
D3DPMISCCAPS_CONFORMANT | D3DPMISCCAPS_CULLNONE | D3DPMISCCAPS_CULLCW |
D3DPMISCCAPS_CULLCCW);
caps->dpcLineCaps.dwRasterCaps &= (
D3DPRASTERCAPS_DITHER | D3DPRASTERCAPS_ROP2 | D3DPRASTERCAPS_XOR |
D3DPRASTERCAPS_PAT | D3DPRASTERCAPS_ZTEST | D3DPRASTERCAPS_SUBPIXEL |
D3DPRASTERCAPS_SUBPIXELX | D3DPRASTERCAPS_FOGVERTEX | D3DPRASTERCAPS_FOGTABLE |
D3DPRASTERCAPS_STIPPLE | D3DPRASTERCAPS_ANTIALIASSORTDEPENDENT | D3DPRASTERCAPS_ANTIALIASSORTINDEPENDENT |
D3DPRASTERCAPS_ANTIALIASEDGES | D3DPRASTERCAPS_MIPMAPLODBIAS | D3DPRASTERCAPS_ZBIAS |
D3DPRASTERCAPS_ZBUFFERLESSHSR | D3DPRASTERCAPS_FOGRANGE | D3DPRASTERCAPS_ANISOTROPY |
D3DPRASTERCAPS_WBUFFER | D3DPRASTERCAPS_TRANSLUCENTSORTINDEPENDENT | D3DPRASTERCAPS_WFOG |
D3DPRASTERCAPS_ZFOG);
caps->dpcLineCaps.dwZCmpCaps &= (
D3DPCMPCAPS_NEVER | D3DPCMPCAPS_LESS | D3DPCMPCAPS_EQUAL |
D3DPCMPCAPS_LESSEQUAL | D3DPCMPCAPS_GREATER | D3DPCMPCAPS_NOTEQUAL |
D3DPCMPCAPS_GREATEREQUAL | D3DPCMPCAPS_ALWAYS);
caps->dpcLineCaps.dwSrcBlendCaps &= (
D3DPBLENDCAPS_ZERO | D3DPBLENDCAPS_ONE | D3DPBLENDCAPS_SRCCOLOR |
D3DPBLENDCAPS_INVSRCCOLOR | D3DPBLENDCAPS_SRCALPHA | D3DPBLENDCAPS_INVSRCALPHA |
D3DPBLENDCAPS_DESTALPHA | D3DPBLENDCAPS_INVDESTALPHA | D3DPBLENDCAPS_DESTCOLOR |
D3DPBLENDCAPS_INVDESTCOLOR | D3DPBLENDCAPS_SRCALPHASAT | D3DPBLENDCAPS_BOTHSRCALPHA |
D3DPBLENDCAPS_BOTHINVSRCALPHA);
caps->dpcLineCaps.dwDestBlendCaps &= (
D3DPBLENDCAPS_ZERO | D3DPBLENDCAPS_ONE | D3DPBLENDCAPS_SRCCOLOR |
D3DPBLENDCAPS_INVSRCCOLOR | D3DPBLENDCAPS_SRCALPHA | D3DPBLENDCAPS_INVSRCALPHA |
D3DPBLENDCAPS_DESTALPHA | D3DPBLENDCAPS_INVDESTALPHA | D3DPBLENDCAPS_DESTCOLOR |
D3DPBLENDCAPS_INVDESTCOLOR | D3DPBLENDCAPS_SRCALPHASAT | D3DPBLENDCAPS_BOTHSRCALPHA |
D3DPBLENDCAPS_BOTHINVSRCALPHA);
caps->dpcLineCaps.dwAlphaCmpCaps &= (
D3DPCMPCAPS_NEVER | D3DPCMPCAPS_LESS | D3DPCMPCAPS_EQUAL |
D3DPCMPCAPS_LESSEQUAL | D3DPCMPCAPS_GREATER | D3DPCMPCAPS_NOTEQUAL |
D3DPCMPCAPS_GREATEREQUAL | D3DPCMPCAPS_ALWAYS);
caps->dpcLineCaps.dwShadeCaps &= (
D3DPSHADECAPS_COLORFLATMONO | D3DPSHADECAPS_COLORFLATRGB | D3DPSHADECAPS_COLORGOURAUDMONO |
D3DPSHADECAPS_COLORGOURAUDRGB | D3DPSHADECAPS_COLORPHONGMONO | D3DPSHADECAPS_COLORPHONGRGB |
D3DPSHADECAPS_SPECULARFLATMONO | D3DPSHADECAPS_SPECULARFLATRGB | D3DPSHADECAPS_SPECULARGOURAUDMONO |
D3DPSHADECAPS_SPECULARGOURAUDRGB | D3DPSHADECAPS_SPECULARPHONGMONO | D3DPSHADECAPS_SPECULARPHONGRGB |
D3DPSHADECAPS_ALPHAFLATBLEND | D3DPSHADECAPS_ALPHAFLATSTIPPLED | D3DPSHADECAPS_ALPHAGOURAUDBLEND |
D3DPSHADECAPS_ALPHAGOURAUDSTIPPLED | D3DPSHADECAPS_ALPHAPHONGBLEND | D3DPSHADECAPS_ALPHAPHONGSTIPPLED |
D3DPSHADECAPS_FOGFLAT | D3DPSHADECAPS_FOGGOURAUD | D3DPSHADECAPS_FOGPHONG);
caps->dpcLineCaps.dwTextureCaps &= (
D3DPTEXTURECAPS_PERSPECTIVE | D3DPTEXTURECAPS_POW2 | D3DPTEXTURECAPS_ALPHA |
D3DPTEXTURECAPS_TRANSPARENCY | D3DPTEXTURECAPS_BORDER | D3DPTEXTURECAPS_SQUAREONLY |
D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE | D3DPTEXTURECAPS_ALPHAPALETTE| D3DPTEXTURECAPS_NONPOW2CONDITIONAL |
D3DPTEXTURECAPS_PROJECTED | D3DPTEXTURECAPS_CUBEMAP | D3DPTEXTURECAPS_COLORKEYBLEND);
caps->dpcLineCaps.dwTextureFilterCaps &= (
D3DPTFILTERCAPS_NEAREST | D3DPTFILTERCAPS_LINEAR | D3DPTFILTERCAPS_MIPNEAREST |
D3DPTFILTERCAPS_MIPLINEAR | D3DPTFILTERCAPS_LINEARMIPNEAREST | D3DPTFILTERCAPS_LINEARMIPLINEAR |
D3DPTFILTERCAPS_MINFPOINT | D3DPTFILTERCAPS_MINFLINEAR | D3DPTFILTERCAPS_MINFANISOTROPIC |
D3DPTFILTERCAPS_MIPFPOINT | D3DPTFILTERCAPS_MIPFLINEAR | D3DPTFILTERCAPS_MAGFPOINT |
D3DPTFILTERCAPS_MAGFLINEAR | D3DPTFILTERCAPS_MAGFANISOTROPIC | D3DPTFILTERCAPS_MAGFAFLATCUBIC |
D3DPTFILTERCAPS_MAGFGAUSSIANCUBIC);
caps->dpcLineCaps.dwTextureAddressCaps &= (
D3DPTADDRESSCAPS_WRAP | D3DPTADDRESSCAPS_MIRROR | D3DPTADDRESSCAPS_CLAMP |
D3DPTADDRESSCAPS_BORDER | D3DPTADDRESSCAPS_INDEPENDENTUV);
if (!(caps->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2))
{
/* DirectX7 always has the np2 flag set, no matter what the card
* supports. Some old games (Rollcage) check the caps incorrectly.
* If wined3d supports nonpow2 textures it also has np2 conditional
* support. */
caps->dpcLineCaps.dwTextureCaps |= D3DPTEXTURECAPS_POW2 | D3DPTEXTURECAPS_NONPOW2CONDITIONAL;
}
/* Fill the missing members, and do some fixup */
caps->dpcLineCaps.dwSize = sizeof(caps->dpcLineCaps);
caps->dpcLineCaps.dwTextureBlendCaps = D3DPTBLENDCAPS_ADD
| D3DPTBLENDCAPS_MODULATEMASK
| D3DPTBLENDCAPS_COPY
| D3DPTBLENDCAPS_DECAL
| D3DPTBLENDCAPS_DECALALPHA
| D3DPTBLENDCAPS_DECALMASK
| D3DPTBLENDCAPS_MODULATE
| D3DPTBLENDCAPS_MODULATEALPHA;
caps->dpcLineCaps.dwStippleWidth = 32;
caps->dpcLineCaps.dwStippleHeight = 32;
/* Use the same for the TriCaps */
caps->dpcTriCaps = caps->dpcLineCaps;
caps->dwDeviceRenderBitDepth = DDBD_16 | DDBD_24 | DDBD_32;
caps->dwDeviceZBufferBitDepth = DDBD_16 | DDBD_24;
caps->dwMinTextureWidth = 1;
caps->dwMinTextureHeight = 1;
/* Convert DWORDs safely to WORDs */
if (wined3d_caps.MaxTextureBlendStages > 0xffff)
caps->wMaxTextureBlendStages = 0xffff;
else
caps->wMaxTextureBlendStages = (WORD)wined3d_caps.MaxTextureBlendStages;
if (wined3d_caps.MaxSimultaneousTextures > 0xffff)
caps->wMaxSimultaneousTextures = 0xffff;
else
caps->wMaxSimultaneousTextures = (WORD)wined3d_caps.MaxSimultaneousTextures;
if (wined3d_caps.MaxUserClipPlanes > 0xffff)
caps->wMaxUserClipPlanes = 0xffff;
else
caps->wMaxUserClipPlanes = (WORD)wined3d_caps.MaxUserClipPlanes;
if (wined3d_caps.MaxVertexBlendMatrices > 0xffff)
caps->wMaxVertexBlendMatrices = 0xffff;
else
caps->wMaxVertexBlendMatrices = (WORD)wined3d_caps.MaxVertexBlendMatrices;
caps->deviceGUID = IID_IDirect3DTnLHalDevice;
caps->dwReserved1 = 0;
caps->dwReserved2 = 0;
caps->dwReserved3 = 0;
caps->dwReserved4 = 0;
return DD_OK;
}
/*****************************************************************************
* IDirectDraw7::GetCaps
*
......@@ -3707,7 +3970,6 @@ static HRESULT WINAPI d3d7_EnumDevices(IDirect3D7 *iface, LPD3DENUMDEVICESCALLBA
{
struct ddraw *ddraw = impl_from_IDirect3D7(iface);
D3DDEVICEDESC7 device_desc7;
D3DDEVICEDESC device_desc1;
HRESULT hr;
size_t i;
......@@ -3718,8 +3980,7 @@ static HRESULT WINAPI d3d7_EnumDevices(IDirect3D7 *iface, LPD3DENUMDEVICESCALLBA
wined3d_mutex_lock();
hr = IDirect3DImpl_GetCaps(ddraw->wined3d, &device_desc1, &device_desc7);
if (hr != D3D_OK)
if (FAILED(hr = ddraw_get_d3dcaps(ddraw, &device_desc7)))
{
wined3d_mutex_unlock();
return hr;
......@@ -3785,12 +4046,12 @@ static HRESULT WINAPI d3d3_EnumDevices(IDirect3D3 *iface, LPD3DENUMDEVICESCALLBA
wined3d_mutex_lock();
hr = IDirect3DImpl_GetCaps(ddraw->wined3d, &device_desc1, &device_desc7);
if (hr != D3D_OK)
if (FAILED(hr = ddraw_get_d3dcaps(ddraw, &device_desc7)))
{
wined3d_mutex_unlock();
return hr;
}
ddraw_d3dcaps1_from_7(&device_desc1, &device_desc7);
/* Do I have to enumerate the reference id? Note from old d3d7:
* "It seems that enumerating the reference IID on Direct3D 1 games
......@@ -4149,10 +4410,11 @@ static HRESULT WINAPI d3d3_FindDevice(IDirect3D3 *iface, D3DFINDDEVICESEARCH *fd
}
/* Get the caps */
hr = IDirect3DImpl_GetCaps(ddraw->wined3d, &desc1, &desc7);
if (hr != D3D_OK) return hr;
if (FAILED(hr = ddraw_get_d3dcaps(ddraw, &desc7)))
return hr;
/* Now return our own GUID */
ddraw_d3dcaps1_from_7(&desc1, &desc7);
fdr->guid = IID_D3DDEVICE_WineD3D;
fdr->ddHwDesc = desc1;
fdr->ddSwDesc = desc1;
......@@ -4528,301 +4790,6 @@ static HRESULT WINAPI d3d3_EvictManagedTextures(IDirect3D3 *iface)
}
/*****************************************************************************
* IDirect3DImpl_GetCaps
*
* This function retrieves the device caps from wined3d
* and converts it into a D3D7 and D3D - D3D3 structure
* This is a helper function called from various places in ddraw
*
* Params:
* wined3d: The interface to get the caps from
* desc1: Old D3D <3 structure to fill (needed)
* desc7: D3D7 device desc structure to fill (needed)
*
* Returns
* D3D_OK on success, or the return value of IWineD3D::GetCaps
*
*****************************************************************************/
HRESULT IDirect3DImpl_GetCaps(const struct wined3d *wined3d, D3DDEVICEDESC *desc1, D3DDEVICEDESC7 *desc7)
{
WINED3DCAPS wined3d_caps;
HRESULT hr;
TRACE("wined3d %p, desc1 %p, desc7 %p.\n", wined3d, desc1, desc7);
memset(&wined3d_caps, 0, sizeof(wined3d_caps));
wined3d_mutex_lock();
hr = wined3d_get_device_caps(wined3d, 0, WINED3D_DEVICE_TYPE_HAL, &wined3d_caps);
wined3d_mutex_unlock();
if (FAILED(hr))
{
WARN("Failed to get device caps, hr %#x.\n", hr);
return hr;
}
/* Copy the results into the d3d7 and d3d3 structures */
desc7->dwDevCaps = wined3d_caps.DevCaps;
desc7->dpcLineCaps.dwMiscCaps = wined3d_caps.PrimitiveMiscCaps;
desc7->dpcLineCaps.dwRasterCaps = wined3d_caps.RasterCaps;
desc7->dpcLineCaps.dwZCmpCaps = wined3d_caps.ZCmpCaps;
desc7->dpcLineCaps.dwSrcBlendCaps = wined3d_caps.SrcBlendCaps;
desc7->dpcLineCaps.dwDestBlendCaps = wined3d_caps.DestBlendCaps;
desc7->dpcLineCaps.dwAlphaCmpCaps = wined3d_caps.AlphaCmpCaps;
desc7->dpcLineCaps.dwShadeCaps = wined3d_caps.ShadeCaps;
desc7->dpcLineCaps.dwTextureCaps = wined3d_caps.TextureCaps;
desc7->dpcLineCaps.dwTextureFilterCaps = wined3d_caps.TextureFilterCaps;
desc7->dpcLineCaps.dwTextureAddressCaps = wined3d_caps.TextureAddressCaps;
desc7->dwMaxTextureWidth = wined3d_caps.MaxTextureWidth;
desc7->dwMaxTextureHeight = wined3d_caps.MaxTextureHeight;
desc7->dwMaxTextureRepeat = wined3d_caps.MaxTextureRepeat;
desc7->dwMaxTextureAspectRatio = wined3d_caps.MaxTextureAspectRatio;
desc7->dwMaxAnisotropy = wined3d_caps.MaxAnisotropy;
desc7->dvMaxVertexW = wined3d_caps.MaxVertexW;
desc7->dvGuardBandLeft = wined3d_caps.GuardBandLeft;
desc7->dvGuardBandTop = wined3d_caps.GuardBandTop;
desc7->dvGuardBandRight = wined3d_caps.GuardBandRight;
desc7->dvGuardBandBottom = wined3d_caps.GuardBandBottom;
desc7->dvExtentsAdjust = wined3d_caps.ExtentsAdjust;
desc7->dwStencilCaps = wined3d_caps.StencilCaps;
desc7->dwFVFCaps = wined3d_caps.FVFCaps;
desc7->dwTextureOpCaps = wined3d_caps.TextureOpCaps;
desc7->dwVertexProcessingCaps = wined3d_caps.VertexProcessingCaps;
desc7->dwMaxActiveLights = wined3d_caps.MaxActiveLights;
/* Remove all non-d3d7 caps */
desc7->dwDevCaps &= (
D3DDEVCAPS_FLOATTLVERTEX | D3DDEVCAPS_SORTINCREASINGZ | D3DDEVCAPS_SORTDECREASINGZ |
D3DDEVCAPS_SORTEXACT | D3DDEVCAPS_EXECUTESYSTEMMEMORY | D3DDEVCAPS_EXECUTEVIDEOMEMORY |
D3DDEVCAPS_TLVERTEXSYSTEMMEMORY | D3DDEVCAPS_TLVERTEXVIDEOMEMORY | D3DDEVCAPS_TEXTURESYSTEMMEMORY |
D3DDEVCAPS_TEXTUREVIDEOMEMORY | D3DDEVCAPS_DRAWPRIMTLVERTEX | D3DDEVCAPS_CANRENDERAFTERFLIP |
D3DDEVCAPS_TEXTURENONLOCALVIDMEM | D3DDEVCAPS_DRAWPRIMITIVES2 | D3DDEVCAPS_SEPARATETEXTUREMEMORIES |
D3DDEVCAPS_DRAWPRIMITIVES2EX | D3DDEVCAPS_HWTRANSFORMANDLIGHT | D3DDEVCAPS_CANBLTSYSTONONLOCAL |
D3DDEVCAPS_HWRASTERIZATION);
desc7->dwStencilCaps &= (
D3DSTENCILCAPS_KEEP | D3DSTENCILCAPS_ZERO | D3DSTENCILCAPS_REPLACE |
D3DSTENCILCAPS_INCRSAT | D3DSTENCILCAPS_DECRSAT | D3DSTENCILCAPS_INVERT |
D3DSTENCILCAPS_INCR | D3DSTENCILCAPS_DECR);
/* FVF caps ?*/
desc7->dwTextureOpCaps &= (
D3DTEXOPCAPS_DISABLE | D3DTEXOPCAPS_SELECTARG1 | D3DTEXOPCAPS_SELECTARG2 |
D3DTEXOPCAPS_MODULATE | D3DTEXOPCAPS_MODULATE2X | D3DTEXOPCAPS_MODULATE4X |
D3DTEXOPCAPS_ADD | D3DTEXOPCAPS_ADDSIGNED | D3DTEXOPCAPS_ADDSIGNED2X |
D3DTEXOPCAPS_SUBTRACT | D3DTEXOPCAPS_ADDSMOOTH | D3DTEXOPCAPS_BLENDTEXTUREALPHA |
D3DTEXOPCAPS_BLENDFACTORALPHA | D3DTEXOPCAPS_BLENDTEXTUREALPHAPM | D3DTEXOPCAPS_BLENDCURRENTALPHA |
D3DTEXOPCAPS_PREMODULATE | D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR | D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA |
D3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR | D3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA | D3DTEXOPCAPS_BUMPENVMAP |
D3DTEXOPCAPS_BUMPENVMAPLUMINANCE | D3DTEXOPCAPS_DOTPRODUCT3);
desc7->dwVertexProcessingCaps &= (
D3DVTXPCAPS_TEXGEN | D3DVTXPCAPS_MATERIALSOURCE7 | D3DVTXPCAPS_VERTEXFOG |
D3DVTXPCAPS_DIRECTIONALLIGHTS | D3DVTXPCAPS_POSITIONALLIGHTS | D3DVTXPCAPS_LOCALVIEWER);
desc7->dpcLineCaps.dwMiscCaps &= (
D3DPMISCCAPS_MASKPLANES | D3DPMISCCAPS_MASKZ | D3DPMISCCAPS_LINEPATTERNREP |
D3DPMISCCAPS_CONFORMANT | D3DPMISCCAPS_CULLNONE | D3DPMISCCAPS_CULLCW |
D3DPMISCCAPS_CULLCCW);
desc7->dpcLineCaps.dwRasterCaps &= (
D3DPRASTERCAPS_DITHER | D3DPRASTERCAPS_ROP2 | D3DPRASTERCAPS_XOR |
D3DPRASTERCAPS_PAT | D3DPRASTERCAPS_ZTEST | D3DPRASTERCAPS_SUBPIXEL |
D3DPRASTERCAPS_SUBPIXELX | D3DPRASTERCAPS_FOGVERTEX | D3DPRASTERCAPS_FOGTABLE |
D3DPRASTERCAPS_STIPPLE | D3DPRASTERCAPS_ANTIALIASSORTDEPENDENT | D3DPRASTERCAPS_ANTIALIASSORTINDEPENDENT |
D3DPRASTERCAPS_ANTIALIASEDGES | D3DPRASTERCAPS_MIPMAPLODBIAS | D3DPRASTERCAPS_ZBIAS |
D3DPRASTERCAPS_ZBUFFERLESSHSR | D3DPRASTERCAPS_FOGRANGE | D3DPRASTERCAPS_ANISOTROPY |
D3DPRASTERCAPS_WBUFFER | D3DPRASTERCAPS_TRANSLUCENTSORTINDEPENDENT | D3DPRASTERCAPS_WFOG |
D3DPRASTERCAPS_ZFOG);
desc7->dpcLineCaps.dwZCmpCaps &= (
D3DPCMPCAPS_NEVER | D3DPCMPCAPS_LESS | D3DPCMPCAPS_EQUAL |
D3DPCMPCAPS_LESSEQUAL | D3DPCMPCAPS_GREATER | D3DPCMPCAPS_NOTEQUAL |
D3DPCMPCAPS_GREATEREQUAL | D3DPCMPCAPS_ALWAYS);
desc7->dpcLineCaps.dwSrcBlendCaps &= (
D3DPBLENDCAPS_ZERO | D3DPBLENDCAPS_ONE | D3DPBLENDCAPS_SRCCOLOR |
D3DPBLENDCAPS_INVSRCCOLOR | D3DPBLENDCAPS_SRCALPHA | D3DPBLENDCAPS_INVSRCALPHA |
D3DPBLENDCAPS_DESTALPHA | D3DPBLENDCAPS_INVDESTALPHA | D3DPBLENDCAPS_DESTCOLOR |
D3DPBLENDCAPS_INVDESTCOLOR | D3DPBLENDCAPS_SRCALPHASAT | D3DPBLENDCAPS_BOTHSRCALPHA |
D3DPBLENDCAPS_BOTHINVSRCALPHA);
desc7->dpcLineCaps.dwDestBlendCaps &= (
D3DPBLENDCAPS_ZERO | D3DPBLENDCAPS_ONE | D3DPBLENDCAPS_SRCCOLOR |
D3DPBLENDCAPS_INVSRCCOLOR | D3DPBLENDCAPS_SRCALPHA | D3DPBLENDCAPS_INVSRCALPHA |
D3DPBLENDCAPS_DESTALPHA | D3DPBLENDCAPS_INVDESTALPHA | D3DPBLENDCAPS_DESTCOLOR |
D3DPBLENDCAPS_INVDESTCOLOR | D3DPBLENDCAPS_SRCALPHASAT | D3DPBLENDCAPS_BOTHSRCALPHA |
D3DPBLENDCAPS_BOTHINVSRCALPHA);
desc7->dpcLineCaps.dwAlphaCmpCaps &= (
D3DPCMPCAPS_NEVER | D3DPCMPCAPS_LESS | D3DPCMPCAPS_EQUAL |
D3DPCMPCAPS_LESSEQUAL | D3DPCMPCAPS_GREATER | D3DPCMPCAPS_NOTEQUAL |
D3DPCMPCAPS_GREATEREQUAL | D3DPCMPCAPS_ALWAYS);
desc7->dpcLineCaps.dwShadeCaps &= (
D3DPSHADECAPS_COLORFLATMONO | D3DPSHADECAPS_COLORFLATRGB | D3DPSHADECAPS_COLORGOURAUDMONO |
D3DPSHADECAPS_COLORGOURAUDRGB | D3DPSHADECAPS_COLORPHONGMONO | D3DPSHADECAPS_COLORPHONGRGB |
D3DPSHADECAPS_SPECULARFLATMONO | D3DPSHADECAPS_SPECULARFLATRGB | D3DPSHADECAPS_SPECULARGOURAUDMONO |
D3DPSHADECAPS_SPECULARGOURAUDRGB | D3DPSHADECAPS_SPECULARPHONGMONO | D3DPSHADECAPS_SPECULARPHONGRGB |
D3DPSHADECAPS_ALPHAFLATBLEND | D3DPSHADECAPS_ALPHAFLATSTIPPLED | D3DPSHADECAPS_ALPHAGOURAUDBLEND |
D3DPSHADECAPS_ALPHAGOURAUDSTIPPLED | D3DPSHADECAPS_ALPHAPHONGBLEND | D3DPSHADECAPS_ALPHAPHONGSTIPPLED |
D3DPSHADECAPS_FOGFLAT | D3DPSHADECAPS_FOGGOURAUD | D3DPSHADECAPS_FOGPHONG);
desc7->dpcLineCaps.dwTextureCaps &= (
D3DPTEXTURECAPS_PERSPECTIVE | D3DPTEXTURECAPS_POW2 | D3DPTEXTURECAPS_ALPHA |
D3DPTEXTURECAPS_TRANSPARENCY | D3DPTEXTURECAPS_BORDER | D3DPTEXTURECAPS_SQUAREONLY |
D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE | D3DPTEXTURECAPS_ALPHAPALETTE| D3DPTEXTURECAPS_NONPOW2CONDITIONAL |
D3DPTEXTURECAPS_PROJECTED | D3DPTEXTURECAPS_CUBEMAP | D3DPTEXTURECAPS_COLORKEYBLEND);
desc7->dpcLineCaps.dwTextureFilterCaps &= (
D3DPTFILTERCAPS_NEAREST | D3DPTFILTERCAPS_LINEAR | D3DPTFILTERCAPS_MIPNEAREST |
D3DPTFILTERCAPS_MIPLINEAR | D3DPTFILTERCAPS_LINEARMIPNEAREST | D3DPTFILTERCAPS_LINEARMIPLINEAR |
D3DPTFILTERCAPS_MINFPOINT | D3DPTFILTERCAPS_MINFLINEAR | D3DPTFILTERCAPS_MINFANISOTROPIC |
D3DPTFILTERCAPS_MIPFPOINT | D3DPTFILTERCAPS_MIPFLINEAR | D3DPTFILTERCAPS_MAGFPOINT |
D3DPTFILTERCAPS_MAGFLINEAR | D3DPTFILTERCAPS_MAGFANISOTROPIC | D3DPTFILTERCAPS_MAGFAFLATCUBIC |
D3DPTFILTERCAPS_MAGFGAUSSIANCUBIC);
desc7->dpcLineCaps.dwTextureAddressCaps &= (
D3DPTADDRESSCAPS_WRAP | D3DPTADDRESSCAPS_MIRROR | D3DPTADDRESSCAPS_CLAMP |
D3DPTADDRESSCAPS_BORDER | D3DPTADDRESSCAPS_INDEPENDENTUV);
if (!(desc7->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2))
{
/* DirectX7 always has the np2 flag set, no matter what the card
* supports. Some old games (Rollcage) check the caps incorrectly.
* If wined3d supports nonpow2 textures it also has np2 conditional
* support. */
desc7->dpcLineCaps.dwTextureCaps |= D3DPTEXTURECAPS_POW2 | D3DPTEXTURECAPS_NONPOW2CONDITIONAL;
}
/* Fill the missing members, and do some fixup */
desc7->dpcLineCaps.dwSize = sizeof(desc7->dpcLineCaps);
desc7->dpcLineCaps.dwTextureBlendCaps = D3DPTBLENDCAPS_ADD | D3DPTBLENDCAPS_MODULATEMASK |
D3DPTBLENDCAPS_COPY | D3DPTBLENDCAPS_DECAL |
D3DPTBLENDCAPS_DECALALPHA | D3DPTBLENDCAPS_DECALMASK |
D3DPTBLENDCAPS_MODULATE | D3DPTBLENDCAPS_MODULATEALPHA;
desc7->dpcLineCaps.dwStippleWidth = 32;
desc7->dpcLineCaps.dwStippleHeight = 32;
/* Use the same for the TriCaps */
desc7->dpcTriCaps = desc7->dpcLineCaps;
desc7->dwDeviceRenderBitDepth = DDBD_16 | DDBD_24 | DDBD_32;
desc7->dwDeviceZBufferBitDepth = DDBD_16 | DDBD_24;
desc7->dwMinTextureWidth = 1;
desc7->dwMinTextureHeight = 1;
/* Convert DWORDs safely to WORDs */
if (wined3d_caps.MaxTextureBlendStages > 0xffff) desc7->wMaxTextureBlendStages = 0xffff;
else desc7->wMaxTextureBlendStages = (WORD)wined3d_caps.MaxTextureBlendStages;
if (wined3d_caps.MaxSimultaneousTextures > 0xffff) desc7->wMaxSimultaneousTextures = 0xffff;
else desc7->wMaxSimultaneousTextures = (WORD)wined3d_caps.MaxSimultaneousTextures;
if (wined3d_caps.MaxUserClipPlanes > 0xffff) desc7->wMaxUserClipPlanes = 0xffff;
else desc7->wMaxUserClipPlanes = (WORD)wined3d_caps.MaxUserClipPlanes;
if (wined3d_caps.MaxVertexBlendMatrices > 0xffff) desc7->wMaxVertexBlendMatrices = 0xffff;
else desc7->wMaxVertexBlendMatrices = (WORD)wined3d_caps.MaxVertexBlendMatrices;
desc7->deviceGUID = IID_IDirect3DTnLHalDevice;
desc7->dwReserved1 = 0;
desc7->dwReserved2 = 0;
desc7->dwReserved3 = 0;
desc7->dwReserved4 = 0;
/* Fill the old structure */
memset(desc1, 0, sizeof(*desc1));
desc1->dwSize = sizeof(D3DDEVICEDESC);
desc1->dwFlags = D3DDD_COLORMODEL
| D3DDD_DEVCAPS
| D3DDD_TRANSFORMCAPS
| D3DDD_BCLIPPING
| D3DDD_LIGHTINGCAPS
| D3DDD_LINECAPS
| D3DDD_TRICAPS
| D3DDD_DEVICERENDERBITDEPTH
| D3DDD_DEVICEZBUFFERBITDEPTH
| D3DDD_MAXBUFFERSIZE
| D3DDD_MAXVERTEXCOUNT;
desc1->dcmColorModel = D3DCOLOR_RGB;
desc1->dwDevCaps = desc7->dwDevCaps;
desc1->dtcTransformCaps.dwSize = sizeof(D3DTRANSFORMCAPS);
desc1->dtcTransformCaps.dwCaps = D3DTRANSFORMCAPS_CLIP;
desc1->bClipping = TRUE;
desc1->dlcLightingCaps.dwSize = sizeof(D3DLIGHTINGCAPS);
desc1->dlcLightingCaps.dwCaps = D3DLIGHTCAPS_DIRECTIONAL
| D3DLIGHTCAPS_PARALLELPOINT
| D3DLIGHTCAPS_POINT
| D3DLIGHTCAPS_SPOT;
desc1->dlcLightingCaps.dwLightingModel = D3DLIGHTINGMODEL_RGB;
desc1->dlcLightingCaps.dwNumLights = desc7->dwMaxActiveLights;
desc1->dpcLineCaps.dwSize = sizeof(D3DPRIMCAPS);
desc1->dpcLineCaps.dwMiscCaps = desc7->dpcLineCaps.dwMiscCaps;
desc1->dpcLineCaps.dwRasterCaps = desc7->dpcLineCaps.dwRasterCaps;
desc1->dpcLineCaps.dwZCmpCaps = desc7->dpcLineCaps.dwZCmpCaps;
desc1->dpcLineCaps.dwSrcBlendCaps = desc7->dpcLineCaps.dwSrcBlendCaps;
desc1->dpcLineCaps.dwDestBlendCaps = desc7->dpcLineCaps.dwDestBlendCaps;
desc1->dpcLineCaps.dwShadeCaps = desc7->dpcLineCaps.dwShadeCaps;
desc1->dpcLineCaps.dwTextureCaps = desc7->dpcLineCaps.dwTextureCaps;
desc1->dpcLineCaps.dwTextureFilterCaps = desc7->dpcLineCaps.dwTextureFilterCaps;
desc1->dpcLineCaps.dwTextureBlendCaps = desc7->dpcLineCaps.dwTextureBlendCaps;
desc1->dpcLineCaps.dwTextureAddressCaps = desc7->dpcLineCaps.dwTextureAddressCaps;
desc1->dpcLineCaps.dwStippleWidth = desc7->dpcLineCaps.dwStippleWidth;
desc1->dpcLineCaps.dwAlphaCmpCaps = desc7->dpcLineCaps.dwAlphaCmpCaps;
desc1->dpcTriCaps.dwSize = sizeof(D3DPRIMCAPS);
desc1->dpcTriCaps.dwMiscCaps = desc7->dpcTriCaps.dwMiscCaps;
desc1->dpcTriCaps.dwRasterCaps = desc7->dpcTriCaps.dwRasterCaps;
desc1->dpcTriCaps.dwZCmpCaps = desc7->dpcTriCaps.dwZCmpCaps;
desc1->dpcTriCaps.dwSrcBlendCaps = desc7->dpcTriCaps.dwSrcBlendCaps;
desc1->dpcTriCaps.dwDestBlendCaps = desc7->dpcTriCaps.dwDestBlendCaps;
desc1->dpcTriCaps.dwShadeCaps = desc7->dpcTriCaps.dwShadeCaps;
desc1->dpcTriCaps.dwTextureCaps = desc7->dpcTriCaps.dwTextureCaps;
desc1->dpcTriCaps.dwTextureFilterCaps = desc7->dpcTriCaps.dwTextureFilterCaps;
desc1->dpcTriCaps.dwTextureBlendCaps = desc7->dpcTriCaps.dwTextureBlendCaps;
desc1->dpcTriCaps.dwTextureAddressCaps = desc7->dpcTriCaps.dwTextureAddressCaps;
desc1->dpcTriCaps.dwStippleWidth = desc7->dpcTriCaps.dwStippleWidth;
desc1->dpcTriCaps.dwAlphaCmpCaps = desc7->dpcTriCaps.dwAlphaCmpCaps;
desc1->dwDeviceRenderBitDepth = desc7->dwDeviceRenderBitDepth;
desc1->dwDeviceZBufferBitDepth = desc7->dwDeviceZBufferBitDepth;
desc1->dwMaxBufferSize = 0;
desc1->dwMaxVertexCount = 65536;
desc1->dwMinTextureWidth = desc7->dwMinTextureWidth;
desc1->dwMinTextureHeight = desc7->dwMinTextureHeight;
desc1->dwMaxTextureWidth = desc7->dwMaxTextureWidth;
desc1->dwMaxTextureHeight = desc7->dwMaxTextureHeight;
desc1->dwMinStippleWidth = 1;
desc1->dwMinStippleHeight = 1;
desc1->dwMaxStippleWidth = 32;
desc1->dwMaxStippleHeight = 32;
desc1->dwMaxTextureRepeat = desc7->dwMaxTextureRepeat;
desc1->dwMaxTextureAspectRatio = desc7->dwMaxTextureAspectRatio;
desc1->dwMaxAnisotropy = desc7->dwMaxAnisotropy;
desc1->dvGuardBandLeft = desc7->dvGuardBandLeft;
desc1->dvGuardBandRight = desc7->dvGuardBandRight;
desc1->dvGuardBandTop = desc7->dvGuardBandTop;
desc1->dvGuardBandBottom = desc7->dvGuardBandBottom;
desc1->dvExtentsAdjust = desc7->dvExtentsAdjust;
desc1->dwStencilCaps = desc7->dwStencilCaps;
desc1->dwFVFCaps = desc7->dwFVFCaps;
desc1->dwTextureOpCaps = desc7->dwTextureOpCaps;
desc1->wMaxTextureBlendStages = desc7->wMaxTextureBlendStages;
desc1->wMaxSimultaneousTextures = desc7->wMaxSimultaneousTextures;
return DD_OK;
}
/*****************************************************************************
* IDirectDraw7 VTable
*****************************************************************************/
static const struct IDirectDraw7Vtbl ddraw7_vtbl =
......
......@@ -112,7 +112,9 @@ struct ddraw
#define DDRAW_WINDOW_CLASS_NAME "DirectDrawDeviceWnd"
HRESULT ddraw_init(struct ddraw *ddraw, enum wined3d_device_type device_type) DECLSPEC_HIDDEN;
void ddraw_d3dcaps1_from_7(D3DDEVICEDESC *caps1, D3DDEVICEDESC7 *caps7) DECLSPEC_HIDDEN;
void ddraw_destroy_swapchain(struct ddraw *ddraw) DECLSPEC_HIDDEN;
HRESULT ddraw_get_d3dcaps(const struct ddraw *ddraw, D3DDEVICEDESC7 *caps) DECLSPEC_HIDDEN;
static inline void ddraw_set_swapchain_window(struct ddraw *ddraw, HWND window)
{
......@@ -320,10 +322,6 @@ enum wined3d_depth_buffer_type d3d_device_update_depth_stencil(struct d3d_device
/* The IID */
extern const GUID IID_D3DDEVICE_WineD3D DECLSPEC_HIDDEN;
/* Helper functions */
HRESULT IDirect3DImpl_GetCaps(const struct wined3d *wined3d,
D3DDEVICEDESC *Desc123, D3DDEVICEDESC7 *Desc7) DECLSPEC_HIDDEN;
static inline struct d3d_device *impl_from_IDirect3DDevice(IDirect3DDevice *iface)
{
return CONTAINING_RECORD(iface, struct d3d_device, IDirect3DDevice_iface);
......
......@@ -393,37 +393,20 @@ static HRESULT WINAPI d3d_device1_Initialize(IDirect3DDevice *iface,
return D3D_OK;
}
/*****************************************************************************
* IDirect3DDevice7::GetCaps
*
* Retrieves the device's capabilities
*
* This implementation is used for Version 7 only, the older versions have
* their own implementation.
*
* Parameters:
* Desc: Pointer to a D3DDEVICEDESC7 structure to fill
*
* Returns:
* D3D_OK on success
* D3DERR_* if a problem occurs. See WineD3D
*
*****************************************************************************/
static HRESULT d3d_device7_GetCaps(IDirect3DDevice7 *iface, D3DDEVICEDESC7 *Desc)
static HRESULT d3d_device7_GetCaps(IDirect3DDevice7 *iface, D3DDEVICEDESC7 *device_desc)
{
struct d3d_device *device = impl_from_IDirect3DDevice7(iface);
D3DDEVICEDESC OldDesc;
TRACE("iface %p, device_desc %p.\n", iface, Desc);
TRACE("iface %p, device_desc %p.\n", iface, device_desc);
if (!Desc)
if (!device_desc)
{
WARN("Desc is NULL, returning DDERR_INVALIDPARAMS.\n");
WARN("device_desc is NULL, returning DDERR_INVALIDPARAMS.\n");
return DDERR_INVALIDPARAMS;
}
/* Call the same function used by IDirect3D, this saves code */
return IDirect3DImpl_GetCaps(device->ddraw->wined3d, &OldDesc, Desc);
return ddraw_get_d3dcaps(device->ddraw, device_desc);
}
static HRESULT WINAPI d3d_device7_GetCaps_FPUSetup(IDirect3DDevice7 *iface, D3DDEVICEDESC7 *desc)
......@@ -485,8 +468,8 @@ static HRESULT WINAPI d3d_device3_GetCaps(IDirect3DDevice3 *iface,
D3DDEVICEDESC *HWDesc, D3DDEVICEDESC *HelDesc)
{
struct d3d_device *device = impl_from_IDirect3DDevice3(iface);
D3DDEVICEDESC oldDesc;
D3DDEVICEDESC7 newDesc;
D3DDEVICEDESC7 desc7;
D3DDEVICEDESC desc1;
HRESULT hr;
TRACE("iface %p, hw_desc %p, hel_desc %p.\n", iface, HWDesc, HelDesc);
......@@ -512,12 +495,12 @@ static HRESULT WINAPI d3d_device3_GetCaps(IDirect3DDevice3 *iface,
return DDERR_INVALIDPARAMS;
}
hr = IDirect3DImpl_GetCaps(device->ddraw->wined3d, &oldDesc, &newDesc);
if (hr != D3D_OK)
if (FAILED(hr = ddraw_get_d3dcaps(device->ddraw, &desc7)))
return hr;
DD_STRUCT_COPY_BYSIZE(HWDesc, &oldDesc);
DD_STRUCT_COPY_BYSIZE(HelDesc, &oldDesc);
ddraw_d3dcaps1_from_7(&desc1, &desc7);
DD_STRUCT_COPY_BYSIZE(HWDesc, &desc1);
DD_STRUCT_COPY_BYSIZE(HelDesc, &desc1);
return D3D_OK;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment