This is only used with deferred contexts to record all commands thus far submitted to a command list object. It has no effect on immediate contexts.
Signed-off-by: Chip Davis cdavis@codeweavers.com --- v4: Add casts to avoid warning which is only generated because C doesn't have interface inheritance. --- dlls/d3d11/device.c | 4 ++-- dlls/d3d11/tests/d3d11.c | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 2 deletions(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index 7544bc86f4b..01b32002408 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -2416,9 +2416,9 @@ static UINT STDMETHODCALLTYPE d3d11_immediate_context_GetContextFlags(ID3D11Devi static HRESULT STDMETHODCALLTYPE d3d11_immediate_context_FinishCommandList(ID3D11DeviceContext1 *iface, BOOL restore, ID3D11CommandList **command_list) { - FIXME("iface %p, restore %#x, command_list %p stub!\n", iface, restore, command_list); + WARN("iface %p, restore %#x, command_list %p called on immediate context.\n", iface, restore, command_list);
- return E_NOTIMPL; + return DXGI_ERROR_INVALID_CALL; }
static void STDMETHODCALLTYPE d3d11_immediate_context_CopySubresourceRegion1(ID3D11DeviceContext1 *iface, diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index 3ae05537a1e..36c637abe5c 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -30062,6 +30062,42 @@ static void test_dual_source_blend(void) release_test_context(&test_context); }
+static void test_deferred_methods_on_immediate_context(void) +{ + static const unsigned int buffer_contents[] = {0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, + 0xbaadf00d, 0xbaadf00d, 0xbaadf00d, 0xbaadf00d}; + ID3D11DeviceContext *immediate_context; + ID3D11CommandList *command_list; + ID3D11Buffer *buffer[2]; + ID3D11Device *device; + HRESULT hr; + + if (!(device = create_device(NULL))) + { + skip("Failed to create device.\n"); + return; + } + + ID3D11Device_GetImmediateContext(device, &immediate_context); + + hr = ID3D11DeviceContext_FinishCommandList(immediate_context, FALSE, &command_list); + ok(hr == DXGI_ERROR_INVALID_CALL, "Immediate FinishCommandList returned hr %#x.\n", hr); + + buffer[0] = create_buffer(device, D3D11_BIND_CONSTANT_BUFFER, 16, &buffer_contents[0]); + buffer[1] = create_buffer(device, D3D11_BIND_CONSTANT_BUFFER, 16, &buffer_contents[4]); + + ID3D11DeviceContext_CopyResource(immediate_context, (ID3D11Resource *)buffer[1], + (ID3D11Resource *)buffer[0]); + + hr = ID3D11DeviceContext_FinishCommandList(immediate_context, FALSE, &command_list); + ok(hr == DXGI_ERROR_INVALID_CALL, "Immediate FinishCommandList returned hr %#x.\n", hr); + + ID3D11DeviceContext_Release(immediate_context); + ID3D11Buffer_Release(buffer[0]); + ID3D11Buffer_Release(buffer[1]); + ID3D11Device_Release(device); +} + START_TEST(d3d11) { unsigned int argc, i; @@ -30225,6 +30261,7 @@ START_TEST(d3d11) queue_test(test_color_mask); queue_test(test_independent_blend); queue_test(test_dual_source_blend); + queue_test(test_deferred_methods_on_immediate_context);
run_queued_tests(); }
This returns the flags that were passed to ID3D11Device::CreateDeferredContext(). It has no meaning for immediate contexts, and there are no flags defined anyway.
Signed-off-by: Chip Davis cdavis@codeweavers.com --- v4: Unchanged from v2. --- dlls/d3d11/device.c | 2 +- dlls/d3d11/tests/d3d11.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index 01b32002408..207d3869c27 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -2408,7 +2408,7 @@ static D3D11_DEVICE_CONTEXT_TYPE STDMETHODCALLTYPE d3d11_immediate_context_GetTy
static UINT STDMETHODCALLTYPE d3d11_immediate_context_GetContextFlags(ID3D11DeviceContext1 *iface) { - FIXME("iface %p stub!\n", iface); + WARN("iface %p called on immediate context.\n", iface);
return 0; } diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index 36c637abe5c..5f97fcb4b5a 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -30070,6 +30070,7 @@ static void test_deferred_methods_on_immediate_context(void) ID3D11CommandList *command_list; ID3D11Buffer *buffer[2]; ID3D11Device *device; + unsigned int flags; HRESULT hr;
if (!(device = create_device(NULL))) @@ -30080,6 +30081,9 @@ static void test_deferred_methods_on_immediate_context(void)
ID3D11Device_GetImmediateContext(device, &immediate_context);
+ flags = ID3D11DeviceContext_GetContextFlags(immediate_context); + ok(flags == 0, "Immediate context has flags %#x.\n", flags); + hr = ID3D11DeviceContext_FinishCommandList(immediate_context, FALSE, &command_list); ok(hr == DXGI_ERROR_INVALID_CALL, "Immediate FinishCommandList returned hr %#x.\n", hr);
Signed-off-by: Chip Davis cdavis@codeweavers.com --- v4: Unchanged. --- dlls/wined3d/device.c | 7 +++++++ dlls/wined3d/wined3d.spec | 1 + include/wine/wined3d.h | 1 + 3 files changed, 9 insertions(+)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index ffc73bd2339..e785007bb2c 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -5196,6 +5196,13 @@ void CDECL wined3d_device_evict_managed_resources(struct wined3d_device *device) } }
+void CDECL wined3d_device_flush(struct wined3d_device *device) +{ + TRACE("device %p.\n", device); + + wined3d_cs_emit_flush(device->cs); +} + static void update_swapchain_flags(struct wined3d_texture *texture) { unsigned int flags = texture->swapchain->state.desc.flags; diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec index a240aba555a..8c98d5f3b62 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -53,6 +53,7 @@ @ cdecl wined3d_device_draw_primitive_instanced_indirect(ptr ptr long) @ cdecl wined3d_device_end_scene(ptr) @ cdecl wined3d_device_evict_managed_resources(ptr) +@ cdecl wined3d_device_flush(ptr) @ cdecl wined3d_device_get_available_texture_mem(ptr) @ cdecl wined3d_device_get_blend_state(ptr ptr) @ cdecl wined3d_device_get_clip_status(ptr ptr) diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 381a823cfbf..5ea7ef7ce5c 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2334,6 +2334,7 @@ void __cdecl wined3d_device_draw_primitive_instanced_indirect(struct wined3d_dev struct wined3d_buffer *buffer, unsigned int offset); HRESULT __cdecl wined3d_device_end_scene(struct wined3d_device *device); void __cdecl wined3d_device_evict_managed_resources(struct wined3d_device *device); +void __cdecl wined3d_device_flush(struct wined3d_device *device); UINT __cdecl wined3d_device_get_available_texture_mem(const struct wined3d_device *device); struct wined3d_blend_state * __cdecl wined3d_device_get_blend_state(const struct wined3d_device *device, struct wined3d_color *blend_factor);
Signed-off-by: Chip Davis cdavis@codeweavers.com --- v4: Unchanged from v2. --- dlls/d3d11/device.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index 207d3869c27..368a66ce74e 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -2396,7 +2396,13 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_ClearState(ID3D11DeviceCon
static void STDMETHODCALLTYPE d3d11_immediate_context_Flush(ID3D11DeviceContext1 *iface) { - FIXME("iface %p stub!\n", iface); + struct d3d_device *device = device_from_immediate_ID3D11DeviceContext1(iface); + + TRACE("iface %p.\n", iface); + + wined3d_mutex_lock(); + wined3d_device_flush(device->wined3d_device); + wined3d_mutex_unlock(); }
static D3D11_DEVICE_CONTEXT_TYPE STDMETHODCALLTYPE d3d11_immediate_context_GetType(ID3D11DeviceContext1 *iface) @@ -5246,7 +5252,13 @@ static void STDMETHODCALLTYPE d3d10_device_ClearState(ID3D10Device1 *iface)
static void STDMETHODCALLTYPE d3d10_device_Flush(ID3D10Device1 *iface) { - FIXME("iface %p stub!\n", iface); + struct d3d_device *device = impl_from_ID3D10Device(iface); + + TRACE("iface %p.\n", iface); + + wined3d_mutex_lock(); + wined3d_device_flush(device->wined3d_device); + wined3d_mutex_unlock(); }
static HRESULT STDMETHODCALLTYPE d3d10_device_CreateBuffer(ID3D10Device1 *iface,
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=71795
Your paranoid android.
=== w1064v1809_ar (32 bit report) ===
d3d11: d3d11.c:5775: Test failed: Got unexpected IAVertices count: 0. d3d11.c:5776: Test failed: Got unexpected IAPrimitives count: 0. d3d11.c:5777: Test failed: Got unexpected VSInvocations count: 0. d3d11.c:5780: Test failed: Got unexpected CInvocations count: 0. d3d11.c:5781: Test failed: Got unexpected CPrimitives count: 0.
=== debiant (64 bit WoW report) ===
Report validation errors: d3d11:d3d11 has no test summary line (early exit of the main process?) d3d11:d3d11 has unaccounted for failure messages d3d11:d3d11 has unaccounted for todo messages d3d11:d3d11 has unaccounted for skip messages d3d11:d3d11 returned success despite having failures
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=71794
Your paranoid android.
=== w1064v1809_he (32 bit report) ===
d3d11: d3d11.c:5775: Test failed: Got unexpected IAVertices count: 0. d3d11.c:5776: Test failed: Got unexpected IAPrimitives count: 0. d3d11.c:5777: Test failed: Got unexpected VSInvocations count: 0. d3d11.c:5780: Test failed: Got unexpected CInvocations count: 0. d3d11.c:5781: Test failed: Got unexpected CPrimitives count: 0.
=== w1064v1809_ja (32 bit report) ===
d3d11: d3d11.c:5775: Test failed: Got unexpected IAVertices count: 0. d3d11.c:5776: Test failed: Got unexpected IAPrimitives count: 0. d3d11.c:5777: Test failed: Got unexpected VSInvocations count: 0. d3d11.c:5780: Test failed: Got unexpected CInvocations count: 0. d3d11.c:5781: Test failed: Got unexpected CPrimitives count: 0.
=== debiant (32 bit Japanese:Japan report) ===
d3d11: d3d11.c:6118: Test succeeded inside todo block: Got unexpected PrimitivesStorageNeeded: 0.
=== debiant (64 bit WoW report) ===
Report validation errors: d3d11:d3d11 has no test summary line (early exit of the main process?) d3d11:d3d11 has unaccounted for failure messages d3d11:d3d11 has unaccounted for todo messages d3d11:d3d11 has unaccounted for skip messages d3d11:d3d11 returned success despite having failures