ddraw: Update state if d3d_device2_SwapTextureHandles() results in texture change.

This commit is contained in:
Paul Gofman 2024-10-11 18:44:12 -06:00 committed by Alexandre Julliard
parent f57ef9b4db
commit abadd0731d
Notes: Alexandre Julliard 2024-11-14 23:13:45 +01:00
Approved-by: Jan Sikorski (@jsikorski)
Approved-by: Elizabeth Figura (@zfigura)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/wine/merge_requests/6658
2 changed files with 9 additions and 2 deletions

View file

@ -564,13 +564,17 @@ static HRESULT WINAPI d3d_device2_SwapTextureHandles(IDirect3DDevice2 *iface,
{
struct ddraw_surface *surf1 = unsafe_impl_from_IDirect3DTexture2(tex1);
struct ddraw_surface *surf2 = unsafe_impl_from_IDirect3DTexture2(tex2);
DWORD h1, h2;
DWORD h1, h2, h;
HRESULT hr;
TRACE("iface %p, tex1 %p, tex2 %p.\n", iface, tex1, tex2);
if (!surf1->Handle || !surf2->Handle)
return E_INVALIDARG;
if (FAILED(hr = IDirect3DDevice2_GetRenderState(iface, D3DRENDERSTATE_TEXTUREHANDLE, &h)))
return hr;
wined3d_mutex_lock();
h1 = surf1->Handle - 1;
@ -582,6 +586,9 @@ static HRESULT WINAPI d3d_device2_SwapTextureHandles(IDirect3DDevice2 *iface,
wined3d_mutex_unlock();
if ((h == surf1->Handle || h == surf2->Handle)
&& FAILED(hr = IDirect3DDevice2_SetRenderState(iface, D3DRENDERSTATE_TEXTUREHANDLE, h)))
return hr;
return D3D_OK;
}

View file

@ -16645,7 +16645,7 @@ static void test_multiple_devices(void)
ok(hr == S_OK, "got %#lx.\n", hr);
hr = IDirect3DDevice2_GetRenderState(device, D3DRENDERSTATE_TEXTUREHANDLE, &texture_handle2);
ok(hr == D3D_OK, "got %#lx.\n", hr);
todo_wine ok(texture_handle2 == texture_handle, "got different handles.\n");
ok(texture_handle2 == texture_handle, "got different handles.\n");
IDirect3DTexture2_Release(texture2);
IDirect3DTexture2_Release(texture);