Paul Gofman : d3dx9: Implement d3dx_effect_BeginParameterBlock().

Alexandre Julliard julliard at winehq.org
Mon Nov 18 16:19:18 CST 2019


Module: wine
Branch: master
Commit: e281ba4db6654850caf713ab09aa6a2057e1d064
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=e281ba4db6654850caf713ab09aa6a2057e1d064

Author: Paul Gofman <gofmanp at gmail.com>
Date:   Mon Nov 18 16:59:44 2019 +0100

d3dx9: Implement d3dx_effect_BeginParameterBlock().

Signed-off-by: Paul Gofman <gofmanp at gmail.com>
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/d3dx9_36/effect.c       | 34 +++++++++++++++++++++++++++++++---
 dlls/d3dx9_36/tests/effect.c |  4 ++--
 2 files changed, 33 insertions(+), 5 deletions(-)

diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c
index eefd14aafa..4be7c7b6bc 100644
--- a/dlls/d3dx9_36/effect.c
+++ b/dlls/d3dx9_36/effect.c
@@ -30,6 +30,7 @@
 #define INT_FLOAT_MULTI_INVERSE (1/INT_FLOAT_MULTI)
 
 static const char parameter_magic_string[4] = {'@', '!', '#', '\xFF'};
+static const char parameter_block_magic_string[4] = {'@', '!', '#', '\xFE'};
 
 #define PARAMETER_FLAG_SHARED 1
 
@@ -147,6 +148,11 @@ struct d3dx_technique
     struct IDirect3DStateBlock9 *saved_state;
 };
 
+struct d3dx_parameter_block
+{
+    char magic_string[ARRAY_SIZE(parameter_block_magic_string)];
+};
+
 struct d3dx_effect
 {
     ID3DXEffect ID3DXEffect_iface;
@@ -177,6 +183,8 @@ struct d3dx_effect
     unsigned int light_updated;
     D3DMATERIAL9 current_material;
     BOOL material_updated;
+
+    struct d3dx_parameter_block *current_parameter_block;
 };
 
 #define INITIAL_SHARED_DATA_SIZE 4
@@ -668,6 +676,14 @@ static void free_technique(struct d3dx_technique *technique)
     technique->name = NULL;
 }
 
+static void free_parameter_block(struct d3dx_parameter_block *block)
+{
+    if (!block)
+        return;
+
+    heap_free(block);
+}
+
 static void d3dx_effect_cleanup(struct d3dx_effect *effect)
 {
     ID3DXEffectPool *pool;
@@ -675,6 +691,8 @@ static void d3dx_effect_cleanup(struct d3dx_effect *effect)
 
     TRACE("effect %p.\n", effect);
 
+    free_parameter_block(effect->current_parameter_block);
+
     heap_free(effect->full_name_tmp);
 
     if (effect->parameters)
@@ -4045,11 +4063,21 @@ static HRESULT WINAPI d3dx_effect_GetStateManager(ID3DXEffect *iface, ID3DXEffec
 
 static HRESULT WINAPI d3dx_effect_BeginParameterBlock(ID3DXEffect *iface)
 {
-    struct d3dx_effect *This = impl_from_ID3DXEffect(iface);
+    struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
 
-    FIXME("(%p)->(): stub\n", This);
+    TRACE("iface %p.\n", iface);
 
-    return E_NOTIMPL;
+    if (effect->current_parameter_block)
+    {
+        WARN("Parameter block is already started.\n");
+        return D3DERR_INVALIDCALL;
+    }
+
+    effect->current_parameter_block = heap_alloc_zero(sizeof(*effect->current_parameter_block));
+    memcpy(effect->current_parameter_block->magic_string, parameter_block_magic_string,
+            sizeof(parameter_block_magic_string));
+
+    return D3D_OK;
 }
 
 static D3DXHANDLE WINAPI d3dx_effect_EndParameterBlock(ID3DXEffect *iface)
diff --git a/dlls/d3dx9_36/tests/effect.c b/dlls/d3dx9_36/tests/effect.c
index 922d8247b1..bb9604194d 100644
--- a/dlls/d3dx9_36/tests/effect.c
+++ b/dlls/d3dx9_36/tests/effect.c
@@ -8065,9 +8065,9 @@ 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->BeginParameterBlock(effect);
-    todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
+    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);
     handle = effect->lpVtbl->EndParameterBlock(effect);




More information about the wine-cvs mailing list