wined3d: Handle "namedArraysLoaded" in context_unload_vertex_data().

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2018-04-19 15:50:13 +04:30 committed by Alexandre Julliard
parent 437861f1dc
commit 8dc789fe3b
1 changed files with 6 additions and 5 deletions

View File

@ -5058,18 +5058,20 @@ void context_load_tex_coords(const struct wined3d_context *context, const struct
checkGLcall("loadTexCoords"); checkGLcall("loadTexCoords");
} }
/* This should match any arrays loaded in context_load_vertex_data(). /* 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(struct wined3d_context *context)
static void context_unload_vertex_data(const struct wined3d_context *context)
{ {
const struct wined3d_gl_info *gl_info = context->gl_info; 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_VERTEX_ARRAY);
gl_info->gl_ops.gl.p_glDisableClientState(GL_NORMAL_ARRAY); gl_info->gl_ops.gl.p_glDisableClientState(GL_NORMAL_ARRAY);
gl_info->gl_ops.gl.p_glDisableClientState(GL_COLOR_ARRAY); gl_info->gl_ops.gl.p_glDisableClientState(GL_COLOR_ARRAY);
if (gl_info->supported[EXT_SECONDARY_COLOR]) if (gl_info->supported[EXT_SECONDARY_COLOR])
gl_info->gl_ops.gl.p_glDisableClientState(GL_SECONDARY_COLOR_ARRAY_EXT); gl_info->gl_ops.gl.p_glDisableClientState(GL_SECONDARY_COLOR_ARRAY_EXT);
context_unload_tex_coords(context); context_unload_tex_coords(context);
context->namedArraysLoaded = FALSE;
} }
static void context_load_vertex_data(struct wined3d_context *context, 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_unload_numbered_arrays(context);
context->numbered_array_mask = 0; context->numbered_array_mask = 0;
} }
else if (context->namedArraysLoaded) else
{ {
context_unload_vertex_data(context); context_unload_vertex_data(context);
context->namedArraysLoaded = FALSE;
} }
if (load_numbered) if (load_numbered)