[PATCH 6/9] d3dx9: Implement d3dx_effect_EndParameterBlock().

Matteo Bruni mbruni at codeweavers.com
Mon Nov 18 09:59:45 CST 2019


From: Paul Gofman <gofmanp at gmail.com>

Signed-off-by: Paul Gofman <gofmanp at gmail.com>
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
---
 dlls/d3dx9_36/effect.c       | 26 +++++++++++++++++++++++---
 dlls/d3dx9_36/tests/effect.c | 14 +++++++-------
 2 files changed, 30 insertions(+), 10 deletions(-)

diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c
index 4be7c7b6bc2..8317d7112c4 100644
--- a/dlls/d3dx9_36/effect.c
+++ b/dlls/d3dx9_36/effect.c
@@ -24,6 +24,7 @@
 #include "d3dx9_private.h"
 #include "d3dcompiler.h"
 #include "winternl.h"
+#include "wine/list.h"
 
 /* Constants for special INT/FLOAT conversation */
 #define INT_FLOAT_MULTI 255.0f
@@ -151,6 +152,7 @@ struct d3dx_technique
 struct d3dx_parameter_block
 {
     char magic_string[ARRAY_SIZE(parameter_block_magic_string)];
+    struct list entry;
 };
 
 struct d3dx_effect
@@ -184,6 +186,7 @@ struct d3dx_effect
     D3DMATERIAL9 current_material;
     BOOL material_updated;
 
+    struct list parameter_block_list;
     struct d3dx_parameter_block *current_parameter_block;
 };
 
@@ -686,12 +689,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);
 
@@ -4082,11 +4091,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)
@@ -6232,6 +6250,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/dlls/d3dx9_36/tests/effect.c b/dlls/d3dx9_36/tests/effect.c
index bb9604194dc..7b6c1f00d65 100644
--- a/dlls/d3dx9_36/tests/effect.c
+++ b/dlls/d3dx9_36/tests/effect.c
@@ -8069,7 +8069,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);
 
@@ -8084,13 +8084,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);
 
@@ -8108,7 +8108,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);
@@ -8160,7 +8160,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);
@@ -8240,7 +8240,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);
 
@@ -8271,7 +8271,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);
-- 
2.21.0




More information about the wine-devel mailing list