From faecb8eda4b0360f5d60d3a989fb3cfed779df0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Wed, 26 Apr 2017 13:19:59 +0200 Subject: [PATCH] d3d11/tests: Extend test for ID3DDeviceContextState. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Józef Kucia Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/d3d11/tests/d3d11.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index a692473b9c0..23fbecf9e17 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -5314,6 +5314,9 @@ static void test_device_context_state(void) return; } + check_interface(device, &IID_ID3D10Device, FALSE, FALSE); + check_interface(device, &IID_ID3D10Device1, FALSE, FALSE); + feature_level = ID3D11Device1_GetFeatureLevel(device); ID3D11Device1_GetImmediateContext1(device, &context); @@ -5334,7 +5337,7 @@ static void test_device_context_state(void) ok(SUCCEEDED(hr), "Failed to create sampler state, hr %#x.\n", hr); ID3D11DeviceContext1_PSSetSamplers(context, 0, 1, &sampler); - tmp_sampler = (ID3D11SamplerState *)0xdeadbeef; + tmp_sampler = NULL; ID3D11DeviceContext1_PSGetSamplers(context, 0, 1, &tmp_sampler); ok(tmp_sampler == sampler, "Got sampler %p, expected %p.\n", tmp_sampler, sampler); ID3D11SamplerState_Release(tmp_sampler); @@ -5347,7 +5350,7 @@ static void test_device_context_state(void) ok(refcount == 1, "Got refcount %u, expected 1.\n", refcount); /* Enable ID3D10Device behavior. */ - previous_context_state = (ID3DDeviceContextState *)0xdeadbeef; + previous_context_state = NULL; ID3D11DeviceContext1_SwapDeviceContextState(context, context_state, &previous_context_state); refcount = ID3DDeviceContextState_Release(context_state); ok(!refcount, "Got refcount %u, expected 0.\n", refcount); @@ -5358,18 +5361,35 @@ static void test_device_context_state(void) ok(tmp_sampler == (ID3D11SamplerState *)0xdeadbeef, "Got unexpected sampler %p.\n", tmp_sampler); ID3D11DeviceContext1_PSSetSamplers(context, 0, 1, &tmp_sampler); + check_interface(device, &IID_ID3D10Device, TRUE, FALSE); + check_interface(device, &IID_ID3D10Device1, TRUE, FALSE); + ID3D11DeviceContext1_SwapDeviceContextState(context, previous_context_state, &context_state); refcount = ID3DDeviceContextState_Release(context_state); ok(!refcount, "Got refcount %u, expected 0.\n", refcount); refcount = ID3DDeviceContextState_Release(previous_context_state); ok(!refcount, "Got refcount %u, expected 0.\n", refcount); - ID3D11DeviceContext1_PSSetSamplers(context, 0, 1, &sampler); - tmp_sampler = (ID3D11SamplerState *)0xdeadbeef; + /* ID3DDeviceContextState retains the previous state. */ + tmp_sampler = NULL; ID3D11DeviceContext1_PSGetSamplers(context, 0, 1, &tmp_sampler); ok(tmp_sampler == sampler, "Got sampler %p, expected %p.\n", tmp_sampler, sampler); ID3D11SamplerState_Release(tmp_sampler); + tmp_sampler = NULL; + ID3D11DeviceContext1_PSSetSamplers(context, 0, 1, &tmp_sampler); + tmp_sampler = (ID3D11SamplerState *)0xdeadbeef; + ID3D11DeviceContext1_PSGetSamplers(context, 0, 1, &tmp_sampler); + ok(!tmp_sampler, "Got unexpected sampler %p.\n", tmp_sampler); + ID3D11DeviceContext1_PSSetSamplers(context, 0, 1, &sampler); + tmp_sampler = NULL; + ID3D11DeviceContext1_PSGetSamplers(context, 0, 1, &tmp_sampler); + ok(tmp_sampler == sampler, "Got sampler %p, expected %p.\n", tmp_sampler, sampler); + ID3D11SamplerState_Release(tmp_sampler); + + check_interface(device, &IID_ID3D10Device, TRUE, FALSE); + check_interface(device, &IID_ID3D10Device1, TRUE, FALSE); + ID3D11SamplerState_Release(sampler); ID3D11DeviceContext1_Release(context); refcount = ID3D11Device1_Release(device);