[PATCH v2 1/6] wined3d: Reference vertex buffer objects only after calling context_update_stream_info().

Zebediah Figura zfigura at codeweavers.com
Tue Nov 9 11:36:02 CST 2021


It may load buffers into a different location.

Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
v2: No changes.

 dlls/wined3d/context_gl.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/dlls/wined3d/context_gl.c b/dlls/wined3d/context_gl.c
index d2dd9e0bd09..09c871efcd4 100644
--- a/dlls/wined3d/context_gl.c
+++ b/dlls/wined3d/context_gl.c
@@ -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);
-- 
2.33.0




More information about the wine-devel mailing list