Henri Verbeet : wined3d: Allow OpenGL vertex buffer objects to be suballocated from a larger BO.

Alexandre Julliard julliard at winehq.org
Fri Nov 19 15:45:32 CST 2021


Module: wine
Branch: master
Commit: a9584bf5218d67e64f7c2bbf30d2e6b588a6246c
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=a9584bf5218d67e64f7c2bbf30d2e6b588a6246c

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Thu Nov 18 21:06:17 2021 -0600

wined3d: Allow OpenGL vertex buffer objects to be suballocated from a larger BO.

Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wined3d/context_gl.c      | 7 ++++++-
 dlls/wined3d/wined3d_private.h | 1 +
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/dlls/wined3d/context_gl.c b/dlls/wined3d/context_gl.c
index cec698d7a6b..3868351a4b3 100644
--- a/dlls/wined3d/context_gl.c
+++ b/dlls/wined3d/context_gl.c
@@ -2922,6 +2922,7 @@ bool wined3d_context_gl_create_bo(struct wined3d_context_gl *context_gl, GLsizei
     list_init(&bo->b.users);
     bo->command_fence_id = 0;
     bo->b.memory_offset = 0;
+    bo->buffer_offset = 0;
     bo->b.map_ptr = NULL;
 
     return true;
@@ -5070,7 +5071,11 @@ void wined3d_context_gl_unload_tex_coords(const struct wined3d_context_gl *conte
 static const void *get_vertex_attrib_pointer(const struct wined3d_stream_info_element *element,
         const struct wined3d_state *state)
 {
-    return element->data.addr + state->load_base_vertex_index * element->stride;
+    const uint8_t *offset = element->data.addr + state->load_base_vertex_index * element->stride;
+
+    if (element->data.buffer_object)
+        offset += wined3d_bo_gl(element->data.buffer_object)->buffer_offset;
+    return offset;
 }
 
 void wined3d_context_gl_load_tex_coords(const struct wined3d_context_gl *context_gl,
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 90824d83290..79b02c2448d 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1606,6 +1606,7 @@ struct wined3d_bo_gl
     struct wined3d_bo b;
 
     GLuint id;
+    GLsizeiptr buffer_offset;
     GLsizeiptr size;
     GLenum binding;
     GLenum usage;




More information about the wine-cvs mailing list