wined3d: Reference vertex buffer objects only after calling context_update_stream_info().

It may load buffers into a different location.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2021-11-08 16:34:40 -06:00 committed by Alexandre Julliard
parent 3ebafc805f
commit 613e163877
1 changed files with 12 additions and 1 deletions

View File

@ -3963,12 +3963,23 @@ static BOOL context_apply_draw_state(struct wined3d_context *context,
device_invalidate_state(device, STATE_STREAMSRC);
else
wined3d_buffer_load(&buffer_gl->b, context, state);
wined3d_context_gl_reference_bo(context_gl, &buffer_gl->bo);
}
/* Loading the buffers above may have invalidated the stream info. */
if (wined3d_context_is_graphics_state_dirty(context, STATE_STREAMSRC))
context_update_stream_info(context, state);
map = context->stream_info.use_map;
while (map)
{
const struct wined3d_stream_info_element *e;
struct wined3d_buffer_gl *buffer_gl;
e = &context->stream_info.elements[wined3d_bit_scan(&map)];
buffer_gl = wined3d_buffer_gl(state->streams[e->stream_idx].buffer);
wined3d_context_gl_reference_bo(context_gl, &buffer_gl->bo);
}
if (indexed && state->index_buffer)
{
struct wined3d_buffer_gl *buffer_gl = wined3d_buffer_gl(state->index_buffer);