diff --git a/dlls/d3d9/surface.c b/dlls/d3d9/surface.c index 7dc6e70..00e4b97 100644 --- a/dlls/d3d9/surface.c +++ b/dlls/d3d9/surface.c @@ -274,11 +274,12 @@ static HRESULT WINAPI d3d9_surface_UnlockRect(IDirect3DSurface9 *iface) hr = wined3d_surface_unmap(surface->wined3d_surface); wined3d_mutex_unlock(); - switch(hr) + if (hr == WINEDDERR_NOTLOCKED) { - case WINEDDERR_NOTLOCKED: return D3DERR_INVALIDCALL; - default: return hr; + TRACE("surface was not locked!\n"); + hr = S_OK; } + return hr; } static HRESULT WINAPI d3d9_surface_GetDC(IDirect3DSurface9 *iface, HDC *dc) diff --git a/dlls/d3d9/tests/d3d9ex.c b/dlls/d3d9/tests/d3d9ex.c index 151db41..c5e9b11 100644 --- a/dlls/d3d9/tests/d3d9ex.c +++ b/dlls/d3d9/tests/d3d9ex.c @@ -708,6 +708,8 @@ static void test_user_memory(void) ok(locked_rect.pBits == mem, "Got unexpected pBits %p, expected %p.\n", locked_rect.pBits, mem); hr = IDirect3DTexture9_UnlockRect(texture, 0); ok(SUCCEEDED(hr), "Failed to unlock texture, hr %#x.\n", hr); + hr = IDirect3DTexture9_UnlockRect(texture, 0); + ok(SUCCEEDED(hr), "Failed to double unlock texture, hr %#x.\n", hr); IDirect3DTexture9_Release(texture); if (caps.TextureCaps & D3DPTEXTURECAPS_CUBEMAP) @@ -739,6 +741,8 @@ static void test_user_memory(void) ok(locked_rect.pBits == mem, "Got unexpected pBits %p, expected %p.\n", locked_rect.pBits, mem); hr = IDirect3DSurface9_UnlockRect(surface); ok(SUCCEEDED(hr), "Failed to unlock surface, hr %#x.\n", hr); + hr = IDirect3DSurface9_UnlockRect(surface); + ok(SUCCEEDED(hr), "Failed to double unlock surface, hr %#x.\n", hr); IDirect3DSurface9_Release(surface); hr = IDirect3DDevice9Ex_CreateOffscreenPlainSurfaceEx(device, 128, 128, D3DFMT_A8R8G8B8, @@ -752,6 +756,8 @@ static void test_user_memory(void) ok(locked_rect.pBits == mem, "Got unexpected pBits %p, expected %p.\n", locked_rect.pBits, mem); hr = IDirect3DSurface9_UnlockRect(surface); ok(SUCCEEDED(hr), "Failed to unlock surface, hr %#x.\n", hr); + hr = IDirect3DSurface9_UnlockRect(surface); + ok(SUCCEEDED(hr), "Failed to double unlock surface, hr %#x.\n", hr); IDirect3DSurface9_Release(surface); } @@ -776,6 +782,8 @@ static void test_user_memory(void) ok(locked_rect.pBits == mem, "Got unexpected pBits %p, expected %p.\n", locked_rect.pBits, mem); hr = IDirect3DTexture9_UnlockRect(texture, 0); ok(SUCCEEDED(hr), "Failed to unlock texture, hr %#x.\n", hr); + hr = IDirect3DTexture9_UnlockRect(texture, 0); + ok(SUCCEEDED(hr), "Failed to double unlock texture, hr %#x.\n", hr); hr = IDirect3DDevice9Ex_CreateTexture(device, 33, 33, 1, 0, D3DFMT_L8, D3DPOOL_DEFAULT, &texture2, NULL);