Commit 68339456 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

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.
parent 3013b6c6
......@@ -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)
{
......
......@@ -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)
......
......@@ -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
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment