wined3d: Pass the D3DCB_CreateAdditionalSwapChain() error code to the upper layers (needed for d3d9).

Francois Gouget fgouget at codeweavers.com
Tue Jun 12 10:49:58 CDT 2007


---

Tests on Windows XP show that when it fails to cheange the resolution 
IDirect3D9_CreateDevice() fails with D3DERR_NOTAVAILABLE as the error 
code, exactly the error that D3DCB_CreateAdditionalSwapChain() returns. 
This suggests that this error code should be forwarded to the upper 
layers.

IDirect3D8_CreateDevice() is different though: It just returns 
D3DERR_INVALIDCALL which presumably means that some upper layer replaces 
the error code with a generic value. I'm not sure it matters though.


 dlls/wined3d/device.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 62a5e18..15d3d07 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1807,6 +1807,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreatePalette(IWineD3DDevice *iface, DW
 static HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface, WINED3DPRESENT_PARAMETERS* pPresentationParameters, D3DCB_CREATEADDITIONALSWAPCHAIN D3DCB_CreateAdditionalSwapChain) {
     IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
     IWineD3DSwapChainImpl *swapchain;
+    HRESULT hr;
     DWORD state;
 
     TRACE("(%p)->(%p,%p)\n", This, pPresentationParameters, D3DCB_CreateAdditionalSwapChain);
@@ -1822,9 +1823,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface, WINED3DPR
 
     /* Setup the implicit swapchain */
     TRACE("Creating implicit swapchain\n");
-    if (FAILED(D3DCB_CreateAdditionalSwapChain((IUnknown *) This->parent, pPresentationParameters, (IWineD3DSwapChain **)&swapchain)) || !swapchain) {
+    hr=D3DCB_CreateAdditionalSwapChain((IUnknown *) This->parent, pPresentationParameters, (IWineD3DSwapChain **)&swapchain);
+    if (FAILED(hr) || !swapchain) {
         WARN("Failed to create implicit swapchain\n");
-        return WINED3DERR_INVALIDCALL;
+        return hr;
     }
 
     This->NumberOfSwapChains = 1;
-- 
1.4.4.4




More information about the wine-patches mailing list