From 2f1e01bbe3ee6f76d6860517c68ea170a813adbb Mon Sep 17 00:00:00 2001 From: Roderick Colenbrander Date: Mon, 17 Mar 2008 18:37:15 +0100 Subject: [PATCH] wined3d: Put vertex texture capability checking in its own function. --- dlls/wined3d/directx.c | 74 ++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 53 insertions(+), 21 deletions(-) diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index ab60722e6d9..9a281ea39d6 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -2167,6 +2167,29 @@ MAKEFOURCC('I','N','S','T') once return FALSE; } +static BOOL CheckVertexTextureCapability(UINT Adapter, WINED3DFORMAT CheckFormat) +{ + if (!GL_LIMITS(vertex_samplers)) { + TRACE_(d3d_caps)("[FAILED]\n"); + return FALSE; + } + + switch (CheckFormat) { + case WINED3DFMT_A32B32G32R32F: + if (!GL_SUPPORT(ARB_TEXTURE_FLOAT)) { + TRACE_(d3d_caps)("[FAILED]\n"); + return FALSE; + } + TRACE_(d3d_caps)("[OK]\n"); + return TRUE; + + default: + TRACE_(d3d_caps)("[FAILED]\n"); + return FALSE; + } + return FALSE; +} + static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapter, WINED3DDEVTYPE DeviceType, WINED3DFORMAT AdapterFormat, DWORD Usage, WINED3DRESOURCETYPE RType, WINED3DFORMAT CheckFormat) { IWineD3DImpl *This = (IWineD3DImpl *)iface; @@ -2238,6 +2261,16 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt return WINED3DERR_NOTAVAILABLE; } } + + /* Check QUERY_VERTEXTEXTURE support */ + if(Usage & WINED3DUSAGE_QUERY_VERTEXTEXTURE) { + if(CheckVertexTextureCapability(Adapter, CheckFormat)) { + UsageCaps |= WINED3DUSAGE_QUERY_VERTEXTEXTURE; + } else { + TRACE_(d3d_caps)("[FAILED] - No query vertextexture support\n"); + return WINED3DERR_NOTAVAILABLE; + } + } } } } else if(RType == WINED3DRTYPE_SURFACE) { @@ -2310,6 +2343,16 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt return WINED3DERR_NOTAVAILABLE; } } + + /* Check QUERY_VERTEXTEXTURE support */ + if(Usage & WINED3DUSAGE_QUERY_VERTEXTEXTURE) { + if(CheckVertexTextureCapability(Adapter, CheckFormat)) { + UsageCaps |= WINED3DUSAGE_QUERY_VERTEXTEXTURE; + } else { + TRACE_(d3d_caps)("[FAILED] - No query vertextexture support\n"); + return WINED3DERR_NOTAVAILABLE; + } + } } else if(CheckDepthStencilCapability(Adapter, AdapterFormat, CheckFormat)) { if(Usage & WINED3DUSAGE_DEPTHSTENCIL) UsageCaps |= WINED3DUSAGE_DEPTHSTENCIL; @@ -2331,6 +2374,16 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt return WINED3DERR_NOTAVAILABLE; } } + + /* Check QUERY_VERTEXTEXTURE support */ + if(Usage & WINED3DUSAGE_QUERY_VERTEXTEXTURE) { + if(CheckVertexTextureCapability(Adapter, CheckFormat)) { + UsageCaps |= WINED3DUSAGE_QUERY_VERTEXTEXTURE; + } else { + TRACE_(d3d_caps)("[FAILED] - No query vertextexture support\n"); + return WINED3DERR_NOTAVAILABLE; + } + } } /* Filter formats that need conversion; For one part, this conversion is unimplemented, @@ -2383,27 +2436,6 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt break; } } - /* TODO: Check support against more of the WINED3DUSAGE_QUERY_* constants */ - if (Usage & WINED3DUSAGE_QUERY_VERTEXTEXTURE) { - if (!GL_LIMITS(vertex_samplers)) { - TRACE_(d3d_caps)("[FAILED]\n"); - return WINED3DERR_NOTAVAILABLE; - } - - switch (CheckFormat) { - case WINED3DFMT_A32B32G32R32F: - if (!GL_SUPPORT(ARB_TEXTURE_FLOAT)) { - TRACE_(d3d_caps)("[FAILED]\n"); - return WINED3DERR_NOTAVAILABLE; - } - TRACE_(d3d_caps)("[OK]\n"); - return WINED3D_OK; - - default: - TRACE_(d3d_caps)("[FAILED]\n"); - return WINED3DERR_NOTAVAILABLE; - } - } /* This format is nothing special and it is supported perfectly. * However, ati and nvidia driver on windows do not mark this format as -- 2.11.4.GIT