Module: wine Branch: master Commit: 68339456a8f7543ae46ac504c2ce7f4f0221a789 URL: http://source.winehq.org/git/wine.git/?a=commit;h=68339456a8f7543ae46ac504c2...
Author: Henri Verbeet hverbeet@codeweavers.com Date: Mon Jul 14 10:04:21 2014 +0200
wined3d: Always mark vertex buffers as used in context_apply_draw_state().
The issue this solves is that buffer_internal_preload() is only called when STATE_VDECL or STATE_STREAMSRC is invalidated, but that doesn't happen for regular buffer maps. We'd like to be able to just call buffer_internal_preload() here, but buffer_internal_preload() has dependencies on context_stream_info_from_declaration() and vice versa.
---
dlls/wined3d/buffer.c | 7 ++++++- dlls/wined3d/context.c | 11 +++++++++++ dlls/wined3d/wined3d_private.h | 1 + 3 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c index fbbe398..901382c 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c @@ -721,6 +721,11 @@ static void buffer_direct_upload(struct wined3d_buffer *This, const struct wined checkGLcall("glUnmapBufferARB"); }
+void buffer_mark_used(struct wined3d_buffer *buffer) +{ + buffer->flags &= ~(WINED3D_BUFFER_NOSYNC | WINED3D_BUFFER_DISCARD); +} + /* Context activation is done by the caller. */ void buffer_internal_preload(struct wined3d_buffer *buffer, struct wined3d_context *context, const struct wined3d_state *state) @@ -741,7 +746,7 @@ void buffer_internal_preload(struct wined3d_buffer *buffer, struct wined3d_conte return; }
- buffer->flags &= ~(WINED3D_BUFFER_NOSYNC | WINED3D_BUFFER_DISCARD); + buffer_mark_used(buffer);
if (!buffer->buffer_object) { diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c index 32cc191..e8423f4 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c @@ -2958,6 +2958,7 @@ BOOL context_apply_draw_state(struct wined3d_context *context, struct wined3d_de const struct StateEntry *state_table = context->state_table; const struct wined3d_fb_state *fb = state->fb; unsigned int i; + WORD map;
if (!context_validate_rt_config(context->gl_info->limits.buffers, fb->render_targets, fb->depth_stencil)) @@ -2974,7 +2975,17 @@ BOOL context_apply_draw_state(struct wined3d_context *context, struct wined3d_de context_update_tex_unit_map(context, state); context_preload_textures(context, state); if (isStateDirty(context, STATE_VDECL) || isStateDirty(context, STATE_STREAMSRC)) + { context_update_stream_info(context, state); + } + else + { + for (i = 0, map = context->stream_info.use_map; map; map >>= 1, ++i) + { + if (map & 1) + buffer_mark_used(state->streams[context->stream_info.elements[i].stream_idx].buffer); + } + } if (state->index_buffer) { if (context->stream_info.all_vbo) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 8f411cd..0c11528 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2590,6 +2590,7 @@ void buffer_get_memory(struct wined3d_buffer *buffer, struct wined3d_context *co BYTE *buffer_get_sysmem(struct wined3d_buffer *This, struct wined3d_context *context) DECLSPEC_HIDDEN; void buffer_internal_preload(struct wined3d_buffer *buffer, struct wined3d_context *context, const struct wined3d_state *state) DECLSPEC_HIDDEN; +void buffer_mark_used(struct wined3d_buffer *buffer) DECLSPEC_HIDDEN;
struct wined3d_rendertarget_view {