[PATCH 2/3] wined3d: Return error when GetData() is called from a deferred context.

Jan Sikorski jsikorski at codeweavers.com
Wed Sep 29 10:40:08 CDT 2021


Signed-off-by: Jan Sikorski <jsikorski at codeweavers.com>
---
 dlls/d3d11/device.c      | 4 ++++
 dlls/d3d11/tests/d3d11.c | 5 +++++
 2 files changed, 9 insertions(+)

diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
index c47b5208360..68b0333604f 100644
--- a/dlls/d3d11/device.c
+++ b/dlls/d3d11/device.c
@@ -1038,6 +1038,7 @@ static void STDMETHODCALLTYPE d3d11_device_context_End(ID3D11DeviceContext1 *ifa
 static HRESULT STDMETHODCALLTYPE d3d11_device_context_GetData(ID3D11DeviceContext1 *iface,
         ID3D11Asynchronous *asynchronous, void *data, UINT data_size, UINT data_flags)
 {
+    struct d3d11_device_context *context = impl_from_ID3D11DeviceContext1(iface);
     struct d3d_query *query = unsafe_impl_from_ID3D11Asynchronous(asynchronous);
     unsigned int wined3d_flags;
     HRESULT hr;
@@ -1045,6 +1046,9 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_context_GetData(ID3D11DeviceContex
     TRACE("iface %p, asynchronous %p, data %p, data_size %u, data_flags %#x.\n",
             iface, asynchronous, data, data_size, data_flags);
 
+    if (context->type != D3D11_DEVICE_CONTEXT_IMMEDIATE)
+        return DXGI_ERROR_INVALID_CALL;
+
     if (!data && data_size)
         return E_INVALIDARG;
 
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index c0d3b650d79..eb8cde40dcc 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -33091,6 +33091,11 @@ static void test_deferred_context_queries(void)
 
     ID3D11DeviceContext_ExecuteCommandList(immediate, list, FALSE);
 
+    hr = ID3D11DeviceContext_GetData(deferred, query, &data, sizeof(data), 0);
+    ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
+    hr = ID3D11DeviceContext_GetData(deferred, query, NULL, 0, 0);
+    ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
+
     get_query_data(immediate, query, &data, sizeof(data));
     ok(data.uint == 640 * 480, "Got unexpected query result 0x%08x%08x.\n", data.dword[1], data.dword[0]);
 
-- 
2.30.2




More information about the wine-devel mailing list