[WINESYNC] d3dx9: Implement d3dx_effect_BeginParameterBlock().

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 e281ba4db6654850caf713ab09aa6a2057e1d064 by Paul Gofman <gofmanp@gmail.com>
This commit is contained in:
winesync 2020-09-21 23:01:50 +02:00 committed by Jérôme Gardou
parent db6d1a41d0
commit 76955cb6aa
3 changed files with 34 additions and 6 deletions

View file

@ -34,6 +34,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
@ -151,6 +152,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;
@ -181,6 +187,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
@ -672,6 +680,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;
@ -679,6 +695,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)
@ -4049,11 +4067,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)

View file

@ -8080,9 +8080,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);

View file

@ -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: 85d3ad879d5b13f7fce378009aaf80b419ad6185}
tags: {wine: e281ba4db6654850caf713ab09aa6a2057e1d064}