Signed-off-by: Jan Sikorski jsikorski@codeweavers.com --- dlls/d3d11/tests/d3d11.c | 23 +++++++++++++++++++++++ dlls/wined3d/cs.c | 4 ++++ 2 files changed, 27 insertions(+)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index 0f8e59573ed..d8c10ab054c 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -32888,6 +32888,29 @@ static void test_deferred_context_rendering(void) ID3D11CommandList_Release(list1); ID3D11DeviceContext_Release(deferred);
+ /* Command lists do not inherit state from the immediate context. */ + + hr = ID3D11Device_CreateDeferredContext(device, 0, &deferred); + ok(hr == S_OK, "Failed to create deferred context, hr %#x.\n", hr); + + ID3D11DeviceContext_ClearRenderTargetView(immediate, test_context.backbuffer_rtv, black); + + ID3D11DeviceContext_OMSetRenderTargets(deferred, 1, &test_context.backbuffer_rtv, NULL); + set_viewport(deferred, 0.0f, 0.0f, 640.0f, 480.0f, 0.0f, 1.0f); + test_context.immediate_context = deferred; + draw_color_quad(&test_context, &white); + test_context.immediate_context = immediate; + hr = ID3D11DeviceContext_FinishCommandList(deferred, FALSE, &list1); + ok(hr == S_OK, "Failed to create command list, hr %#x.\n", hr); + + ID3D11DeviceContext_OMSetBlendState(immediate, green_blend, NULL, D3D11_DEFAULT_SAMPLE_MASK); + ID3D11DeviceContext_ExecuteCommandList(immediate, list1, FALSE); + color = get_texture_color(test_context.backbuffer, 320, 240); + ok(color == 0xffffffff, "Got unexpected color %#08x.\n", color); + + ID3D11CommandList_Release(list1); + ID3D11DeviceContext_Release(deferred); + /* The clearing of state done by FinishCommandList is captured by a * subsequent call to FinishCommandList... */
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index 1f03833e0ed..2d295d4660e 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -3637,6 +3637,10 @@ HRESULT CDECL wined3d_deferred_context_create(struct wined3d_device *device, str object->c.ops = &wined3d_deferred_context_ops; object->c.device = device;
+ /* Make sure the first command list gets the state reset when executed. + * Resets for subsequent command lists are encoded in wined3d_deferred_context_record_command_list(). */ + wined3d_device_context_emit_reset_state(&object->c, true); + TRACE("Created deferred context %p.\n", object); *context = &object->c;