https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3c1a652221579b483cb238...
commit 3c1a652221579b483cb238cb41ec9507839f3660 Author: winesync ros-dev@reactos.org AuthorDate: Mon Sep 21 23:03:21 2020 +0200 Commit: Jérôme Gardou jerome.gardou@reactos.org CommitDate: Thu Feb 4 16:37:04 2021 +0100
[WINESYNC] d3dx9: Implement d3dx_effect_DeleteParameterBlock().
Signed-off-by: Paul Gofman gofmanp@gmail.com Signed-off-by: Matteo Bruni mbruni@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
wine commit id f65e4854e37355a946b6e017a2cd595a1ddceb38 by Paul Gofman gofmanp@gmail.com --- dll/directx/wine/d3dx9_36/effect.c | 32 +++++++++++++++++++++++++--- modules/rostests/winetests/d3dx9_36/effect.c | 12 +++++------ sdk/tools/winesync/d3dx9.cfg | 2 +- 3 files changed, 36 insertions(+), 10 deletions(-)
diff --git a/dll/directx/wine/d3dx9_36/effect.c b/dll/directx/wine/d3dx9_36/effect.c index 99c58f94ac6..f1ffd1a7c37 100644 --- a/dll/directx/wine/d3dx9_36/effect.c +++ b/dll/directx/wine/d3dx9_36/effect.c @@ -513,6 +513,16 @@ static struct d3dx_parameter *get_valid_parameter(struct d3dx_effect *effect, D3 return effect->flags & D3DXFX_LARGEADDRESSAWARE ? NULL : get_parameter_by_name(effect, NULL, parameter); }
+#if D3DX_SDK_VERSION >= 26 +static struct d3dx_parameter_block *get_valid_parameter_block(D3DXHANDLE handle) +{ + struct d3dx_parameter_block *block = (struct d3dx_parameter_block *)handle; + + return block && !strncmp(block->magic_string, parameter_block_magic_string, + sizeof(parameter_block_magic_string)) ? block : NULL; +} +#endif + static void free_state(struct d3dx_state *state) { free_parameter(&state->parameter, FALSE, FALSE); @@ -4123,11 +4133,27 @@ static HRESULT WINAPI d3dx_effect_ApplyParameterBlock(ID3DXEffect *iface, D3DXHA #if D3DX_SDK_VERSION >= 26 static HRESULT WINAPI d3dx_effect_DeleteParameterBlock(ID3DXEffect *iface, D3DXHANDLE parameter_block) { - struct d3dx_effect *This = impl_from_ID3DXEffect(iface); + struct d3dx_parameter_block *block = get_valid_parameter_block(parameter_block); + struct d3dx_effect *effect = impl_from_ID3DXEffect(iface); + struct d3dx_parameter_block *b;
- FIXME("(%p)->(%p): stub\n", This, parameter_block); + TRACE("iface %p, parameter_block %p.\n", iface, parameter_block);
- return E_NOTIMPL; + if (!block) + return D3DERR_INVALIDCALL; + + LIST_FOR_EACH_ENTRY(b, &effect->parameter_block_list, struct d3dx_parameter_block, entry) + { + if (b == block) + { + list_remove(&b->entry); + free_parameter_block(b); + return D3D_OK; + } + } + + WARN("Block is not found in issued block list, not freeing memory.\n"); + return D3DERR_INVALIDCALL; } #endif
diff --git a/modules/rostests/winetests/d3dx9_36/effect.c b/modules/rostests/winetests/d3dx9_36/effect.c index a4351976de6..db04fe6e864 100644 --- a/modules/rostests/winetests/d3dx9_36/effect.c +++ b/modules/rostests/winetests/d3dx9_36/effect.c @@ -8096,7 +8096,7 @@ static void test_effect_parameter_block(void) hr = effect->lpVtbl->ApplyParameterBlock(effect, block); todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); hr = effect->lpVtbl->DeleteParameterBlock(effect, block); - todo_wine ok(hr == D3D_OK, "Got result %#x.\n", hr); + ok(hr == D3D_OK, "Got result %#x.\n", hr);
hr = effect->lpVtbl->BeginParameterBlock(effect); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); @@ -8110,9 +8110,9 @@ static void test_effect_parameter_block(void) todo_wine ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = effect->lpVtbl->DeleteParameterBlock(effect2, block); - todo_wine ok(hr == D3DERR_INVALIDCALL, "Got result %#x.\n", hr); + ok(hr == D3DERR_INVALIDCALL, "Got result %#x.\n", hr); hr = effect->lpVtbl->DeleteParameterBlock(effect, block); - todo_wine ok(hr == D3D_OK, "Got result %#x.\n", hr); + ok(hr == D3D_OK, "Got result %#x.\n", hr);
hr = effect->lpVtbl->ApplyParameterBlock(effect, NULL); todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); @@ -8182,7 +8182,7 @@ static void test_effect_parameter_block(void) ok(refcount == 2, "Got unexpected refcount %u.\n", refcount);
hr = effect->lpVtbl->DeleteParameterBlock(effect2, block); - todo_wine ok(hr == D3DERR_INVALIDCALL, "Got result %#x.\n", hr); + ok(hr == D3DERR_INVALIDCALL, "Got result %#x.\n", hr);
IDirect3DTexture9_AddRef(texture); refcount = IDirect3DTexture9_Release(texture); @@ -8318,9 +8318,9 @@ static void test_effect_parameter_block(void) float_array[0], float_array[1], float_array[2], float_array[3]);
hr = effect->lpVtbl->DeleteParameterBlock(effect, block); - todo_wine ok(hr == D3D_OK, "Got result %#x.\n", hr); + ok(hr == D3D_OK, "Got result %#x.\n", hr); hr = effect->lpVtbl->DeleteParameterBlock(effect, block2); - todo_wine ok(hr == D3D_OK, "Got result %#x.\n", hr); + ok(hr == D3D_OK, "Got result %#x.\n", hr);
hr = effect->lpVtbl->SetTexture(effect, "tex1", NULL); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); diff --git a/sdk/tools/winesync/d3dx9.cfg b/sdk/tools/winesync/d3dx9.cfg index 75cc7e3ceb1..023289fc2c9 100644 --- a/sdk/tools/winesync/d3dx9.cfg +++ b/sdk/tools/winesync/d3dx9.cfg @@ -15,4 +15,4 @@ files: {include/d3dx9.h: sdk/include/dxsdk/d3dx9.h, include/d3dx9anim.h: sdk/inc include/d3dx9mesh.h: sdk/include/dxsdk/d3dx9mesh.h, include/d3dx9of.h: sdk/include/dxsdk/d3dx9of.h, include/d3dx9shader.h: sdk/include/dxsdk/d3dx9shader.h, include/d3dx9shape.h: sdk/include/dxsdk/d3dx9shape.h, include/d3dx9tex.h: sdk/include/dxsdk/d3dx9tex.h, include/d3dx9xof.h: sdk/include/dxsdk/d3dx9xof.h} -tags: {wine: fd47b684487bab4664a31a3b670783b6d1a5aca3} +tags: {wine: f65e4854e37355a946b6e017a2cd595a1ddceb38}