Commit 94d33d3e authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Destroy FBO entries from the context that created them.

EXT_framebuffer_object doesn't specify if FBOs are shareable between GL contexts, but ARB_framebuffer_object explicitly prohibits it.
parent e3ca5765
......@@ -440,6 +440,13 @@ static void context_apply_fbo_entry(struct wined3d_context *context, struct fbo_
/* GL locking is done by the caller */
static void context_apply_fbo_state(struct wined3d_context *context)
{
struct fbo_entry *entry, *entry2;
LIST_FOR_EACH_ENTRY_SAFE(entry, entry2, &context->fbo_destroy_list, struct fbo_entry, entry)
{
context_destroy_fbo_entry(context, entry);
}
if (context->render_offscreen)
{
context->current_fbo = context_find_fbo_entry(context);
......@@ -586,8 +593,6 @@ void context_resource_released(IWineD3DDevice *iface, IWineD3DResource *resource
{
case WINED3DRTYPE_SURFACE:
{
ActivateContext(This, NULL, CTXUSAGE_RESOURCELOAD);
for (i = 0; i < This->numContexts; ++i)
{
struct wined3d_context *context = This->contexts[i];
......@@ -596,27 +601,27 @@ void context_resource_released(IWineD3DDevice *iface, IWineD3DResource *resource
if (context->current_rt == (IWineD3DSurface *)resource) context->current_rt = NULL;
ENTER_GL();
LIST_FOR_EACH_ENTRY_SAFE(entry, entry2, &context->fbo_list, struct fbo_entry, entry)
{
BOOL destroyed = FALSE;
UINT j;
for (j = 0; !destroyed && j < GL_LIMITS(buffers); ++j)
if (entry->depth_stencil == (IWineD3DSurface *)resource)
{
list_remove(&entry->entry);
list_add_head(&context->fbo_destroy_list, &entry->entry);
continue;
}
for (j = 0; j < GL_LIMITS(buffers); ++j)
{
if (entry->render_targets[j] == (IWineD3DSurface *)resource)
{
context_destroy_fbo_entry(context, entry);
destroyed = TRUE;
list_remove(&entry->entry);
list_add_head(&context->fbo_destroy_list, &entry->entry);
break;
}
}
if (!destroyed && entry->depth_stencil == (IWineD3DSurface *)resource)
context_destroy_fbo_entry(context, entry);
}
LEAVE_GL();
}
break;
......@@ -653,6 +658,12 @@ static void context_destroy_gl_resources(struct wined3d_context *context)
event_query->context = NULL;
}
LIST_FOR_EACH_ENTRY_SAFE(entry, entry2, &context->fbo_destroy_list, struct fbo_entry, entry)
{
if (!context->valid) entry->id = 0;
context_destroy_fbo_entry(context, entry);
}
LIST_FOR_EACH_ENTRY_SAFE(entry, entry2, &context->fbo_list, struct fbo_entry, entry)
{
if (!context->valid) entry->id = 0;
......@@ -1292,6 +1303,7 @@ struct wined3d_context *CreateContext(IWineD3DDeviceImpl *This, IWineD3DSurfaceI
TRACE("Successfully created new context %p\n", ret);
list_init(&ret->fbo_list);
list_init(&ret->fbo_destroy_list);
/* Set up the context defaults */
if (!context_set_current(ret))
......
......@@ -1076,6 +1076,7 @@ struct wined3d_context
/* FBOs */
UINT fbo_entry_count;
struct list fbo_list;
struct list fbo_destroy_list;
struct fbo_entry *current_fbo;
GLuint src_fbo;
GLuint dst_fbo;
......
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