From 0edb71a35ffe00450b315a735b9853bd2d982e77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Sun, 9 Jul 2017 13:25:47 +0200 Subject: [PATCH] wined3d: Avoid creating event queries manually. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes a regression introduced by commit be20ddc38b3f9e101460f5f8f04015b148d3e13d. Signed-off-by: Józef Kucia Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/wined3d/buffer.c | 15 +++++++++------ dlls/wined3d/query.c | 2 +- dlls/wined3d/wined3d_private.h | 1 - 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c index 5740d65bc49..9cd74fa2540 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c @@ -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(); diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c index 8445922423f..e76011ce2cf 100644 --- a/dlls/wined3d/query.c +++ b/dlls/wined3d/query.c @@ -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]; } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 1025c98f180..d687e780eaa 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -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 {