Module: wine Branch: master Commit: 7cce4453d4bc4c58288c7fac275f175a3c8223e8 URL: http://source.winehq.org/git/wine.git/?a=commit;h=7cce4453d4bc4c58288c7fac27...
Author: Henri Verbeet hverbeet@codeweavers.com Date: Wed Nov 16 20:08:05 2011 +0100
d3d10: Implement D3D10StateBlockMaskIntersect().
---
dlls/d3d10/d3d10.spec | 2 +- dlls/d3d10/stateblock.c | 23 +++++++++++++++++++++++ dlls/d3d10/tests/device.c | 11 +++++++++++ include/d3d10effect.h | 2 ++ 4 files changed, 37 insertions(+), 1 deletions(-)
diff --git a/dlls/d3d10/d3d10.spec b/dlls/d3d10/d3d10.spec index aab3822..42996a8 100644 --- a/dlls/d3d10/d3d10.spec +++ b/dlls/d3d10/d3d10.spec @@ -25,5 +25,5 @@ @ stdcall D3D10StateBlockMaskEnableAll(ptr) @ stdcall D3D10StateBlockMaskEnableCapture(ptr long long long) @ stdcall D3D10StateBlockMaskGetSetting(ptr long long) -@ stub D3D10StateBlockMaskIntersect +@ stdcall D3D10StateBlockMaskIntersect(ptr ptr ptr) @ stub D3D10StateBlockMaskUnion diff --git a/dlls/d3d10/stateblock.c b/dlls/d3d10/stateblock.c index ebc5370..67ccae7 100644 --- a/dlls/d3d10/stateblock.c +++ b/dlls/d3d10/stateblock.c @@ -485,3 +485,26 @@ BOOL WINAPI D3D10StateBlockMaskGetSetting(D3D10_STATE_BLOCK_MASK *mask, return FALSE; } } + +HRESULT WINAPI D3D10StateBlockMaskIntersect(D3D10_STATE_BLOCK_MASK *mask_x, + D3D10_STATE_BLOCK_MASK *mask_y, D3D10_STATE_BLOCK_MASK *result) +{ + UINT count = sizeof(*result) / sizeof(DWORD); + UINT i; + + TRACE("mask_x %p, mask_y %p, result %p.\n", mask_x, mask_y, result); + + if (!mask_x || !mask_y || !result) + return E_INVALIDARG; + + for (i = 0; i < count; ++i) + { + ((DWORD *)result)[i] = ((DWORD *)mask_x)[i] & ((DWORD *)mask_y)[i]; + } + for (i = count * sizeof(DWORD); i < sizeof(*result); ++i) + { + ((BYTE *)result)[i] = ((BYTE *)mask_x)[i] & ((BYTE *)mask_y)[i]; + } + + return S_OK; +} diff --git a/dlls/d3d10/tests/device.c b/dlls/d3d10/tests/device.c index a0958c5..2ce0b2a 100644 --- a/dlls/d3d10/tests/device.c +++ b/dlls/d3d10/tests/device.c @@ -117,6 +117,17 @@ static void test_stateblock_mask(void) hr = D3D10StateBlockMaskDifference(&mask_x, &mask_y, NULL); ok(hr == E_INVALIDARG, "Got unexpect hr %#x.\n", hr);
+ hr = D3D10StateBlockMaskIntersect(&mask_x, &mask_y, &result); + ok(SUCCEEDED(hr), "D3D10StateBlockMaskIntersect failed, hr %#x.\n", hr); + ok(result.VS == 0x11, "Got unexpected result.VS %#x.\n", result.VS); + ok(result.Predication == 0x88, "Got unexpected result.Predication %#x.\n", result.Predication); + hr = D3D10StateBlockMaskIntersect(NULL, &mask_y, &result); + ok(hr == E_INVALIDARG, "Got unexpect hr %#x.\n", hr); + hr = D3D10StateBlockMaskIntersect(&mask_x, NULL, &result); + ok(hr == E_INVALIDARG, "Got unexpect hr %#x.\n", hr); + hr = D3D10StateBlockMaskIntersect(&mask_x, &mask_y, NULL); + ok(hr == E_INVALIDARG, "Got unexpect hr %#x.\n", hr); + memset(&result, 0xff, sizeof(result)); hr = D3D10StateBlockMaskDisableAll(&result); ok(SUCCEEDED(hr), "D3D10StateBlockMaskDisableAll failed, hr %#x.\n", hr); diff --git a/include/d3d10effect.h b/include/d3d10effect.h index c39bbb2..6db61d3 100644 --- a/include/d3d10effect.h +++ b/include/d3d10effect.h @@ -842,6 +842,8 @@ HRESULT WINAPI D3D10StateBlockMaskEnableCapture(D3D10_STATE_BLOCK_MASK *mask, D3D10_DEVICE_STATE_TYPES state_type, UINT start_idx, UINT count); BOOL WINAPI D3D10StateBlockMaskGetSetting(D3D10_STATE_BLOCK_MASK *mask, D3D10_DEVICE_STATE_TYPES state_type, UINT idx); +HRESULT WINAPI D3D10StateBlockMaskIntersect(D3D10_STATE_BLOCK_MASK *mask_x, + D3D10_STATE_BLOCK_MASK *mask_y, D3D10_STATE_BLOCK_MASK *result);
#ifdef __cplusplus }