[PATCH 1/5] wined3d: Pass a wined3d_adapter_gl structure to wined3d_adapter_gl_init().

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[PATCH 1/5] wined3d: Pass a wined3d_adapter_gl structure to wined3d_adapter_gl_init().

Henri Verbeet-2
Signed-off-by: Henri Verbeet <[hidden email]>
---
 dlls/wined3d/adapter_gl.c | 29 +++++++++++++----------------
 1 file changed, 13 insertions(+), 16 deletions(-)

diff --git a/dlls/wined3d/adapter_gl.c b/dlls/wined3d/adapter_gl.c
index 36c29c9a7f5..d8414204ea0 100644
--- a/dlls/wined3d/adapter_gl.c
+++ b/dlls/wined3d/adapter_gl.c
@@ -4554,7 +4554,7 @@ static const struct wined3d_adapter_ops wined3d_adapter_gl_ops =
     adapter_gl_check_format,
 };
 
-static BOOL wined3d_adapter_gl_init(struct wined3d_adapter *adapter,
+static BOOL wined3d_adapter_gl_init(struct wined3d_adapter_gl *adapter_gl,
         unsigned int ordinal, unsigned int wined3d_creation_flags)
 {
     static const DWORD supported_gl_versions[] =
@@ -4563,19 +4563,16 @@ static BOOL wined3d_adapter_gl_init(struct wined3d_adapter *adapter,
         MAKEDWORD_VERSION(3, 2),
         MAKEDWORD_VERSION(1, 0),
     };
-    struct wined3d_gl_info *gl_info = &adapter->gl_info;
+    struct wined3d_gl_info *gl_info = &adapter_gl->a.gl_info;
     struct wined3d_caps_gl_ctx caps_gl_ctx = {0};
-    struct wined3d_adapter_gl *adapter_gl;
     unsigned int i;
 
-    TRACE("adapter %p, ordinal %u, wined3d_creation_flags %#x.\n",
-            adapter, ordinal, wined3d_creation_flags);
+    TRACE("adapter_gl %p, ordinal %u, wined3d_creation_flags %#x.\n",
+            adapter_gl, ordinal, wined3d_creation_flags);
 
-    if (!wined3d_adapter_init(adapter, ordinal))
+    if (!wined3d_adapter_init(&adapter_gl->a, ordinal))
         return FALSE;
 
-    adapter_gl = wined3d_adapter_gl(adapter);
-
     /* Dynamically load all GL core functions */
 #ifdef USE_WIN32_OPENGL
     {
@@ -4601,9 +4598,9 @@ static BOOL wined3d_adapter_gl_init(struct wined3d_adapter *adapter,
     glEnableWINE = gl_info->gl_ops.gl.p_glEnable;
     glDisableWINE = gl_info->gl_ops.gl.p_glDisable;
 
-    if (!wined3d_caps_gl_ctx_create(adapter, &caps_gl_ctx))
+    if (!wined3d_caps_gl_ctx_create(&adapter_gl->a, &caps_gl_ctx))
     {
-        ERR("Failed to get a GL context for adapter %p.\n", adapter);
+        ERR("Failed to get a GL context for adapter %p.\n", adapter_gl);
         return FALSE;
     }
 
@@ -4630,9 +4627,9 @@ static BOOL wined3d_adapter_gl_init(struct wined3d_adapter *adapter,
                 supported_gl_versions[i] >> 16, supported_gl_versions[i] & 0xffff);
     }
 
-    if (!wined3d_adapter_init_gl_caps(adapter, &caps_gl_ctx, wined3d_creation_flags))
+    if (!wined3d_adapter_init_gl_caps(&adapter_gl->a, &caps_gl_ctx, wined3d_creation_flags))
     {
-        ERR("Failed to initialize GL caps for adapter %p.\n", adapter);
+        ERR("Failed to initialize GL caps for adapter %p.\n", adapter_gl);
         wined3d_caps_gl_ctx_destroy(&caps_gl_ctx);
         return FALSE;
     }
@@ -4652,7 +4649,7 @@ static BOOL wined3d_adapter_gl_init(struct wined3d_adapter *adapter,
         return FALSE;
     }
 
-    if (!wined3d_adapter_gl_init_format_info(adapter, &caps_gl_ctx))
+    if (!wined3d_adapter_gl_init_format_info(&adapter_gl->a, &caps_gl_ctx))
     {
         ERR("Failed to initialize GL format info.\n");
         wined3d_caps_gl_ctx_destroy(&caps_gl_ctx);
@@ -4662,8 +4659,8 @@ static BOOL wined3d_adapter_gl_init(struct wined3d_adapter *adapter,
 
     wined3d_caps_gl_ctx_destroy(&caps_gl_ctx);
 
-    wined3d_adapter_init_ffp_attrib_ops(adapter);
-    adapter->adapter_ops = &wined3d_adapter_gl_ops;
+    wined3d_adapter_init_ffp_attrib_ops(&adapter_gl->a);
+    adapter_gl->a.adapter_ops = &wined3d_adapter_gl_ops;
 
     return TRUE;
 }
@@ -4675,7 +4672,7 @@ struct wined3d_adapter *wined3d_adapter_gl_create(unsigned int ordinal, unsigned
     if (!(adapter = heap_alloc_zero(sizeof(*adapter))))
         return NULL;
 
-    if (!wined3d_adapter_gl_init(&adapter->a, ordinal, wined3d_creation_flags))
+    if (!wined3d_adapter_gl_init(adapter, ordinal, wined3d_creation_flags))
     {
         heap_free(adapter);
         return NULL;
--
2.11.0