[PATCH 5/9] wined3d: Return WINED3DERR_INVALIDCALL for not started queries.

Józef Kucia jkucia at codeweavers.com
Fri Feb 3 07:08:46 CST 2017


Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
 dlls/d3d10core/tests/device.c | 14 +++++++-------
 dlls/d3d11/async.c            |  2 ++
 dlls/d3d11/device.c           |  2 ++
 dlls/d3d11/tests/d3d11.c      | 24 ++++++++++++------------
 dlls/d3d9/query.c             |  2 ++
 dlls/wined3d/query.c          |  6 +++++-
 6 files changed, 30 insertions(+), 20 deletions(-)

diff --git a/dlls/d3d10core/tests/device.c b/dlls/d3d10core/tests/device.c
index 173d59a..f9a93f2 100644
--- a/dlls/d3d10core/tests/device.c
+++ b/dlls/d3d10core/tests/device.c
@@ -3732,9 +3732,9 @@ static void test_occlusion_query(void)
     ok(data_size == sizeof(data), "Got unexpected data size %u.\n", data_size);
 
     hr = ID3D10Asynchronous_GetData(query, NULL, 0, 0);
-    todo_wine ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
+    ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
     hr = ID3D10Asynchronous_GetData(query, &data, sizeof(data), 0);
-    todo_wine ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
+    ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
 
     ID3D10Asynchronous_End(query);
     ID3D10Asynchronous_Begin(query);
@@ -3891,9 +3891,9 @@ static void test_timestamp_query(void)
     ok(data_size == sizeof(disjoint), "Got unexpected data size %u.\n", data_size);
 
     hr = ID3D10Query_GetData(timestamp_disjoint_query, NULL, 0, 0);
-    todo_wine ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
+    ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
     hr = ID3D10Query_GetData(timestamp_disjoint_query, &disjoint, sizeof(disjoint), 0);
-    todo_wine ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
+    ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
 
     /* Test a TIMESTAMP_DISJOINT query. */
     ID3D10Query_Begin(timestamp_disjoint_query);
@@ -3941,15 +3941,15 @@ static void test_timestamp_query(void)
     ok(!memcmp(&disjoint, &prev_disjoint, sizeof(disjoint)), "Disjoint data mismatch.\n");
 
     hr = ID3D10Query_GetData(timestamp_query, NULL, 0, 0);
-    todo_wine ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
+    ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
     hr = ID3D10Query_GetData(timestamp_query, &timestamp, sizeof(timestamp), 0);
-    todo_wine ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
+    ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
 
     /* Test a TIMESTAMP query inside a TIMESTAMP_DISJOINT query. */
     ID3D10Query_Begin(timestamp_disjoint_query);
 
     hr = ID3D10Query_GetData(timestamp_query, &timestamp, sizeof(timestamp), 0);
-    todo_wine ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
+    ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
 
     draw_color_quad(&test_context, &red);
 
