[PATCH v2 1/4] d3d11: Return an error from immediate FinishCommandList().
Chip Davis
cdavis at codeweavers.com
Thu May 14 14:03:36 CDT 2020
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 at codeweavers.com>
---
v2: Add tests. Reword description.
---
dlls/d3d11/device.c | 4 ++--
dlls/d3d11/tests/d3d11.c | 50 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 52 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..41e7ca7aa23 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -30062,6 +30062,55 @@ 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, 0xbaadf00d};
+ ID3D11DeviceContext *immediate_context;
+ D3D11_SUBRESOURCE_DATA buffer_data;
+ ID3D11CommandList *command_list;
+ D3D11_BUFFER_DESC buffer_desc;
+ 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_desc.ByteWidth = 4;
+ buffer_desc.Usage = D3D11_USAGE_DEFAULT;
+ buffer_desc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
+ buffer_desc.CPUAccessFlags = 0;
+ buffer_desc.MiscFlags = 0;
+ buffer_desc.StructureByteStride = 0;
+
+ buffer_data.pSysMem = &buffer_contents[0];
+ buffer_data.SysMemPitch = buffer_data.SysMemSlicePitch = 0;
+ hr = ID3D11Device_CreateBuffer(device, &buffer_desc, &buffer_data, &buffer[0]);
+ ok(hr == S_OK, "Failed to create buffer, hr %#x.\n", hr);
+
+ buffer_data.pSysMem = &buffer_contents[1];
+ hr = ID3D11Device_CreateBuffer(device, &buffer_desc, &buffer_data, &buffer[1]);
+ ok(hr == S_OK, "Failed to create buffer, hr %#x.\n", hr);
+
+ 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 +30274,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();
}
--
2.24.0
More information about the wine-devel
mailing list