[PATCH 1/5] wined3d: Move the "texture_type" field from struct wined3d_context to struct wined3d_context_gl.

Henri Verbeet hverbeet at codeweavers.com
Wed May 8 08:21:34 CDT 2019


Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
---
 dlls/wined3d/context.c         | 22 +++++++++++-----------
 dlls/wined3d/wined3d_private.h |  3 ++-
 2 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 9aa78f591a7..1a45ecad554 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -1478,12 +1478,12 @@ void wined3d_context_cleanup(struct wined3d_context *context)
         DWORD err = GetLastError();
         ERR("wglDeleteContext(%p) failed, last error %#x.\n", context->glCtx, err);
     }
-
-    heap_free(context->texture_type);
 }
 
 void wined3d_context_gl_cleanup(struct wined3d_context_gl *context_gl)
 {
+    heap_free(context_gl->texture_type);
+
     wined3d_context_cleanup(&context_gl->c);
 }
 
@@ -2009,8 +2009,8 @@ HRESULT wined3d_context_gl_init(struct wined3d_context_gl *context_gl, struct wi
         }
     }
 
-    if (!(context->texture_type = heap_calloc(gl_info->limits.combined_samplers,
-            sizeof(*context->texture_type))))
+    if (!(context_gl->texture_type = heap_calloc(gl_info->limits.combined_samplers,
+            sizeof(*context_gl->texture_type))))
         return E_FAIL;
 
     target = &context->current_rt.texture->resource;
@@ -2093,7 +2093,7 @@ HRESULT wined3d_context_gl_init(struct wined3d_context_gl *context_gl, struct wi
     {
         ERR("Failed to set pixel format %d on device context %p.\n", context->pixel_format, context->hdc);
         context_release(context);
-        heap_free(context->texture_type);
+        heap_free(context_gl->texture_type);
         return E_FAIL;
     }
 
@@ -2103,7 +2103,7 @@ HRESULT wined3d_context_gl_init(struct wined3d_context_gl *context_gl, struct wi
         if (!(ctx = context_create_wgl_attribs(gl_info, context->hdc, share_ctx)))
         {
             context_release(context);
-            heap_free(context->texture_type);
+            heap_free(context_gl->texture_type);
             return E_FAIL;
         }
     }
@@ -2113,7 +2113,7 @@ HRESULT wined3d_context_gl_init(struct wined3d_context_gl *context_gl, struct wi
         {
             ERR("Failed to create a WGL context.\n");
             context_release(context);
-            heap_free(context->texture_type);
+            heap_free(context_gl->texture_type);
             return E_FAIL;
         }
 
@@ -2123,7 +2123,7 @@ HRESULT wined3d_context_gl_init(struct wined3d_context_gl *context_gl, struct wi
             context_release(context);
             if (!wglDeleteContext(ctx))
                 ERR("wglDeleteContext(%p) failed, last error %#x.\n", ctx, GetLastError());
-            heap_free(context->texture_type);
+            heap_free(context_gl->texture_type);
             return E_FAIL;
         }
     }
@@ -2143,7 +2143,7 @@ HRESULT wined3d_context_gl_init(struct wined3d_context_gl *context_gl, struct wi
         context_release(context);
         if (!wglDeleteContext(ctx))
             ERR("wglDeleteContext(%p) failed, last error %#x.\n", ctx, GetLastError());
-        heap_free(context->texture_type);
+        heap_free(context_gl->texture_type);
         return E_FAIL;
     }
 
@@ -2541,7 +2541,7 @@ void wined3d_context_gl_bind_texture(struct wined3d_context_gl *context_gl, GLen
         target = GL_NONE;
 
     unit = context_gl->c.active_texture;
-    old_texture_type = context_gl->c.texture_type[unit];
+    old_texture_type = context_gl->texture_type[unit];
     if (old_texture_type != target)
     {
         switch (old_texture_type)
@@ -2586,7 +2586,7 @@ void wined3d_context_gl_bind_texture(struct wined3d_context_gl *context_gl, GLen
                 ERR("Unexpected texture target %#x.\n", old_texture_type);
         }
 
-        context_gl->c.texture_type[unit] = target;
+        context_gl->texture_type[unit] = target;
     }
 
     checkGLcall("bind texture");
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 03c6977d7f8..b8edf684cc5 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1954,7 +1954,6 @@ struct wined3d_context
     UINT                    blit_w, blit_h;
     enum fogsource          fog_source;
     DWORD active_texture;
-    DWORD *texture_type;
 
     UINT instance_count;
 
@@ -2038,6 +2037,8 @@ HRESULT wined3d_context_no3d_init(struct wined3d_context *context_no3d,
 struct wined3d_context_gl
 {
     struct wined3d_context c;
+
+    GLenum *texture_type;
 };
 
 static inline struct wined3d_context_gl *wined3d_context_gl(struct wined3d_context *context)
-- 
2.11.0




More information about the wine-devel mailing list