[WINESYNC] d3dx9_36: Improve stub for ID3DXEffectImpl_CloneEffect.

wine-staging patch by Sebastian Lackner <sebastian@fds-team.de>
This commit is contained in:
winesync 2021-01-05 13:16:41 +01:00 committed by Jérôme Gardou
parent 7c02c861b1
commit 62f40620f1
3 changed files with 62 additions and 12 deletions

View file

@ -4313,7 +4313,9 @@ static HRESULT WINAPI d3dx_effect_CloneEffect(ID3DXEffect *iface, IDirect3DDevic
if (!device)
return D3DERR_INVALIDCALL;
return E_NOTIMPL;
iface->lpVtbl->AddRef(iface);
*new_effect = iface;
return S_OK;
}
#if D3DX_SDK_VERSION >= 27

View file

@ -7434,29 +7434,23 @@ static void test_effect_clone(void)
ok(hr == D3DERR_INVALIDCALL, "Got result %#x.\n", hr);
hr = effect->lpVtbl->CloneEffect(effect, device, &cloned);
todo_wine
ok(hr == D3D_OK, "Got result %#x.\n", hr);
if (hr == D3D_OK)
{
ok(cloned != effect, "Expected new effect instance.\n");
todo_wine ok(cloned != effect, "Expected new effect instance.\n");
cloned->lpVtbl->Release(cloned);
}
/* Try with different device. */
device2 = create_device(&window2);
hr = effect->lpVtbl->CloneEffect(effect, device2, &cloned);
todo_wine
ok(hr == D3D_OK, "Got result %#x.\n", hr);
if (hr == D3D_OK)
{
ok(cloned != effect, "Expected new effect instance.\n");
todo_wine ok(cloned != effect, "Expected new effect instance.\n");
hr = cloned->lpVtbl->GetDevice(cloned, &device3);
ok(hr == S_OK, "Failed to get effect device.\n");
ok(device3 == device2, "Unexpected device instance.\n");
todo_wine ok(device3 == device2, "Unexpected device instance, device3 %p, device2 %p.\n", device3, device2);
IDirect3DDevice9_Release(device3);
cloned->lpVtbl->Release(cloned);
}
IDirect3DDevice9_Release(device2);
DestroyWindow(window2);
effect->lpVtbl->Release(effect);

View file

@ -0,0 +1,54 @@
diff --git a/dll/directx/wine/d3dx9_36/effect.c b/dll/directx/wine/d3dx9_36/effect.c
index 710e999..d57b182 100644
--- a/dll/directx/wine/d3dx9_36/effect.c
+++ b/dll/directx/wine/d3dx9_36/effect.c
@@ -4309,7 +4309,9 @@ static HRESULT WINAPI d3dx_effect_CloneEffect(ID3DXEffect *iface, IDirect3DDevic
if (!device)
return D3DERR_INVALIDCALL;
- return E_NOTIMPL;
+ iface->lpVtbl->AddRef(iface);
+ *new_effect = iface;
+ return S_OK;
}
#if D3DX_SDK_VERSION >= 27
diff --git a/modules/rostests/winetests/d3dx9_36/effect.c b/modules/rostests/winetests/d3dx9_36/effect.c
index ae6f65d..1b5c944 100644
--- a/modules/rostests/winetests/d3dx9_36/effect.c
+++ b/modules/rostests/winetests/d3dx9_36/effect.c
@@ -7419,29 +7419,23 @@ static void test_effect_clone(void)
ok(hr == D3DERR_INVALIDCALL, "Got result %#x.\n", hr);
hr = effect->lpVtbl->CloneEffect(effect, device, &cloned);
-todo_wine
ok(hr == D3D_OK, "Got result %#x.\n", hr);
-if (hr == D3D_OK)
-{
- ok(cloned != effect, "Expected new effect instance.\n");
+
+ todo_wine ok(cloned != effect, "Expected new effect instance.\n");
cloned->lpVtbl->Release(cloned);
-}
/* Try with different device. */
device2 = create_device(&window2);
hr = effect->lpVtbl->CloneEffect(effect, device2, &cloned);
-todo_wine
ok(hr == D3D_OK, "Got result %#x.\n", hr);
-if (hr == D3D_OK)
-{
- ok(cloned != effect, "Expected new effect instance.\n");
+ todo_wine ok(cloned != effect, "Expected new effect instance.\n");
hr = cloned->lpVtbl->GetDevice(cloned, &device3);
ok(hr == S_OK, "Failed to get effect device.\n");
- ok(device3 == device2, "Unexpected device instance.\n");
+ todo_wine ok(device3 == device2, "Unexpected device instance, device3 %p, device2 %p.\n", device3, device2);
IDirect3DDevice9_Release(device3);
cloned->lpVtbl->Release(cloned);
-}
+
IDirect3DDevice9_Release(device2);
DestroyWindow(window2);
effect->lpVtbl->Release(effect);