diff --git a/dlls/d3d11/async.c b/dlls/d3d11/async.c
index dadd210..2270023 100644
--- a/dlls/d3d11/async.c
+++ b/dlls/d3d11/async.c
@@ -307,6 +307,8 @@ static HRESULT STDMETHODCALLTYPE d3d10_query_GetData(ID3D10Query *iface, void *d
     if (!data_size || wined3d_query_get_data_size(query->wined3d_query) == data_size)
     {
         hr = wined3d_query_get_data(query->wined3d_query, data, data_size, wined3d_flags);
+        if (hr == WINED3DERR_INVALIDCALL)
+            hr = DXGI_ERROR_INVALID_CALL;
     }
     else
     {
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
index 064d754..85f84fe 100644
--- a/dlls/d3d11/device.c
+++ b/dlls/d3d11/device.c
@@ -536,6 +536,8 @@ static HRESULT STDMETHODCALLTYPE d3d11_immediate_context_GetData(ID3D11DeviceCon
     if (!data_size || wined3d_query_get_data_size(query->wined3d_query) == data_size)
     {
         hr = wined3d_query_get_data(query->wined3d_query, data, data_size, wined3d_flags);
+        if (hr == WINED3DERR_INVALIDCALL)
+            hr = DXGI_ERROR_INVALID_CALL;
     }
     else
     {
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index c63a6d9..abd78c5 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -4735,10 +4735,10 @@ static void test_occlusion_query(void)
 
     memset(&data, 0xff, sizeof(data));
     hr = ID3D11DeviceContext_GetData(context, query, NULL, 0, 0);
-    todo_wine ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
+    ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
     hr = ID3D11DeviceContext_GetData(context, query, &data, sizeof(data), 0);
-    todo_wine ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
-    todo_wine ok(data.dword[0] == 0xffffffff && data.dword[1] == 0xffffffff,
+    ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
+    ok(data.dword[0] == 0xffffffff && data.dword[1] == 0xffffffff,
             "Data was modified 0x%08x%08x.\n", data.dword[1], data.dword[0]);
 
     ID3D11DeviceContext_End(context, query);
@@ -4903,11 +4903,11 @@ static void test_timestamp_query(void)
     disjoint.Frequency = 0xdeadbeef;
     disjoint.Disjoint = 0xdeadbeef;
     hr = ID3D11DeviceContext_GetData(context, timestamp_disjoint_query, NULL, 0, 0);
-    todo_wine ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
+    ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
     hr = ID3D11DeviceContext_GetData(context, timestamp_disjoint_query, &disjoint, sizeof(disjoint), 0);
-    todo_wine ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
-    todo_wine ok(disjoint.Frequency == 0xdeadbeef, "Frequency data was modified.\n");
-    todo_wine ok(disjoint.Disjoint == 0xdeadbeef, "Disjoint data was modified.\n");
+    ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
+    ok(disjoint.Frequency == 0xdeadbeef, "Frequency data was modified.\n");
+    ok(disjoint.Disjoint == 0xdeadbeef, "Disjoint data was modified.\n");
 
     /* Test a TIMESTAMP_DISJOINT query. */
     ID3D11DeviceContext_Begin(context, timestamp_disjoint_query);
@@ -4961,18 +4961,18 @@ static void test_timestamp_query(void)
 
     memset(&timestamp, 0xff, sizeof(timestamp));
     hr = ID3D11DeviceContext_GetData(context, timestamp_query, NULL, 0, 0);
-    todo_wine ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
+    ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
     hr = ID3D11DeviceContext_GetData(context, timestamp_query, &timestamp, sizeof(timestamp), 0);
-    todo_wine ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
-    todo_wine ok(timestamp == ~(UINT64)0, "Timestamp data was modified.\n");
+    ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
+    ok(timestamp == ~(UINT64)0, "Timestamp data was modified.\n");
 
     /* Test a TIMESTAMP query inside a TIMESTAMP_DISJOINT query. */
     ID3D11DeviceContext_Begin(context, timestamp_disjoint_query);
 
     memset(&timestamp, 0xff, sizeof(timestamp));
     hr = ID3D11DeviceContext_GetData(context, timestamp_query, &timestamp, sizeof(timestamp), 0);
-    todo_wine ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
-    todo_wine ok(timestamp == ~(UINT64)0, "Timestamp data was modified.\n");
+    ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
+    ok(timestamp == ~(UINT64)0, "Timestamp data was modified.\n");
 
     draw_color_quad(&test_context, &red);
 
diff --git a/dlls/d3d9/query.c b/dlls/d3d9/query.c
index d41783a..ba66058 100644
--- a/dlls/d3d9/query.c
+++ b/dlls/d3d9/query.c
@@ -167,6 +167,8 @@ static HRESULT WINAPI d3d9_query_GetData(IDirect3DQuery9 *iface, void *data, DWO
     }
     wined3d_mutex_unlock();
 
+    if (hr == D3DERR_INVALIDCALL)
+        return S_OK;
     return hr;
 }
 
diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c
index 9f75a49..ef88f65 100644
--- a/dlls/wined3d/query.c
+++ b/dlls/wined3d/query.c
@@ -330,8 +330,12 @@ HRESULT CDECL wined3d_query_get_data(struct wined3d_query *query,
     }
 
     if (query->state == QUERY_CREATED)
+    {
         WARN("Query wasn't started yet.\n");
-    else if (!query->query_ops->query_poll(query, flags))
+        return WINED3DERR_INVALIDCALL;
+    }
+
+    if (!query->query_ops->query_poll(query, flags))
         return S_FALSE;
 
     if (data)
-- 
2.10.2




More information about the wine-patches mailing list