[PATCH 5/5] wined3d: Introduce a context function to bind a buffer object.

Henri Verbeet hverbeet at codeweavers.com
Wed Apr 19 16:40:53 CDT 2017


Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
---
 dlls/wined3d/buffer.c          |  7 +------
 dlls/wined3d/context.c         | 10 ++++++++++
 dlls/wined3d/wined3d_private.h |  1 +
 3 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index 52cdc67..6e1ecb0 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -135,12 +135,7 @@ void wined3d_buffer_invalidate_location(struct wined3d_buffer *buffer, DWORD loc
 /* Context activation is done by the caller. */
 static void buffer_bind(struct wined3d_buffer *buffer, struct wined3d_context *context)
 {
-    const struct wined3d_gl_info *gl_info = context->gl_info;
-
-    if (buffer->buffer_type_hint == GL_ELEMENT_ARRAY_BUFFER)
-        context_invalidate_state(context, STATE_INDEXBUFFER);
-
-    GL_EXTCALL(glBindBuffer(buffer->buffer_type_hint, buffer->buffer_object));
+    context_bind_bo(context, buffer->buffer_type_hint, buffer->buffer_object);
 }
 
 /* Context activation is done by the caller. */
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 4d1c2a8..3e5e1d0 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -2510,6 +2510,16 @@ void context_active_texture(struct wined3d_context *context, const struct wined3
     context->active_texture = unit;
 }
 
+void context_bind_bo(struct wined3d_context *context, GLenum binding, GLuint name)
+{
+    const struct wined3d_gl_info *gl_info = context->gl_info;
+
+    if (binding == GL_ELEMENT_ARRAY_BUFFER)
+        context_invalidate_state(context, STATE_INDEXBUFFER);
+
+    GL_EXTCALL(glBindBuffer(binding, name));
+}
+
 void context_bind_texture(struct wined3d_context *context, GLenum target, GLuint name)
 {
     const struct wined3d_gl_info *gl_info = context->gl_info;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 578060a..b5d2907 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1945,6 +1945,7 @@ void context_apply_fbo_state_blit(struct wined3d_context *context, GLenum target
         struct wined3d_surface *render_target, struct wined3d_surface *depth_stencil, DWORD location) DECLSPEC_HIDDEN;
 void context_active_texture(struct wined3d_context *context, const struct wined3d_gl_info *gl_info,
         unsigned int unit) DECLSPEC_HIDDEN;
+void context_bind_bo(struct wined3d_context *context, GLenum binding, GLuint name) DECLSPEC_HIDDEN;
 void context_bind_dummy_textures(const struct wined3d_device *device,
         const struct wined3d_context *context) DECLSPEC_HIDDEN;
 void context_bind_texture(struct wined3d_context *context, GLenum target, GLuint name) DECLSPEC_HIDDEN;
-- 
2.1.4




More information about the wine-patches mailing list