From aa46edd60cd6c66bc093cab7c3064856d7271bac Mon Sep 17 00:00:00 2001 From: Roderick Colenbrander Date: Mon, 17 Mar 2008 19:27:24 +0100 Subject: [PATCH] wined3d: Add a function which checks the filtering capabilities for a format. --- dlls/wined3d/directx.c | 57 +++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 45 insertions(+), 12 deletions(-) diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 9a281ea39d6..7b9017777bf 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -1873,6 +1873,21 @@ WINED3DFORMAT DepthStencilFormat) return FALSE; } +static BOOL CheckFilterCapability(WINED3DFORMAT CheckFormat) +{ + switch (CheckFormat) { + /* Filtering not supported */ + case WINED3DFMT_R32F: + case WINED3DFMT_A32B32G32R32F: + TRACE_(d3d_caps)("[FAILED]\n"); + return FALSE; + default: + break; + } + + return TRUE; +} + /* Check the render target capabilities of a format */ static BOOL CheckRenderTargetCapability(WINED3DFORMAT AdapterFormat, WINED3DFORMAT CheckFormat) { @@ -2208,18 +2223,6 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt return WINED3DERR_INVALIDCALL; } - if (Usage & WINED3DUSAGE_QUERY_FILTER) { - switch (CheckFormat) { - /* Filtering not supported */ - case WINED3DFMT_R32F: - case WINED3DFMT_A32B32G32R32F: - TRACE_(d3d_caps)("[FAILED]\n"); - return WINED3DERR_NOTAVAILABLE; - default: - break; - } - } - if (Usage & WINED3DUSAGE_AUTOGENMIPMAP) { if(!GL_SUPPORT(SGIS_GENERATE_MIPMAP)) { TRACE_(d3d_caps)("[FAILED] - No mipmap generation support\n"); @@ -2252,6 +2255,16 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt } } + /* Check QUERY_FILTER support */ + if(Usage & WINED3DUSAGE_QUERY_FILTER) { + if(CheckFilterCapability(CheckFormat)) { + UsageCaps |= WINED3DUSAGE_QUERY_FILTER; + } else { + TRACE_(d3d_caps)("[FAILED] - No query filter support\n"); + return WINED3DERR_NOTAVAILABLE; + } + } + /* Check QUERY_SRGBREAD support */ if(Usage & WINED3DUSAGE_QUERY_SRGBREAD) { if(CheckSrgbReadCapability(Adapter, CheckFormat)) { @@ -2324,6 +2337,16 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt } } + /* Check QUERY_FILTER support */ + if(Usage & WINED3DUSAGE_QUERY_FILTER) { + if(CheckFilterCapability(CheckFormat)) { + UsageCaps |= WINED3DUSAGE_QUERY_FILTER; + } else { + TRACE_(d3d_caps)("[FAILED] - No query filter support\n"); + return WINED3DERR_NOTAVAILABLE; + } + } + /* Check QUERY_LEGACYBUMPMAP support */ if(Usage & WINED3DUSAGE_QUERY_LEGACYBUMPMAP) { if(CheckBumpMapCapability(Adapter, CheckFormat)) { @@ -2365,6 +2388,16 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt return WINED3DERR_NOTAVAILABLE; } + /* Check QUERY_FILTER support */ + if(Usage & WINED3DUSAGE_QUERY_FILTER) { + if(CheckFilterCapability(CheckFormat)) { + UsageCaps |= WINED3DUSAGE_QUERY_FILTER; + } else { + TRACE_(d3d_caps)("[FAILED] - No query filter support\n"); + return WINED3DERR_NOTAVAILABLE; + } + } + /* Check QUERY_SRGBREAD support */ if(Usage & WINED3DUSAGE_QUERY_SRGBREAD) { if(CheckSrgbReadCapability(Adapter, CheckFormat)) { -- 2.11.4.GIT