Commit a11a1713 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

d3d10: Implement D3D10StateBlockMaskDifference().

parent 84f90f6e
......@@ -19,7 +19,7 @@
@ stub D3D10PreprocessShader
@ stdcall D3D10ReflectShader(ptr long ptr)
@ stub D3D10RegisterLayers
@ stub D3D10StateBlockMaskDifference
@ stdcall D3D10StateBlockMaskDifference(ptr ptr ptr)
@ stub D3D10StateBlockMaskDisableAll
@ stub D3D10StateBlockMaskDisableCapture
@ stub D3D10StateBlockMaskEnableAll
......
......@@ -143,3 +143,26 @@ HRESULT WINAPI D3D10CreateStateBlock(ID3D10Device *device,
return S_OK;
}
HRESULT WINAPI D3D10StateBlockMaskDifference(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;
}
......@@ -64,6 +64,32 @@ static void test_device_interfaces(ID3D10Device *device)
ok(SUCCEEDED(hr), "ID3D10Device does not implement IDXGIDevice (%#x)\n", hr);
}
static void test_stateblock_mask(void)
{
D3D10_STATE_BLOCK_MASK mask_x, mask_y, result;
HRESULT hr;
memset(&mask_x, 0, sizeof(mask_x));
memset(&mask_y, 0, sizeof(mask_y));
memset(&result, 0, sizeof(result));
mask_x.VS = 0x33;
mask_y.VS = 0x55;
mask_x.Predication = 0x99;
mask_y.Predication = 0xaa;
hr = D3D10StateBlockMaskDifference(&mask_x, &mask_y, &result);
ok(SUCCEEDED(hr), "D3D10StateBlockMaskDifference failed, hr %#x.\n", hr);
ok(result.VS == 0x66, "Got unexpected result.VS %#x.\n", result.VS);
ok(result.Predication == 0x33, "Got unexpected result.Predication %#x.\n", result.Predication);
hr = D3D10StateBlockMaskDifference(NULL, &mask_y, &result);
ok(hr == E_INVALIDARG, "Got unexpect hr %#x.\n", hr);
hr = D3D10StateBlockMaskDifference(&mask_x, NULL, &result);
ok(hr == E_INVALIDARG, "Got unexpect hr %#x.\n", hr);
hr = D3D10StateBlockMaskDifference(&mask_x, &mask_y, NULL);
ok(hr == E_INVALIDARG, "Got unexpect hr %#x.\n", hr);
}
START_TEST(device)
{
ID3D10Device *device;
......@@ -77,6 +103,7 @@ START_TEST(device)
}
test_device_interfaces(device);
test_stateblock_mask();
refcount = ID3D10Device_Release(device);
ok(!refcount, "Device has %u references left\n", refcount);
......
......@@ -804,6 +804,9 @@ HRESULT WINAPI D3D10CreateEffectFromMemory(void *data, SIZE_T data_size, UINT fl
HRESULT WINAPI D3D10CreateStateBlock(ID3D10Device *device,
D3D10_STATE_BLOCK_MASK *mask, ID3D10StateBlock **stateblock);
HRESULT WINAPI D3D10StateBlockMaskDifference(D3D10_STATE_BLOCK_MASK *mask_x,
D3D10_STATE_BLOCK_MASK *mask_y, D3D10_STATE_BLOCK_MASK *result);
#ifdef __cplusplus
}
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment