mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
[WINESYNC] d3dx9: Implement d3dx_effect_ApplyParameterBlock().
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 e28888c9fe504f75d985e34a2c271f43abd95497 by Paul Gofman <gofmanp@gmail.com>
This commit is contained in:
parent
7175721b38
commit
0336f97838
3 changed files with 38 additions and 26 deletions
|
@ -157,6 +157,7 @@ struct d3dx_technique
|
|||
struct d3dx_parameter_block
|
||||
{
|
||||
char magic_string[ARRAY_SIZE(parameter_block_magic_string)];
|
||||
struct d3dx_effect *effect;
|
||||
struct list entry;
|
||||
size_t size;
|
||||
size_t offset;
|
||||
|
@ -523,7 +524,6 @@ static struct d3dx_parameter *get_valid_parameter(struct d3dx_effect *effect, D3
|
|||
return effect->flags & D3DXFX_LARGEADDRESSAWARE ? NULL : get_parameter_by_name(effect, NULL, parameter);
|
||||
}
|
||||
|
||||
#if D3DX_SDK_VERSION >= 26
|
||||
static struct d3dx_parameter_block *get_valid_parameter_block(D3DXHANDLE handle)
|
||||
{
|
||||
struct d3dx_parameter_block *block = (struct d3dx_parameter_block *)handle;
|
||||
|
@ -531,7 +531,6 @@ static struct d3dx_parameter_block *get_valid_parameter_block(D3DXHANDLE handle)
|
|||
return block && !strncmp(block->magic_string, parameter_block_magic_string,
|
||||
sizeof(parameter_block_magic_string)) ? block : NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void free_state(struct d3dx_state *state)
|
||||
{
|
||||
|
@ -4227,6 +4226,7 @@ static HRESULT WINAPI d3dx_effect_BeginParameterBlock(ID3DXEffect *iface)
|
|||
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));
|
||||
effect->current_parameter_block->effect = effect;
|
||||
|
||||
return D3D_OK;
|
||||
}
|
||||
|
@ -4255,11 +4255,23 @@ static D3DXHANDLE WINAPI d3dx_effect_EndParameterBlock(ID3DXEffect *iface)
|
|||
|
||||
static HRESULT WINAPI d3dx_effect_ApplyParameterBlock(ID3DXEffect *iface, D3DXHANDLE parameter_block)
|
||||
{
|
||||
struct d3dx_effect *This = impl_from_ID3DXEffect(iface);
|
||||
struct d3dx_parameter_block *block = get_valid_parameter_block(parameter_block);
|
||||
struct d3dx_recorded_parameter *record;
|
||||
|
||||
FIXME("(%p)->(%p): stub\n", This, parameter_block);
|
||||
TRACE("iface %p, paramater_block %p.\n", iface, parameter_block);
|
||||
|
||||
return E_NOTIMPL;
|
||||
if (!block || !block->offset)
|
||||
return D3DERR_INVALIDCALL;
|
||||
|
||||
record = (struct d3dx_recorded_parameter *)block->buffer;
|
||||
while ((BYTE *)record < block->buffer + block->offset)
|
||||
{
|
||||
set_value(record->param, record + 1, record->bytes,
|
||||
param_get_data_and_dirtify(block->effect, record->param, record->bytes, TRUE));
|
||||
record = (struct d3dx_recorded_parameter *)((BYTE *)record + get_recorded_parameter_size(record));
|
||||
}
|
||||
assert((BYTE *)record == block->buffer + block->offset);
|
||||
return D3D_OK;
|
||||
}
|
||||
|
||||
#if D3DX_SDK_VERSION >= 26
|
||||
|
|
|
@ -8094,7 +8094,7 @@ static void test_effect_parameter_block(void)
|
|||
ok(refcount == 1, "Got unexpected refcount %u.\n", refcount);
|
||||
|
||||
hr = effect->lpVtbl->ApplyParameterBlock(effect, block);
|
||||
todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
|
||||
ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
|
||||
hr = effect->lpVtbl->DeleteParameterBlock(effect, block);
|
||||
ok(hr == D3D_OK, "Got result %#x.\n", hr);
|
||||
|
||||
|
@ -8107,7 +8107,7 @@ static void test_effect_parameter_block(void)
|
|||
block = effect->lpVtbl->EndParameterBlock(effect);
|
||||
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);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = effect->lpVtbl->DeleteParameterBlock(effect2, block);
|
||||
ok(hr == D3DERR_INVALIDCALL, "Got result %#x.\n", hr);
|
||||
|
@ -8115,9 +8115,9 @@ static void test_effect_parameter_block(void)
|
|||
ok(hr == D3D_OK, "Got result %#x.\n", hr);
|
||||
|
||||
hr = effect->lpVtbl->ApplyParameterBlock(effect, NULL);
|
||||
todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
|
||||
ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
|
||||
hr = effect->lpVtbl->ApplyParameterBlock(effect, "parameter_block");
|
||||
todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
|
||||
ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = D3DXCreateTexture(device, D3DX_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, 0, 0, D3DPOOL_DEFAULT, &texture);
|
||||
ok(hr == D3D_OK, "Got result %#x, expected 0 (D3D_OK).\n", hr);
|
||||
|
@ -8203,14 +8203,14 @@ static void test_effect_parameter_block(void)
|
|||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = effect->lpVtbl->ApplyParameterBlock(effect, block);
|
||||
todo_wine ok(hr == D3D_OK, "Got result %#x.\n", hr);
|
||||
ok(hr == D3D_OK, "Got result %#x.\n", hr);
|
||||
|
||||
IDirect3DTexture9_AddRef(texture);
|
||||
refcount = IDirect3DTexture9_Release(texture);
|
||||
todo_wine ok(refcount == 3, "Got unexpected refcount %u.\n", refcount);
|
||||
ok(refcount == 3, "Got unexpected refcount %u.\n", refcount);
|
||||
|
||||
hr = effect->lpVtbl->GetFloat(effect, "arr2[0]", &float_value);
|
||||
todo_wine ok(hr == D3D_OK && float_value == 92.0f, "Got unexpected hr %#x, float_value %g.\n", hr, float_value);
|
||||
ok(hr == D3D_OK && float_value == 92.0f, "Got unexpected hr %#x, float_value %g.\n", hr, float_value);
|
||||
hr = effect->lpVtbl->GetFloat(effect, "arr2[1]", &float_value);
|
||||
ok(hr == D3D_OK && float_value == 0.0f, "Got unexpected hr %#x, float_value %g.\n", hr, float_value);
|
||||
|
||||
|
@ -8221,16 +8221,16 @@ static void test_effect_parameter_block(void)
|
|||
|
||||
hr = effect->lpVtbl->GetMatrix(effect, "m3x2row", &mat);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
todo_wine ok(!memcmp(&mat, &test_mat, sizeof(mat)), "Got unexpected matrix.\n");
|
||||
ok(!memcmp(&mat, &test_mat, sizeof(mat)), "Got unexpected matrix.\n");
|
||||
hr = effect->lpVtbl->GetMatrix(effect, "m3x2column", &mat);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
todo_wine ok(!memcmp(&mat, &test_mat, sizeof(mat)), "Got unexpected matrix.\n");
|
||||
ok(!memcmp(&mat, &test_mat, sizeof(mat)), "Got unexpected matrix.\n");
|
||||
|
||||
hr = effect->lpVtbl->GetFloat(effect, "ts1[0].fv", &float_value);
|
||||
todo_wine ok(hr == D3D_OK && float_value == 28.0f, "Got unexpected hr %#x, float_value %g.\n", hr, float_value);
|
||||
ok(hr == D3D_OK && float_value == 28.0f, "Got unexpected hr %#x, float_value %g.\n", hr, float_value);
|
||||
|
||||
hr = effect->lpVtbl->GetFloatArray(effect, "ts1[0].v2", float_array, 4);
|
||||
todo_wine ok(hr == D3D_OK && float_array[0] == -29.0f
|
||||
ok(hr == D3D_OK && float_array[0] == -29.0f
|
||||
&& !memcmp(float_array + 1, float_array_zero, 3 * sizeof(*float_array)),
|
||||
"Got unexpected hr %#x, ts1[0].v2 (%g, %g, %g, %g).\n", hr,
|
||||
float_array[0], float_array[1], float_array[2], float_array[3]);
|
||||
|
@ -8255,7 +8255,7 @@ static void test_effect_parameter_block(void)
|
|||
hr = effect->lpVtbl->BeginParameterBlock(effect);
|
||||
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);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = effect->lpVtbl->GetFloat(effect, "arr2[0]", &float_value);
|
||||
ok(hr == D3D_OK && float_value == 0.0f, "Got unexpected hr %#x, float_value %g.\n", hr, float_value);
|
||||
|
@ -8287,10 +8287,10 @@ static void test_effect_parameter_block(void)
|
|||
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);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = effect->lpVtbl->GetFloat(effect, "arr2[0]", &float_value);
|
||||
todo_wine ok(hr == D3D_OK && float_value == 92.0f, "Got unexpected hr %#x, float_value %g.\n", hr, float_value);
|
||||
ok(hr == D3D_OK && float_value == 92.0f, "Got unexpected hr %#x, float_value %g.\n", hr, float_value);
|
||||
hr = effect->lpVtbl->GetFloat(effect, "arr2[1]", &float_value);
|
||||
ok(hr == D3D_OK && float_value == 0.0f, "Got unexpected hr %#x, float_value %g.\n", hr, float_value);
|
||||
|
||||
|
@ -8301,16 +8301,16 @@ static void test_effect_parameter_block(void)
|
|||
|
||||
hr = effect->lpVtbl->GetMatrix(effect, "m3x2row", &mat);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
todo_wine ok(!memcmp(&mat, &test_mat, sizeof(mat)), "Got unexpected matrix.\n");
|
||||
ok(!memcmp(&mat, &test_mat, sizeof(mat)), "Got unexpected matrix.\n");
|
||||
hr = effect->lpVtbl->GetMatrix(effect, "m3x2column", &mat);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
todo_wine ok(!memcmp(&mat, &test_mat, sizeof(mat)), "Got unexpected matrix.\n");
|
||||
ok(!memcmp(&mat, &test_mat, sizeof(mat)), "Got unexpected matrix.\n");
|
||||
|
||||
hr = effect->lpVtbl->GetFloat(effect, "ts1[0].fv", &float_value);
|
||||
todo_wine ok(hr == D3D_OK && float_value == 28.0f, "Got unexpected hr %#x, float_value %g.\n", hr, float_value);
|
||||
ok(hr == D3D_OK && float_value == 28.0f, "Got unexpected hr %#x, float_value %g.\n", hr, float_value);
|
||||
|
||||
hr = effect->lpVtbl->GetFloatArray(effect, "ts1[0].v2", float_array, 4);
|
||||
todo_wine ok(hr == D3D_OK && float_array[0] == -29.0f
|
||||
ok(hr == D3D_OK && float_array[0] == -29.0f
|
||||
&& !memcmp(float_array + 1, float_array_zero, 3 * sizeof(*float_array)),
|
||||
"Got unexpected hr %#x, ts1[0].v2 (%g, %g, %g, %g).\n", hr,
|
||||
float_array[0], float_array[1], float_array[2], float_array[3]);
|
||||
|
@ -8348,11 +8348,11 @@ static void test_effect_parameter_block(void)
|
|||
hr = effect->lpVtbl->SetMatrixArray(effect, "f33_2", mat_arr, 2);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
hr = effect->lpVtbl->ApplyParameterBlock(effect, block);
|
||||
todo_wine ok(hr == D3D_OK, "Got result %#x.\n", hr);
|
||||
ok(hr == D3D_OK, "Got result %#x.\n", hr);
|
||||
|
||||
hr = effect->lpVtbl->GetMatrixArray(effect, "f33_2", mat_arr, 2);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
todo_wine ok(!memcmp(&mat_arr[0], &test_mat, sizeof(test_mat))
|
||||
ok(!memcmp(&mat_arr[0], &test_mat, sizeof(test_mat))
|
||||
&& !memcmp(&mat_arr[1], &test_mat, sizeof(test_mat)), "Got unexpected matrix array.\n");
|
||||
|
||||
refcount = effect->lpVtbl->Release(effect);
|
||||
|
|
|
@ -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: 7d512a1e0ef58fad25e53af5316d445cb0cfc5e7}
|
||||
tags: {wine: e28888c9fe504f75d985e34a2c271f43abd95497}
|
||||
|
|
Loading…
Reference in a new issue