Commit 36d20600 authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

d3d11/tests: Disable cross-device ContextState tests.

parent bc2c9afe
...@@ -7422,74 +7422,88 @@ static void test_device_context_state(void) ...@@ -7422,74 +7422,88 @@ static void test_device_context_state(void)
refcount = ID3D11VertexShader_Release(tmp_vs); refcount = ID3D11VertexShader_Release(tmp_vs);
ok(refcount == 1, "Got refcount %u, expected 1.\n", refcount); ok(refcount == 1, "Got refcount %u, expected 1.\n", refcount);
/* context states may be used with other devices instances too */ /* context states may be used with other devices instances too
d3d11_device2 = create_device(NULL); *
ok(!!d3d11_device2, "Failed to create device.\n"); * Or at least, no error is returned right away. Using objects like shaders
hr = ID3D11Device_QueryInterface(d3d11_device2, &IID_ID3D11Device1, (void **)&device2); * from other device instances causes a segfault later on Nvidia Windows
ok(SUCCEEDED(hr), "Failed to query device interface, hr %#x.\n", hr); * drivers. This suggests the feature tested below is more a bug than a
ID3D11Device_Release(d3d11_device2); * feature.
ID3D11Device1_GetImmediateContext1(device2, &context2); *
ok(!!context2, "Failed to get immediate context.\n"); * The tests below suggest that a ContextState object stores its own state
* for every device it is used with. This isn't entirely true, e.g. the
/* but they track a distinct state on each context */ * primitive topology can be transfered between devices, but will cause odd
ID3D11DeviceContext1_SwapDeviceContextState(context2, context_state, &tmp_context_state); * refcounting behavior afterwards (IAGetPrimitiveTopology will leak 54
ok(!!tmp_context_state, "Failed to get context state.\n"); * references on the context's device for example). */
tmp_vs = (ID3D11VertexShader *)0xdeadbeef; if (0)
ID3D11DeviceContext1_VSGetShader(context2, &tmp_vs, NULL, NULL); {
ok(!tmp_vs, "Got unexpected shader %p.\n", tmp_vs); d3d11_device2 = create_device(NULL);
ok(!!d3d11_device2, "Failed to create device.\n");
/* updating context2 vertex shader doesn't update other contexts using the same state */ hr = ID3D11Device_QueryInterface(d3d11_device2, &IID_ID3D11Device1, (void **)&device2);
ID3D11DeviceContext1_VSSetShader(context2, vs, NULL, 0); ok(SUCCEEDED(hr), "Failed to query device interface, hr %#x.\n", hr);
ID3D11DeviceContext1_VSGetShader(context, &tmp_vs, NULL, NULL); ID3D11Device_Release(d3d11_device2);
ok(tmp_vs == vs2, "Got shader %p, expected %p.\n", tmp_vs, vs2); ID3D11Device1_GetImmediateContext1(device2, &context2);
refcount = ID3D11VertexShader_Release(tmp_vs); ok(!!context2, "Failed to get immediate context.\n");
ok(refcount == 1, "Got refcount %u, expected 1.\n", refcount);
/* but they track a distinct state on each context */
ID3D11DeviceContext1_SwapDeviceContextState(context2, tmp_context_state, &context_state2); ID3D11DeviceContext1_SwapDeviceContextState(context2, context_state, &tmp_context_state);
refcount = ID3DDeviceContextState_Release(tmp_context_state); ok(!!tmp_context_state, "Failed to get context state.\n");
ok(refcount == 0, "Got refcount %u, expected 1.\n", refcount); tmp_vs = (ID3D11VertexShader *)0xdeadbeef;
refcount = ID3DDeviceContextState_Release(context_state2); ID3D11DeviceContext1_VSGetShader(context2, &tmp_vs, NULL, NULL);
ok(refcount == 1, "Got refcount %u, expected 1.\n", refcount); ok(!tmp_vs, "Got unexpected shader %p.\n", tmp_vs);
ok(context_state2 == context_state, "Got unexpected state pointer.\n");
/* updating context2 vertex shader doesn't update other contexts using the same state */
/* swapping the default state on context2 effectively clears the vertex shader */ ID3D11DeviceContext1_VSSetShader(context2, vs, NULL, 0);
tmp_vs = (ID3D11VertexShader *)0xdeadbeef; ID3D11DeviceContext1_VSGetShader(context, &tmp_vs, NULL, NULL);
ID3D11DeviceContext1_VSGetShader(context2, &tmp_vs, NULL, NULL); ok(tmp_vs == vs2, "Got shader %p, expected %p.\n", tmp_vs, vs2);
ok(!tmp_vs, "Got unexpected shader %p.\n", tmp_vs); refcount = ID3D11VertexShader_Release(tmp_vs);
ok(refcount == 1, "Got refcount %u, expected 1.\n", refcount);
ID3D11DeviceContext1_SwapDeviceContextState(context2, context_state, &tmp_context_state);
ok(!!tmp_context_state, "Failed to get context state.\n"); ID3D11DeviceContext1_SwapDeviceContextState(context2, tmp_context_state, &context_state2);
refcount = ID3DDeviceContextState_Release(tmp_context_state); refcount = ID3DDeviceContextState_Release(tmp_context_state);
ok(refcount == 0, "Got refcount %u, expected 1.\n", refcount); ok(refcount == 0, "Got refcount %u, expected 1.\n", refcount);
refcount = ID3DDeviceContextState_Release(context_state2);
/* clearing the vertex shader on context doesn't have side effect on context2 */ ok(refcount == 1, "Got refcount %u, expected 1.\n", refcount);
ID3D11DeviceContext1_VSSetShader(context, NULL, NULL, 0); ok(context_state2 == context_state, "Got unexpected state pointer.\n");
refcount = ID3D11VertexShader_Release(vs2);
ok(refcount == 0, "Got refcount %u, expected 0.\n", refcount); /* swapping the default state on context2 effectively clears the vertex shader */
tmp_vs = (ID3D11VertexShader *)0xdeadbeef; tmp_vs = (ID3D11VertexShader *)0xdeadbeef;
ID3D11DeviceContext1_VSGetShader(context2, &tmp_vs, NULL, NULL); ID3D11DeviceContext1_VSGetShader(context2, &tmp_vs, NULL, NULL);
ok(tmp_vs == vs, "Got shader %p, expected %p.\n", tmp_vs, vs); ok(!tmp_vs, "Got unexpected shader %p.\n", tmp_vs);
refcount = ID3D11VertexShader_Release(tmp_vs);
ok(refcount == 1, "Got refcount %u, expected 1.\n", refcount); ID3D11DeviceContext1_SwapDeviceContextState(context2, context_state, &tmp_context_state);
ok(!!tmp_context_state, "Failed to get context state.\n");
/* even after swapping it again */ refcount = ID3DDeviceContextState_Release(tmp_context_state);
ID3D11DeviceContext1_SwapDeviceContextState(context2, context_state, NULL); ok(refcount == 0, "Got refcount %u, expected 1.\n", refcount);
tmp_vs = (ID3D11VertexShader *)0xdeadbeef;
ID3D11DeviceContext1_VSGetShader(context2, &tmp_vs, NULL, NULL); /* clearing the vertex shader on context doesn't have side effect on context2 */
ok(tmp_vs == vs, "Got shader %p, expected %p.\n", tmp_vs, vs); ID3D11DeviceContext1_VSSetShader(context, NULL, NULL, 0);
refcount = ID3D11VertexShader_Release(tmp_vs); refcount = get_refcount(vs2);
ok(refcount == 1, "Got refcount %u, expected 1.\n", refcount); ok(refcount == 1, "Got refcount %u, expected 1.\n", refcount);
tmp_vs = (ID3D11VertexShader *)0xdeadbeef;
/* swapping the initial state on context2 doesn't have side effect on context either */ ID3D11DeviceContext1_VSGetShader(context2, &tmp_vs, NULL, NULL);
ID3D11DeviceContext1_SwapDeviceContextState(context2, previous_context_state, NULL); ok(tmp_vs == vs, "Got shader %p, expected %p.\n", tmp_vs, vs);
tmp_vs = (ID3D11VertexShader *)0xdeadbeef; refcount = ID3D11VertexShader_Release(tmp_vs);
ID3D11DeviceContext1_VSGetShader(context, &tmp_vs, NULL, NULL); ok(refcount == 1, "Got refcount %u, expected 1.\n", refcount);
ok(!tmp_vs, "Got unexpected shader %p.\n", tmp_vs);
/* even after swapping it again */
refcount = ID3D11DeviceContext1_Release(context2); ID3D11DeviceContext1_SwapDeviceContextState(context2, context_state, NULL);
ok(refcount == 0, "Got refcount %u, expected 0.\n", refcount); tmp_vs = (ID3D11VertexShader *)0xdeadbeef;
refcount = ID3D11Device1_Release(device2); ID3D11DeviceContext1_VSGetShader(context2, &tmp_vs, NULL, NULL);
ok(refcount == 0, "Got refcount %u, expected 0.\n", refcount); ok(tmp_vs == vs, "Got shader %p, expected %p.\n", tmp_vs, vs);
refcount = ID3D11VertexShader_Release(tmp_vs);
ok(refcount == 1, "Got refcount %u, expected 1.\n", refcount);
/* swapping the initial state on context2 doesn't have side effect on context either */
ID3D11DeviceContext1_SwapDeviceContextState(context2, previous_context_state, NULL);
tmp_vs = (ID3D11VertexShader *)0xdeadbeef;
ID3D11DeviceContext1_VSGetShader(context, &tmp_vs, NULL, NULL);
ok(!tmp_vs, "Got unexpected shader %p.\n", tmp_vs);
refcount = ID3D11DeviceContext1_Release(context2);
ok(refcount == 0, "Got refcount %u, expected 0.\n", refcount);
refcount = ID3D11Device1_Release(device2);
ok(refcount == 0, "Got refcount %u, expected 0.\n", refcount);
}
ID3D11DeviceContext1_SwapDeviceContextState(context, previous_context_state, &tmp_context_state); ID3D11DeviceContext1_SwapDeviceContextState(context, previous_context_state, &tmp_context_state);
refcount = ID3DDeviceContextState_Release(previous_context_state); refcount = ID3DDeviceContextState_Release(previous_context_state);
...@@ -8158,6 +8172,7 @@ static void test_device_context_state(void) ...@@ -8158,6 +8172,7 @@ static void test_device_context_state(void)
if (hs) ID3D11HullShader_Release(hs); if (hs) ID3D11HullShader_Release(hs);
ID3D11PixelShader_Release(ps); ID3D11PixelShader_Release(ps);
ID3D11GeometryShader_Release(gs); ID3D11GeometryShader_Release(gs);
ID3D11VertexShader_Release(vs2);
ID3D11VertexShader_Release(vs); ID3D11VertexShader_Release(vs);
ID3D11Buffer_Release(cb); ID3D11Buffer_Release(cb);
ID3D11ShaderResourceView_Release(srv); ID3D11ShaderResourceView_Release(srv);
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