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

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2019-12-03 20:05:58 +03:30 committed by Alexandre Julliard
parent 2b01830f74
commit 7930553efc
2 changed files with 11 additions and 8 deletions

View File

@ -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, static void wined3d_texture_remove_buffer_object(struct wined3d_texture *texture,
unsigned int sub_resource_idx, const struct wined3d_gl_info *gl_info) 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"); checkGLcall("glDeleteBuffers");
TRACE("Deleted buffer object %u for texture %p, sub-resource %u.\n", 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); wined3d_texture_invalidate_location(texture, sub_resource_idx, WINED3D_LOCATION_BUFFER);
*buffer_object = 0; *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) unsigned int sub_resource_idx, const struct wined3d_gl_info *gl_info)
{ {
struct wined3d_texture_sub_resource *sub_resource; struct wined3d_texture_sub_resource *sub_resource;
GLuint bo;
sub_resource = &texture->sub_resources[sub_resource_idx]; sub_resource = &texture->sub_resources[sub_resource_idx];
if (sub_resource->buffer_object) if (sub_resource->buffer_object)
return; return;
GL_EXTCALL(glGenBuffers(1, &sub_resource->buffer_object)); GL_EXTCALL(glGenBuffers(1, &bo));
GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, sub_resource->buffer_object)); GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, bo));
GL_EXTCALL(glBufferData(GL_PIXEL_UNPACK_BUFFER, sub_resource->size, NULL, GL_STREAM_DRAW)); GL_EXTCALL(glBufferData(GL_PIXEL_UNPACK_BUFFER, sub_resource->size, NULL, GL_STREAM_DRAW));
GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0)); GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0));
checkGLcall("Create buffer object"); checkGLcall("Create buffer object");
TRACE("Created buffer object %u for texture %p, sub-resource %u.\n", sub_resource->buffer_object = bo;
sub_resource->buffer_object, texture, sub_resource_idx); 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) static void wined3d_texture_force_reload(struct wined3d_texture *texture)

View File

@ -3563,7 +3563,7 @@ struct wined3d_texture
unsigned int map_count; unsigned int map_count;
uint32_t map_flags; uint32_t map_flags;
DWORD locations; DWORD locations;
GLuint buffer_object; uintptr_t buffer_object;
} *sub_resources; } *sub_resources;
}; };