[PATCH 3/5] wined3d: Make the adapter responsible for flushes.

Henri Verbeet hverbeet at codeweavers.com
Thu Aug 15 04:50:01 CDT 2019


Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
---
 dlls/wined3d/adapter_gl.c      | 11 +++++++++++
 dlls/wined3d/adapter_vk.c      |  6 ++++++
 dlls/wined3d/cs.c              |  9 ++++-----
 dlls/wined3d/directx.c         |  6 ++++++
 dlls/wined3d/wined3d_private.h |  1 +
 5 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/dlls/wined3d/adapter_gl.c b/dlls/wined3d/adapter_gl.c
index 65372169b16..61bdc8acd3c 100644
--- a/dlls/wined3d/adapter_gl.c
+++ b/dlls/wined3d/adapter_gl.c
@@ -5105,6 +5105,16 @@ static void adapter_gl_destroy_query(struct wined3d_query *query)
     wined3d_cs_destroy_object(query->device->cs, wined3d_query_gl_destroy_object, query);
 }
 
+static void adapter_gl_flush_context(struct wined3d_context *context)
+{
+    struct wined3d_context_gl *context_gl = wined3d_context_gl(context);
+
+    TRACE("context_gl %p.\n", context_gl);
+
+    if (context_gl->valid)
+        context_gl->gl_info->gl_ops.gl.p_glFlush();
+}
+
 static const struct wined3d_adapter_ops wined3d_adapter_gl_ops =
 {
     adapter_gl_destroy,
@@ -5132,6 +5142,7 @@ static const struct wined3d_adapter_ops wined3d_adapter_gl_ops =
     adapter_gl_destroy_sampler,
     adapter_gl_create_query,
     adapter_gl_destroy_query,
+    adapter_gl_flush_context,
 };
 
 static BOOL wined3d_adapter_gl_init(struct wined3d_adapter_gl *adapter_gl,
diff --git a/dlls/wined3d/adapter_vk.c b/dlls/wined3d/adapter_vk.c
index 4e79a7afb6b..bb98810fd5d 100644
--- a/dlls/wined3d/adapter_vk.c
+++ b/dlls/wined3d/adapter_vk.c
@@ -773,6 +773,11 @@ static void adapter_vk_destroy_query(struct wined3d_query *query)
     TRACE("query %p.\n", query);
 }
 
+static void adapter_vk_flush_context(struct wined3d_context *context)
+{
+    TRACE("context %p.\n", context);
+}
+
 static const struct wined3d_adapter_ops wined3d_adapter_vk_ops =
 {
     adapter_vk_destroy,
@@ -800,6 +805,7 @@ static const struct wined3d_adapter_ops wined3d_adapter_vk_ops =
     adapter_vk_destroy_sampler,
     adapter_vk_create_query,
     adapter_vk_destroy_query,
+    adapter_vk_flush_context,
 };
 
 static unsigned int wined3d_get_wine_vk_version(void)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index a076253ce1b..32f9954a039 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -1008,12 +1008,11 @@ void wined3d_cs_emit_draw_indirect(struct wined3d_cs *cs, GLenum primitive_type,
 
 static void wined3d_cs_exec_flush(struct wined3d_cs *cs, const void *data)
 {
-    struct wined3d_context_gl *context_gl;
+    struct wined3d_context *context;
 
-    context_gl = wined3d_context_gl(context_acquire(cs->device, NULL, 0));
-    if (context_gl->valid)
-        context_gl->gl_info->gl_ops.gl.p_glFlush();
-    context_release(&context_gl->c);
+    context = context_acquire(cs->device, NULL, 0);
+    cs->device->adapter->adapter_ops->adapter_flush_context(context);
+    context_release(context);
 }
 
 void wined3d_cs_emit_flush(struct wined3d_cs *cs)
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 17c5181222b..ecff67dfba7 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -2582,6 +2582,11 @@ static void adapter_no3d_destroy_query(struct wined3d_query *query)
     TRACE("query %p.\n", query);
 }
 
+static void adapter_no3d_flush_context(struct wined3d_context *context)
+{
+    TRACE("context %p.\n", context);
+}
+
 static const struct wined3d_adapter_ops wined3d_adapter_no3d_ops =
 {
     adapter_no3d_destroy,
@@ -2609,6 +2614,7 @@ static const struct wined3d_adapter_ops wined3d_adapter_no3d_ops =
     adapter_no3d_destroy_sampler,
     adapter_no3d_create_query,
     adapter_no3d_destroy_query,
+    adapter_no3d_flush_context,
 };
 
 static void wined3d_adapter_no3d_init_d3d_info(struct wined3d_adapter *adapter, unsigned int wined3d_creation_flags)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 07ac9824010..3446a848bb7 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2816,6 +2816,7 @@ struct wined3d_adapter_ops
     HRESULT (*adapter_create_query)(struct wined3d_device *device, enum wined3d_query_type type,
             void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_query **query);
     void (*adapter_destroy_query)(struct wined3d_query *query);
+    void (*adapter_flush_context)(struct wined3d_context *context);
 };
 
 /* The adapter structure */
-- 
2.11.0




More information about the wine-devel mailing list