wined3d: Avoid creating event queries manually.

Fixes a regression introduced by commit
be20ddc38b.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2017-07-09 13:25:47 +02:00 committed by Alexandre Julliard
parent aaaac6ffec
commit 0edb71a35f
3 changed files with 10 additions and 8 deletions

View File

@ -815,6 +815,8 @@ void * CDECL wined3d_buffer_get_parent(const struct wined3d_buffer *buffer)
static void buffer_sync_apple(struct wined3d_buffer *This, DWORD flags, const struct wined3d_gl_info *gl_info)
{
enum wined3d_event_query_result ret;
struct wined3d_query *query;
HRESULT hr;
/* No fencing needs to be done if the app promises not to overwrite
* existing data. */
@ -830,20 +832,21 @@ static void buffer_sync_apple(struct wined3d_buffer *This, DWORD flags, const st
if (!This->query)
{
TRACE("Creating event query for buffer %p\n", This);
TRACE("Creating event query for buffer %p.\n", This);
if (!wined3d_event_query_supported(gl_info))
hr = wined3d_query_create(This->resource.device, WINED3D_QUERY_TYPE_EVENT,
NULL, &wined3d_null_parent_ops, &query);
if (hr == WINED3DERR_NOTAVAILABLE)
{
FIXME("Event queries not supported, dropping async buffer locks.\n");
goto drop_query;
}
This->query = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*This->query));
if (!This->query)
if (FAILED(hr))
{
ERR("Failed to allocate event query memory, dropping async buffer locks.\n");
ERR("Failed to create event query, hr %#x.\n", hr);
goto drop_query;
}
This->query = CONTAINING_RECORD(query, struct wined3d_event_query, query);
/* Since we don't know about old draws a glFinish is needed once */
gl_info->gl_ops.gl.p_glFinish();

View File

@ -83,7 +83,7 @@ static struct wined3d_pipeline_statistics_query *wined3d_pipeline_statistics_que
return CONTAINING_RECORD(query, struct wined3d_pipeline_statistics_query, query);
}
BOOL wined3d_event_query_supported(const struct wined3d_gl_info *gl_info)
static BOOL wined3d_event_query_supported(const struct wined3d_gl_info *gl_info)
{
return gl_info->supported[ARB_SYNC] || gl_info->supported[NV_FENCE] || gl_info->supported[APPLE_FENCE];
}

View File

@ -1669,7 +1669,6 @@ enum wined3d_event_query_result
enum wined3d_event_query_result wined3d_event_query_finish(const struct wined3d_event_query *query,
const struct wined3d_device *device) DECLSPEC_HIDDEN;
void wined3d_event_query_issue(struct wined3d_event_query *query, const struct wined3d_device *device) DECLSPEC_HIDDEN;
BOOL wined3d_event_query_supported(const struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN;
struct wined3d_occlusion_query
{