https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7bc8c981ac2a8a5ffebca4272745efdb29fe21ae

commit 7bc8c981ac2a8a5ffebca4272745efdb29fe21ae
Author:     winesync <[email protected]>
AuthorDate: Mon Sep 21 23:01:50 2020 +0200
Commit:     Jérôme Gardou <[email protected]>
CommitDate: Thu Feb 4 16:37:04 2021 +0100

    [WINESYNC] d3dx9: Implement d3dx_effect_EndParameterBlock().
    
    Signed-off-by: Paul Gofman <[email protected]>
    Signed-off-by: Matteo Bruni <[email protected]>
    Signed-off-by: Alexandre Julliard <[email protected]>
    
    wine commit id fd47b684487bab4664a31a3b670783b6d1a5aca3 by Paul Gofman 
<[email protected]>
---
 dll/directx/wine/d3dx9_36/effect.c           | 26 +++++++++++++++++++++++---
 modules/rostests/winetests/d3dx9_36/effect.c | 14 +++++++-------
 sdk/tools/winesync/d3dx9.cfg                 |  2 +-
 3 files changed, 31 insertions(+), 11 deletions(-)

diff --git a/dll/directx/wine/d3dx9_36/effect.c 
b/dll/directx/wine/d3dx9_36/effect.c
index 158a7437766..99c58f94ac6 100644
--- a/dll/directx/wine/d3dx9_36/effect.c
+++ b/dll/directx/wine/d3dx9_36/effect.c
@@ -27,6 +27,7 @@
 #include "d3dx9_private.h"
 #include "d3dcompiler.h"
 #include "winternl.h"
+#include "wine/list.h"
 #endif /* __REACTOS__ */
 
 /* Constants for special INT/FLOAT conversation */
@@ -155,6 +156,7 @@ struct d3dx_technique
 struct d3dx_parameter_block
 {
     char magic_string[ARRAY_SIZE(parameter_block_magic_string)];
+    struct list entry;
 };
 
 struct d3dx_effect
@@ -188,6 +190,7 @@ struct d3dx_effect
     D3DMATERIAL9 current_material;
     BOOL material_updated;
 
+    struct list parameter_block_list;
     struct d3dx_parameter_block *current_parameter_block;
 };
 
