From 98b56c3ff013fc26d774bd0b4f3d34f1ae04422f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Sat, 5 Apr 2008 23:35:21 +0200 Subject: [PATCH] wined3d: Report D3DUSAGE_QUERY_WRAPANDMIP support. --- dlls/wined3d/directx.c | 46 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 320456c38c8..d0fbf3aef25 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -2053,6 +2053,19 @@ static BOOL CheckPostPixelShaderBlendingCapability(UINT Adapter, WINED3DFORMAT C return FALSE; } +static BOOL CheckWrapAndMipCapability(UINT Adapter, WINED3DFORMAT CheckFormat) { + /* OpenGL supports mipmapping on all formats basically. Wrapping is unsupported, + * but we have to report mipmapping so we cannot reject this flag. Tests show that + * windows reports WRAPANDMIP on unfilterable surfaces as well, apparently to show + * that wrapping is supported. The lack of filtering will sort out the mipmapping + * capability anyway. + * + * For now lets report this on all formats, but in the future we may want to + * restrict it to some should games need that + */ + return TRUE; +} + /* Check if a texture format is supported on the given adapter */ static BOOL CheckTextureCapability(UINT Adapter, WINED3DFORMAT CheckFormat) { @@ -2312,6 +2325,7 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt * - D3DUSAGE_NONSECURE (d3d9ex) * - D3DUSAGE_RENDERTARGET * - D3DUSAGE_SOFTWAREPROCESSING + * - D3DUSAGE_QUERY_WRAPANDMIP */ if(GL_SUPPORT(ARB_TEXTURE_CUBE_MAP)) { /* Check if the texture format is around */ @@ -2392,6 +2406,16 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt return WINED3DERR_NOTAVAILABLE; } } + + /* Check QUERY_WRAPANDMIP support */ + if(Usage & WINED3DUSAGE_QUERY_WRAPANDMIP) { + if(CheckWrapAndMipCapability(Adapter, CheckFormat)) { + UsageCaps |= WINED3DUSAGE_QUERY_WRAPANDMIP; + } else { + TRACE_(d3d_caps)("[FAILED] - No wrapping and mipmapping support\n"); + return WINED3DERR_NOTAVAILABLE; + } + } } else { TRACE_(d3d_caps)("[FAILED] - Cube texture format not supported\n"); return WINED3DERR_NOTAVAILABLE; @@ -2444,6 +2468,7 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt * - D3DUSAGE_RENDERTARGET * - D3DUSAGE_SOFTWAREPROCESSING * - D3DUSAGE_TEXTAPI (d3d9ex) + * - D3DUSAGE_QUERY_WRAPANDMIP */ /* Check if the texture format is around */ @@ -2534,6 +2559,16 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt return WINED3DERR_NOTAVAILABLE; } } + + /* Check QUERY_WRAPANDMIP support */ + if(Usage & WINED3DUSAGE_QUERY_WRAPANDMIP) { + if(CheckWrapAndMipCapability(Adapter, CheckFormat)) { + UsageCaps |= WINED3DUSAGE_QUERY_WRAPANDMIP; + } else { + TRACE_(d3d_caps)("[FAILED] - No wrapping and mipmapping support\n"); + return WINED3DERR_NOTAVAILABLE; + } + } } else if(CheckDepthStencilCapability(Adapter, AdapterFormat, CheckFormat)) { if(Usage & WINED3DUSAGE_DEPTHSTENCIL) UsageCaps |= WINED3DUSAGE_DEPTHSTENCIL; @@ -2549,6 +2584,7 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt * - D3DUSAGE_DYNAMIC * - D3DUSAGE_NONSECURE (d3d9ex) * - D3DUSAGE_SOFTWAREPROCESSING + * - D3DUSAGE_QUERY_WRAPANDMIP */ /* Check volume texture and volume usage caps */ @@ -2615,6 +2651,16 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt return WINED3DERR_NOTAVAILABLE; } } + + /* Check QUERY_WRAPANDMIP support */ + if(Usage & WINED3DUSAGE_QUERY_WRAPANDMIP) { + if(CheckWrapAndMipCapability(Adapter, CheckFormat)) { + UsageCaps |= WINED3DUSAGE_QUERY_WRAPANDMIP; + } else { + TRACE_(d3d_caps)("[FAILED] - No wrapping and mipmapping support\n"); + return WINED3DERR_NOTAVAILABLE; + } + } } else { TRACE_(d3d_caps)("[FAILED] - No volume texture support\n"); return WINED3DERR_NOTAVAILABLE;