From 6f5a1d9a150e0371580f818167ddca5e3c9890e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Fri, 7 Aug 2009 12:17:41 +0200 Subject: [PATCH] wined3d: Filter WINED3DSTENCILCAPS_TWOSIDED in d3d8. --- dlls/d3d8/d3d8_private.h | 2 ++ dlls/d3d8/device.c | 10 +--------- dlls/d3d8/directx.c | 24 +++++++++++++++--------- dlls/wined3d/directx.c | 4 +--- 4 files changed, 19 insertions(+), 21 deletions(-) diff --git a/dlls/d3d8/d3d8_private.h b/dlls/d3d8/d3d8_private.h index 9fa830d028d..a3aeff1aff3 100644 --- a/dlls/d3d8/d3d8_private.h +++ b/dlls/d3d8/d3d8_private.h @@ -97,6 +97,8 @@ _pD3D8Caps->PixelShaderVersion = _pWineCaps->PixelShaderVersion; \ _pD3D8Caps->MaxPixelShaderValue = _pWineCaps->PixelShader1xMaxValue; +void fixup_caps(WINED3DCAPS *pWineCaps); + /* Direct3D8 Interfaces: */ typedef struct IDirect3DBaseTexture8Impl IDirect3DBaseTexture8Impl; typedef struct IDirect3DVolumeTexture8Impl IDirect3DVolumeTexture8Impl; diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index ee41ab48049..2e854f7b1bf 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -394,18 +394,10 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetDeviceCaps(LPDIRECT3DDEVICE8 iface EnterCriticalSection(&d3d8_cs); hrc = IWineD3DDevice_GetDeviceCaps(This->WineD3DDevice, pWineCaps); LeaveCriticalSection(&d3d8_cs); + fixup_caps(pWineCaps); WINECAPSTOD3D8CAPS(pCaps, pWineCaps) HeapFree(GetProcessHeap(), 0, pWineCaps); - /* D3D8 doesn't support SM 2.0 or higher, so clamp to 1.x */ - if(pCaps->PixelShaderVersion > D3DPS_VERSION(1,4)){ - pCaps->PixelShaderVersion = D3DPS_VERSION(1,4); - } - if(pCaps->VertexShaderVersion > D3DVS_VERSION(1,1)){ - pCaps->VertexShaderVersion = D3DVS_VERSION(1,1); - } - pCaps->MaxVertexShaderConst = min(D3D8_MAX_VERTEX_SHADER_CONSTANTF, pCaps->MaxVertexShaderConst); - TRACE("Returning %p %p\n", This, pCaps); return hrc; } diff --git a/dlls/d3d8/directx.c b/dlls/d3d8/directx.c index c50c4b29dc8..eed4b8b0994 100644 --- a/dlls/d3d8/directx.c +++ b/dlls/d3d8/directx.c @@ -250,6 +250,20 @@ static HRESULT WINAPI IDirect3D8Impl_CheckDepthStencilMatch(LPDIRECT3D8 iface, return hr; } +void fixup_caps(WINED3DCAPS *caps) +{ + /* D3D8 doesn't support SM 2.0 or higher, so clamp to 1.x */ + if (caps->PixelShaderVersion > D3DPS_VERSION(1,4)) { + caps->PixelShaderVersion = D3DPS_VERSION(1,4); + } + if (caps->VertexShaderVersion > D3DVS_VERSION(1,1)) { + caps->VertexShaderVersion = D3DVS_VERSION(1,1); + } + caps->MaxVertexShaderConst = min(D3D8_MAX_VERTEX_SHADER_CONSTANTF, caps->MaxVertexShaderConst); + + caps->StencilCaps &= ~WINED3DSTENCILCAPS_TWOSIDED; +} + static HRESULT WINAPI IDirect3D8Impl_GetDeviceCaps(LPDIRECT3D8 iface, UINT Adapter, D3DDEVTYPE DeviceType, D3DCAPS8* pCaps) { IDirect3D8Impl *This = (IDirect3D8Impl *)iface; HRESULT hrc = D3D_OK; @@ -267,18 +281,10 @@ static HRESULT WINAPI IDirect3D8Impl_GetDeviceCaps(LPDIRECT3D8 iface, UINT Ada EnterCriticalSection(&d3d8_cs); hrc = IWineD3D_GetDeviceCaps(This->WineD3D, Adapter, DeviceType, pWineCaps); LeaveCriticalSection(&d3d8_cs); + fixup_caps(pWineCaps); WINECAPSTOD3D8CAPS(pCaps, pWineCaps) HeapFree(GetProcessHeap(), 0, pWineCaps); - /* D3D8 doesn't support SM 2.0 or higher, so clamp to 1.x */ - if(pCaps->PixelShaderVersion > D3DPS_VERSION(1,4)){ - pCaps->PixelShaderVersion = D3DPS_VERSION(1,4); - } - if(pCaps->VertexShaderVersion > D3DVS_VERSION(1,1)){ - pCaps->VertexShaderVersion = D3DVS_VERSION(1,1); - } - pCaps->MaxVertexShaderConst = min(D3D8_MAX_VERTEX_SHADER_CONSTANTF, pCaps->MaxVertexShaderConst); - TRACE("(%p) returning %p\n", This, pCaps); return hrc; } diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 554dc5e729c..1498684243e 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -4050,9 +4050,7 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, pCaps->StencilCaps |= WINED3DSTENCILCAPS_DECR | WINED3DSTENCILCAPS_INCR; } - if ( This->dxVersion > 8 && - ( GL_SUPPORT(EXT_STENCIL_TWO_SIDE) || - GL_SUPPORT(ATI_SEPARATE_STENCIL) ) ) { + if (GL_SUPPORT(EXT_STENCIL_TWO_SIDE) || GL_SUPPORT(ATI_SEPARATE_STENCIL)) { pCaps->StencilCaps |= WINED3DSTENCILCAPS_TWOSIDED; }