[PATCH 2/5] wined3d: Handle "namedArraysLoaded" in context_unload_vertex_data().

Henri Verbeet hverbeet at codeweavers.com
Thu Apr 19 06:20:13 CDT 2018


Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
---
 dlls/wined3d/context.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index d3e6e41229c..6ec498d29ae 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -5058,18 +5058,20 @@ void context_load_tex_coords(const struct wined3d_context *context, const struct
     checkGLcall("loadTexCoords");
 }
 
-/* This should match any arrays loaded in context_load_vertex_data().
- * TODO: Only load/unload arrays if we have to. */
-static void context_unload_vertex_data(const struct wined3d_context *context)
+/* This should match any arrays loaded in context_load_vertex_data(). */
+static void context_unload_vertex_data(struct wined3d_context *context)
 {
     const struct wined3d_gl_info *gl_info = context->gl_info;
 
+    if (!context->namedArraysLoaded)
+        return;
     gl_info->gl_ops.gl.p_glDisableClientState(GL_VERTEX_ARRAY);
     gl_info->gl_ops.gl.p_glDisableClientState(GL_NORMAL_ARRAY);
     gl_info->gl_ops.gl.p_glDisableClientState(GL_COLOR_ARRAY);
     if (gl_info->supported[EXT_SECONDARY_COLOR])
         gl_info->gl_ops.gl.p_glDisableClientState(GL_SECONDARY_COLOR_ARRAY_EXT);
     context_unload_tex_coords(context);
+    context->namedArraysLoaded = FALSE;
 }
 
 static void context_load_vertex_data(struct wined3d_context *context,
@@ -5489,10 +5491,9 @@ void context_update_stream_sources(struct wined3d_context *context, const struct
         context_unload_numbered_arrays(context);
         context->numbered_array_mask = 0;
     }
-    else if (context->namedArraysLoaded)
+    else
     {
         context_unload_vertex_data(context);
-        context->namedArraysLoaded = FALSE;
     }
 
     if (load_numbered)
-- 
2.11.0




More information about the wine-devel mailing list