@@ -690,12 +693,18 @@ static void free_parameter_block(struct 
d3dx_parameter_block *block)
 
 static void d3dx_effect_cleanup(struct d3dx_effect *effect)
 {
+    struct d3dx_parameter_block *block, *cursor;
     ID3DXEffectPool *pool;
     unsigned int i;
 
     TRACE("effect %p.\n", effect);
 
     free_parameter_block(effect->current_parameter_block);
+    LIST_FOR_EACH_ENTRY_SAFE(block, cursor, &effect->parameter_block_list, 
struct d3dx_parameter_block, entry)
+    {
+        list_remove(&block->entry);
+        free_parameter_block(block);
+    }
 
     heap_free(effect->full_name_tmp);
 
@@ -4086,11 +4095,20 @@ static HRESULT WINAPI 
d3dx_effect_BeginParameterBlock(ID3DXEffect *iface)
 
 static D3DXHANDLE WINAPI d3dx_effect_EndParameterBlock(ID3DXEffect *iface)
 {
-    struct d3dx_effect *This = impl_from_ID3DXEffect(iface);
+    struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
+    struct d3dx_parameter_block *ret;
 
-    FIXME("(%p)->(): stub\n", This);
+    TRACE("iface %p.\n", iface);
 
-    return NULL;
+    if (!effect->current_parameter_block)
+    {
+        WARN("No active parameter block.\n");
+        return NULL;
+    }
+    ret = effect->current_parameter_block;
+    effect->current_parameter_block = NULL;
+    list_add_tail(&effect->parameter_block_list, &ret->entry);
+    return (D3DXHANDLE)ret;
 }
 
 static HRESULT WINAPI d3dx_effect_ApplyParameterBlock(ID3DXEffect *iface, 
D3DXHANDLE parameter_block)
@@ -6236,6 +6254,8 @@ static HRESULT d3dx9_effect_init(struct d3dx_effect 
*effect, struct IDirect3DDev
 
     effect->flags = eflags;
 
+    list_init(&effect->parameter_block_list);
+
     read_dword(&ptr, &tag);
     TRACE("Tag: %x\n", tag);
 
diff --git a/modules/rostests/winetests/d3dx9_36/effect.c 
b/modules/rostests/winetests/d3dx9_36/effect.c
index 522039f1ae7..a4351976de6 100644
--- a/modules/rostests/winetests/d3dx9_36/effect.c
+++ b/modules/rostests/winetests/d3dx9_36/effect.c
@@ -8084,7 +8084,7 @@ static void test_effect_parameter_block(void)
     hr = effect->lpVtbl->BeginParameterBlock(effect);
     ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
     block = effect->lpVtbl->EndParameterBlock(effect);
-    todo_wine ok(!!block, "Got unexpected block %p.\n", block);
+    ok(!!block, "Got unexpected block %p.\n", block);
     handle = effect->lpVtbl->EndParameterBlock(effect);
     ok(!handle, "Got unexpected handle %p.\n", handle);
 
@@ -8099,13 +8099,13 @@ static void test_effect_parameter_block(void)
     todo_wine ok(hr == D3D_OK, "Got result %#x.\n", hr);
 
     hr = effect->lpVtbl->BeginParameterBlock(effect);
-    todo_wine ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
+    ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
     hr = effect->lpVtbl->SetFloat(effect, "vec3[0]", 1001.0f);
     ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
     hr = effect->lpVtbl->SetFloat(effect, "arr1[0]", 91.0f);
     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
     block = effect->lpVtbl->EndParameterBlock(effect);
-    todo_wine ok(!!block, "Got unexpected block %p.\n", block);
+    ok(!!block, "Got unexpected block %p.\n", block);
     hr = effect->lpVtbl->ApplyParameterBlock(effect, block);
     todo_wine ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
 
@@ -8123,7 +8123,7 @@ static void test_effect_parameter_block(void)
     ok(hr == D3D_OK, "Got result %#x, expected 0 (D3D_OK).\n", hr);
 
     hr = effect->lpVtbl->BeginParameterBlock(effect);
-    todo_wine ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
+    ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
 
     /* Effect parameters are not updated during recording. */
     hr = effect->lpVtbl->SetTexture(effect, "tex1", (IDirect3DBaseTexture9 
*)texture);
@@ -8175,7 +8175,7 @@ static void test_effect_parameter_block(void)
     ok(refcount == 2, "Got unexpected refcount %u.\n", refcount);
 
     block = effect->lpVtbl->EndParameterBlock(effect);
-    todo_wine ok(!!block, "Got unexpected block %p.\n", block);
+    ok(!!block, "Got unexpected block %p.\n", block);
 
     IDirect3DTexture9_AddRef(texture);
     refcount = IDirect3DTexture9_Release(texture);
@@ -8255,7 +8255,7 @@ static void test_effect_parameter_block(void)
     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
 
     hr = effect->lpVtbl->BeginParameterBlock(effect);
-    todo_wine ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
+    ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
     hr = effect->lpVtbl->ApplyParameterBlock(effect, block);
     todo_wine ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
 
@@ -8286,7 +8286,7 @@ static void test_effect_parameter_block(void)
             float_array[0], float_array[1], float_array[2], float_array[3]);
 
     block2 = effect->lpVtbl->EndParameterBlock(effect);
-    todo_wine ok(!!block2, "Got unexpected block %p.\n", block2);
+    ok(!!block2, "Got unexpected block %p.\n", block2);
 
     hr = effect->lpVtbl->ApplyParameterBlock(effect, block2);
     todo_wine 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 33a4c44b73d..75cc7e3ceb1 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: e281ba4db6654850caf713ab09aa6a2057e1d064}
+tags: {wine: fd47b684487bab4664a31a3b670783b6d1a5aca3}

Reply via email to