Module: wine Branch: master Commit: efbdd515f8724299a7d7f5144984e289e119e767 URL: http://source.winehq.org/git/wine.git/?a=commit;h=efbdd515f8724299a7d7f51449...
Author: Stefan Dösinger stefandoesinger@gmx.at Date: Fri Jun 8 14:16:37 2007 +0200
wined3d: Find possible fbconfis on dll load time, use them in CheckDepthStencilMatch.
---
dlls/wined3d/directx.c | 48 ++++++++++++++++----------------------- dlls/wined3d/wined3d_private.h | 2 + 2 files changed, 22 insertions(+), 28 deletions(-)
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 8d15f7e..07e0dbe 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -1469,9 +1469,6 @@ static HRESULT WINAPI IWineD3DImpl_CheckDepthStencilMatch(IWineD3D *iface, UINT WINED3DFORMAT RenderTargetFormat, WINED3DFORMAT DepthStencilFormat) { IWineD3DImpl *This = (IWineD3DImpl *)iface; - HRESULT hr = WINED3DERR_NOTAVAILABLE; - GLXFBConfig* cfgs = NULL; - int nCfgs = 0; int it;
WARN_(d3d_caps)("(%p)-> (STUB) (Adptr:%d, DevType:(%x,%s), AdptFmt:(%x,%s), RendrTgtFmt:(%x,%s), DepthStencilFmt:(%x,%s))\n", @@ -1486,34 +1483,17 @@ static HRESULT WINAPI IWineD3DImpl_CheckDepthStencilMatch(IWineD3D *iface, UINT return WINED3DERR_INVALIDCALL; }
- /* TODO: Store an array in the adapter */ - if(WineD3D_CreateFakeGLContext()) - cfgs = glXGetFBConfigs(wined3d_fake_gl_context_display, DefaultScreen(wined3d_fake_gl_context_display), &nCfgs); - - if (cfgs) { - for (it = 0; it < nCfgs; ++it) { - if (IWineD3DImpl_IsGLXFBConfigCompatibleWithRenderFmt(wined3d_fake_gl_context_display, cfgs[it], RenderTargetFormat)) { - if (IWineD3DImpl_IsGLXFBConfigCompatibleWithDepthFmt(wined3d_fake_gl_context_display, cfgs[it], DepthStencilFormat)) { - hr = WINED3D_OK; - break ; - } + for (it = 0; it < Adapters[Adapter].nCfgs; ++it) { + if (IWineD3DImpl_IsGLXFBConfigCompatibleWithRenderFmt(Adapters[Adapter].display, Adapters[Adapter].cfgs[it], RenderTargetFormat)) { + if (IWineD3DImpl_IsGLXFBConfigCompatibleWithDepthFmt(Adapters[Adapter].display, Adapters[Adapter].cfgs[it], DepthStencilFormat)) { + TRACE_(d3d_caps)("(%p) : Formats matched\n", This); + return WINED3D_OK; } } - XFree(cfgs); - if(hr != WINED3D_OK) - ERR("unsupported format pair: %s and %s\n", debug_d3dformat(RenderTargetFormat), debug_d3dformat(DepthStencilFormat)); - } else { - ERR_(d3d_caps)("returning WINED3D_OK even so CreateFakeGLContext or glXGetFBConfigs failed\n"); - hr = WINED3D_OK; } + WARN_(d3d_caps)("unsupported format pair: %s and %s\n", debug_d3dformat(RenderTargetFormat), debug_d3dformat(DepthStencilFormat));
- WineD3D_ReleaseFakeGLContext(); - - if (hr != WINED3D_OK) - TRACE_(d3d_caps)("Failed to match stencil format to device\n"); - - TRACE_(d3d_caps)("(%p) : Returning %x\n", This, hr); - return hr; + return WINED3DERR_NOTAVAILABLE; }
static HRESULT WINAPI IWineD3DImpl_CheckDeviceMultiSampleType(IWineD3D *iface, UINT Adapter, WINED3DDEVTYPE DeviceType, @@ -2615,9 +2595,21 @@ BOOL InitAdapters(void) { Adapters[0].display = get_display(device_context); ReleaseDC(0, device_context);
+ ENTER_GL(); + if(WineD3D_CreateFakeGLContext()) { + Adapters[0].cfgs = glXGetFBConfigs(Adapters[0].display, DefaultScreen(Adapters[0].display), &Adapters[0].nCfgs); + WineD3D_ReleaseFakeGLContext(); + } else { + ERR("Failed to create a fake opengl context to find fbconfigs formats\n"); + LEAVE_GL(); + return FALSE; + } + LEAVE_GL(); + ret = IWineD3DImpl_FillGLCaps(&Adapters[0].gl_info, Adapters[0].display); - if(ret != TRUE) { + if(!ret) { ERR("Failed to initialize gl caps for default adapter\n"); + XFree(Adapters[0].cfgs); HeapFree(GetProcessHeap(), 0, Adapters); return FALSE; } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index be37ec1..6673bc0 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -579,6 +579,8 @@ struct WineD3DAdapter WineD3D_GL_Info gl_info; const char *driver; const char *description; + GLXFBConfig *cfgs; + int nCfgs; };
extern BOOL InitAdapters(void);