[PATCH 3/5] wined3d: Store texture sub-resource buffer objects as uintptr_t.

Henri Verbeet hverbeet at codeweavers.com
Tue Dec 3 10:35:58 CST 2019


Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
---
 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 976235bf60f..260a0486302 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 67756a6bbfc..3754ed9e763 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;
 };
 
-- 
2.11.0




More information about the wine-devel mailing list