Module: wine Branch: master Commit: 4ec1c78ec46b5ffcb24c858c93a6ec231f9e03a0 URL: http://source.winehq.org/git/wine.git/?a=commit;h=4ec1c78ec46b5ffcb24c858c93...
Author: Henri Verbeet hverbeet@codeweavers.com Date: Tue Dec 11 22:27:32 2012 +0100
d3d10core/tests: Add a small test for ID3D10Device_CreateSamplerState().
---
dlls/d3d10core/tests/device.c | 47 +++++++++++++++++++++++++++++++++++++++++ 1 files changed, 47 insertions(+), 0 deletions(-)
diff --git a/dlls/d3d10core/tests/device.c b/dlls/d3d10core/tests/device.c index a0df22a..f509b27 100644 --- a/dlls/d3d10core/tests/device.c +++ b/dlls/d3d10core/tests/device.c @@ -570,6 +570,52 @@ float4 main(const float4 color : COLOR) : SV_TARGET ok(!refcount, "Device has %u references left.\n", refcount); }
+static void test_create_sampler_state(void) +{ + ID3D10SamplerState *sampler_state1, *sampler_state2; + D3D10_SAMPLER_DESC sampler_desc; + ID3D10Device *device; + ULONG refcount; + HRESULT hr; + + if (!(device = create_device())) + { + skip("Failed to create device, skipping tests.\n"); + return; + } + + hr = ID3D10Device_CreateSamplerState(device, NULL, &sampler_state1); + ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + + sampler_desc.Filter = D3D10_FILTER_MIN_MAG_MIP_LINEAR; + sampler_desc.AddressU = D3D10_TEXTURE_ADDRESS_WRAP; + sampler_desc.AddressV = D3D10_TEXTURE_ADDRESS_WRAP; + sampler_desc.AddressW = D3D10_TEXTURE_ADDRESS_WRAP; + sampler_desc.MipLODBias = 0.0f; + sampler_desc.MaxAnisotropy = 16; + sampler_desc.ComparisonFunc = D3D10_COMPARISON_ALWAYS; + sampler_desc.BorderColor[0] = 0.0f; + sampler_desc.BorderColor[1] = 1.0f; + sampler_desc.BorderColor[2] = 0.0f; + sampler_desc.BorderColor[3] = 1.0f; + sampler_desc.MinLOD = 0.0f; + sampler_desc.MaxLOD = 16.0f; + + hr = ID3D10Device_CreateSamplerState(device, &sampler_desc, &sampler_state1); + ok(SUCCEEDED(hr), "Failed to create sampler state, hr %#x.\n", hr); + hr = ID3D10Device_CreateSamplerState(device, &sampler_desc, &sampler_state2); + ok(SUCCEEDED(hr), "Failed to create sampler state, hr %#x.\n", hr); + ok(sampler_state1 == sampler_state2, "Got different sampler state objects.\n"); + + refcount = ID3D10SamplerState_Release(sampler_state2); + ok(refcount == 1, "Got unexpected refcount %u.\n", refcount); + refcount = ID3D10SamplerState_Release(sampler_state1); + ok(!refcount, "Got unexpected refcount %u.\n", refcount); + + refcount = ID3D10Device_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +} + START_TEST(device) { test_device_interfaces(); @@ -579,4 +625,5 @@ START_TEST(device) test_create_rendertarget_view(); test_create_shader_resource_view(); test_create_shader(); + test_create_sampler_state(); }