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 --- v3: Fix size of created constant buffers. Make description a bit more specific. --- dlls/d3d11/device.c | 4 ++-- dlls/d3d11/tests/d3d11.c | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 38 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..90dadf84149 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -30062,6 +30062,41 @@ 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, buffer[1], 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 +30260,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 --- v3: 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 90dadf84149..7caae08816a 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 --- v3: 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 1711014c8d2..1325b5d6036 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -4834,6 +4834,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 22a9a9dd740..75c0163c258 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 d3eb8100cd8..a53d862602d 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2333,6 +2333,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 --- v3: Unchanged from v2.
I'm not sure how this would be tested. We'd need to effect some change to an object that isn't visible until we do an explicit Flush(). But resource readbacks trigger an implicit flush; otherwise, the tests would be sprinkled with explicit Flush() calls. --- 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=71763
Your paranoid android.
=== debiant (64 bit WoW report) ===
d3d11: d3d11.c:16859: Test failed: Got {-1.00787401e+000, 0.00000000e+000, 1.00000000e+000, 5.03937006e-001}, expected {-1.00000000e+000, 0.00000000e+000, 1.00000000e+000, 5.03937006e-001} at (0, 0), sub-resource 0.
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=71762
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 (32 bit 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=71761
Your paranoid android.
=== w8 (32 bit report) ===
d3d11: d3d11.c:6105: Test failed: Got unexpected NumPrimitivesWritten: 4294967292. d3d11.c:6108: Test failed: Got unexpected PrimitivesStorageNeeded: 4294967292.
=== 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) ===
Report validation errors: d3d11:d3d11 has no test summary line (early exit of the main process?) d3d11:d3d11 has unaccounted for todo messages d3d11:d3d11 has unaccounted for skip messages