[PATCH 10/10] d3dx9: Implement d3dx_effect_ApplyParameterBlock().

Paul Gofman gofmanp at gmail.com
Thu Nov 7 15:17:44 CST 2019


Signed-off-by: Paul Gofman <gofmanp at gmail.com>
---
 dlls/d3dx9_36/effect.c       | 18 +++++++++++++++---
 dlls/d3dx9_36/tests/effect.c | 20 ++++++++++----------
 2 files changed, 25 insertions(+), 13 deletions(-)

diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c
index 7a7fc336e1..3cf7e39f4a 100644
--- a/dlls/d3dx9_36/effect.c
+++ b/dlls/d3dx9_36/effect.c
@@ -4266,11 +4266,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->current_size)
+        return D3DERR_INVALIDCALL;
+
+    record = (struct d3dx_recorded_parameter *)block->buffer;
+    while ((BYTE *)record < block->buffer + block->current_size)
+    {
+        set_value(record->param, record + 1, record->bytes);
+        set_dirty(record->param);
+        record = (struct d3dx_recorded_parameter *)((BYTE *)record + get_recorded_parameter_size(record));
+    }
+    assert((BYTE *)record == block->buffer + block->current_size);
+    return D3D_OK;
 }
 
 #if D3DX_SDK_VERSION >= 26
diff --git a/dlls/d3dx9_36/tests/effect.c b/dlls/d3dx9_36/tests/effect.c
index d24e04a753..a61a288420 100644
--- a/dlls/d3dx9_36/tests/effect.c
+++ b/dlls/d3dx9_36/tests/effect.c
@@ -8073,7 +8073,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);
 
@@ -8086,7 +8086,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);
@@ -8094,7 +8094,7 @@ static void test_effect_parameter_block(void)
     ok(hr == D3D_OK, "Got result %#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);
@@ -8168,14 +8168,14 @@ static void test_effect_parameter_block(void)
 
 
     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);
     hr = effect->lpVtbl->GetFloatArray(effect, "ts1[0].v1", float_array, 3);
@@ -8186,15 +8186,15 @@ static void test_effect_parameter_block(void)
     hr = effect->lpVtbl->GetFloat(effect, "ts1[0].fv", &float_value);
     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");
 
-    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);
     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
-    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]);
-- 
2.23.0




More information about the wine-devel mailing list