Module: wine Branch: master Commit: 8bc783ef3011de1404f5fcc418cdcd54deae8dd5 URL: http://source.winehq.org/git/wine.git/?a=commit;h=8bc783ef3011de1404f5fcc418...
Author: Paul Gofman gofmanp@gmail.com Date: Fri Jun 2 12:58:11 2017 +0300
d3dx9/tests: Add tests for updating boolean matrices on CommitChanges.
Signed-off-by: Paul Gofman gofmanp@gmail.com Signed-off-by: Matteo Bruni mbruni@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/d3dx9_36/tests/effect.c | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-)
diff --git a/dlls/d3dx9_36/tests/effect.c b/dlls/d3dx9_36/tests/effect.c index 966f1bd..6ec07a2 100644 --- a/dlls/d3dx9_36/tests/effect.c +++ b/dlls/d3dx9_36/tests/effect.c @@ -5128,6 +5128,17 @@ static void test_effect_commitchanges(IDirect3DDevice9 *device) {"arr2", {0x60000000, 0x00000000}}, {"ts3", {0x00000fc0, 0x00000000}}, }; + static const struct + { + const char *param_name; + const unsigned int const_updated_mask[(ARRAY_SIZE(test_effect_preshader_bconsts) + + TEST_EFFECT_BITMASK_BLOCK_SIZE - 1) / TEST_EFFECT_BITMASK_BLOCK_SIZE]; + } + check_bconsts_parameters[] = + { + {"mb2x3row", {0x0000001f}}, + {"mb2x3column", {0x00000060}}, + }; static const unsigned int const_no_update_mask[(ARRAY_SIZE(test_effect_preshader_fvect_v) + TEST_EFFECT_BITMASK_BLOCK_SIZE - 1) / TEST_EFFECT_BITMASK_BLOCK_SIZE]; static const D3DLIGHT9 light_filler = {D3DLIGHT_POINT}; @@ -5139,6 +5150,8 @@ static void test_effect_commitchanges(IDirect3DDevice9 *device) int ivect[4]; D3DXVECTOR4 fvect; IDirect3DVertexShader9 *vshader; + unsigned char buffer[256]; +
hr = D3DXCreateEffect(device, test_effect_preshader_effect_blob, sizeof(test_effect_preshader_effect_blob), NULL, NULL, 0, NULL, &effect, NULL); @@ -5180,8 +5193,6 @@ static void test_effect_commitchanges(IDirect3DDevice9 *device)
for (i = 0; i < ARRAY_SIZE(check_vconsts_parameters); ++i) { - unsigned char buffer[256]; - test_effect_preshader_clear_vconsts(device); param = effect->lpVtbl->GetParameterByName(effect, NULL, check_vconsts_parameters[i].param_name); ok(!!param, "GetParameterByName failed.\n"); @@ -5196,6 +5207,22 @@ static void test_effect_commitchanges(IDirect3DDevice9 *device) check_vconsts_parameters[i].param_name); }
+ for (i = 0; i < ARRAY_SIZE(check_bconsts_parameters); ++i) + { + test_effect_preshader_clear_pbool_consts(device); + param = effect->lpVtbl->GetParameterByName(effect, NULL, check_bconsts_parameters[i].param_name); + ok(!!param, "GetParameterByName failed.\n"); + hr = effect->lpVtbl->GetValue(effect, param, buffer, sizeof(buffer)); + ok(hr == D3D_OK, "Got result %#x.\n", hr); + hr = effect->lpVtbl->SetValue(effect, param, buffer, sizeof(buffer)); + ok(hr == D3D_OK, "Got result %#x.\n", hr); + hr = effect->lpVtbl->CommitChanges(effect); + ok(hr == D3D_OK, "Got result %#x.\n", hr); + + test_effect_preshader_compare_pbool_consts(device, check_bconsts_parameters[i].const_updated_mask, + check_bconsts_parameters[i].param_name); + } + test_effect_preshader_clear_vconsts(device); param = effect->lpVtbl->GetParameterByName(effect, NULL, "g_Selector"); ok(!!param, "GetParameterByName failed.\n");