Henri Verbeet : wined3d: Store texture sub-resource buffer objects as uintptr_t.

Alexandre Julliard julliard at winehq.org
Tue Dec 3 16:13:12 CST 2019


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

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Tue Dec  3 20:23:58 2019 +0330

wined3d: Store texture sub-resource buffer objects as uintptr_t.

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

---

 dlls/wined3d/texture.c         | 17 ++++++++++-------
 dlls/wined3d/wined3d_private.h |  2 +-
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 976235bf60..260a048630 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -477,13 +477,15 @@ void wined3d_texture_get_memory(struct wined3d_texture *texture, unsigned int su
 static void wined3d_texture_remove_buffer_object(struct wined3d_texture *texture,
         unsigned int sub_resource_idx, const struct wined3d_gl_info *gl_info)
 {
-    GLuint *buffer_object = &texture->sub_resources[sub_resource_idx].buffer_object;
+    uintptr_t *buffer_object = &texture->sub_resources[sub_resource_idx].buffer_object;
+    GLuint bo;
 
-    GL_EXTCALL(glDeleteBuffers(1, buffer_object));
+    bo = *buffer_object;
+    GL_EXTCALL(glDeleteBuffers(1, &bo));
     checkGLcall("glDeleteBuffers");
 
     TRACE("Deleted buffer object %u for texture %p, sub-resource %u.\n",
-            *buffer_object, texture, sub_resource_idx);
+            bo, texture, sub_resource_idx);
 
     wined3d_texture_invalidate_location(texture, sub_resource_idx, WINED3D_LOCATION_BUFFER);
     *buffer_object = 0;
@@ -1670,19 +1672,20 @@ static void wined3d_texture_prepare_buffer_object(struct wined3d_texture *textur
         unsigned int sub_resource_idx, const struct wined3d_gl_info *gl_info)
 {
     struct wined3d_texture_sub_resource *sub_resource;
+    GLuint bo;
 
     sub_resource = &texture->sub_resources[sub_resource_idx];
     if (sub_resource->buffer_object)
         return;
 
-    GL_EXTCALL(glGenBuffers(1, &sub_resource->buffer_object));
-    GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, sub_resource->buffer_object));
+    GL_EXTCALL(glGenBuffers(1, &bo));
+    GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, bo));
     GL_EXTCALL(glBufferData(GL_PIXEL_UNPACK_BUFFER, sub_resource->size, NULL, GL_STREAM_DRAW));
     GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0));
     checkGLcall("Create buffer object");
 
-    TRACE("Created buffer object %u for texture %p, sub-resource %u.\n",
-            sub_resource->buffer_object, texture, sub_resource_idx);
+    sub_resource->buffer_object = bo;
+    TRACE("Created buffer object %u for texture %p, sub-resource %u.\n", bo, texture, sub_resource_idx);
 }
 
 static void wined3d_texture_force_reload(struct wined3d_texture *texture)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index b33cd09c08..0fc633ad4a 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3563,7 +3563,7 @@ struct wined3d_texture
         unsigned int map_count;
         uint32_t map_flags;
         DWORD locations;
-        GLuint buffer_object;
+        uintptr_t buffer_object;
     } *sub_resources;
 };
 




More information about the wine-cvs mailing list