Commit b941665b authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Destroy PBOs in wined3d_texture_gl_destroy_object().

parent 7930553e
......@@ -4765,17 +4765,39 @@ static void wined3d_texture_gl_destroy_object(void *object)
{
struct wined3d_renderbuffer_entry *entry, *entry2;
struct wined3d_texture_gl *texture_gl = object;
struct wined3d_context *context = NULL;
const struct wined3d_gl_info *gl_info;
struct wined3d_context *context;
struct wined3d_device *device;
unsigned int sub_count, i;
GLuint buffer_object;
TRACE("texture_gl %p.\n", texture_gl);
sub_count = texture_gl->t.level_count * texture_gl->t.layer_count;
for (i = 0; i < sub_count; ++i)
{
if (!(buffer_object = texture_gl->t.sub_resources[i].buffer_object))
continue;
TRACE("Deleting buffer object %u.\n", buffer_object);
if (!context)
{
context = context_acquire(texture_gl->t.resource.device, NULL, 0);
gl_info = wined3d_context_gl(context)->gl_info;
}
GL_EXTCALL(glDeleteBuffers(1, &buffer_object));
}
if (!list_empty(&texture_gl->renderbuffers))
{
device = texture_gl->t.resource.device;
if (!context)
{
context = context_acquire(device, NULL, 0);
gl_info = wined3d_context_gl(context)->gl_info;
}
LIST_FOR_EACH_ENTRY_SAFE(entry, entry2, &texture_gl->renderbuffers, struct wined3d_renderbuffer_entry, entry)
{
......@@ -4784,9 +4806,10 @@ static void wined3d_texture_gl_destroy_object(void *object)
gl_info->fbo_ops.glDeleteRenderbuffers(1, &entry->id);
heap_free(entry);
}
}
if (context)
context_release(context);
}
wined3d_texture_gl_unload_texture(texture_gl);
......
......@@ -1118,38 +1118,14 @@ ULONG CDECL wined3d_texture_incref(struct wined3d_texture *texture)
static void wined3d_texture_destroy_object(void *object)
{
const struct wined3d_gl_info *gl_info = NULL;
struct wined3d_texture *texture = object;
struct wined3d_context *context = NULL;
struct wined3d_dc_info *dc_info;
unsigned int sub_count;
GLuint buffer_object;
unsigned int i;
TRACE("texture %p.\n", texture);
sub_count = texture->level_count * texture->layer_count;
for (i = 0; i < sub_count; ++i)
{
if (!(buffer_object = texture->sub_resources[i].buffer_object))
continue;
TRACE("Deleting buffer object %u.\n", buffer_object);
/* We may not be able to get a context in
* wined3d_texture_destroy_object() in general, but if a buffer object
* was previously created we can. */
if (!context)
{
context = context_acquire(texture->resource.device, NULL, 0);
gl_info = wined3d_context_gl(context)->gl_info;
}
GL_EXTCALL(glDeleteBuffers(1, &buffer_object));
}
if (context)
context_release(context);
if ((dc_info = texture->dc_info))
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment