Commit 8d6af6d9 authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

wined3d: Return WINED3DERR_INVALIDCALL for not started queries.

parent dcd7d336
......@@ -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);
......
......@@ -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
{
......
......@@ -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
{
......
......@@ -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);
......
......@@ -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;
}
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment