=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: wined3d: Avoid creating event queries manually.

Alexandre Julliard julliard at winehq.org
Mon Jul 10 15:52:46 CDT 2017


Module: wine
Branch: master
Commit: 0edb71a35ffe00450b315a735b9853bd2d982e77
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=0edb71a35ffe00450b315a735b9853bd2d982e77

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Sun Jul  9 13:25:47 2017 +0200

wined3d: Avoid creating event queries manually.

Fixes a regression introduced by commit
be20ddc38b3f9e101460f5f8f04015b148d3e13d.

Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 5740d65..9cd74fa 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 8445922..e76011c 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 1025c98..d687e78 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
 {




More information about the wine-cvs mailing list