[PATCH v2 3/9] d3dx9: Implement d3dx_effect_BeginParameterBlock().
Paul Gofman
gofmanp at gmail.com
Wed Nov 13 08:17:30 CST 2019
Signed-off-by: Paul Gofman <gofmanp at gmail.com>
---
v2:
- no changes.
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 4eb1a2b042..25664194ea 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
@@ -670,6 +678,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;
@@ -677,6 +693,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)
@@ -4047,11 +4065,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 3560696a1c..c643f9da7f 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);
--
2.23.0
More information about the wine-devel
mailing list