wined3d: Destroy FBO entries in the context.
This commit is contained in:
parent
459673da1a
commit
76de76e508
|
@ -226,7 +226,7 @@ static struct fbo_entry *context_create_fbo_entry(IWineD3DDevice *iface)
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
void context_destroy_fbo_entry(IWineD3DDeviceImpl *This, struct fbo_entry *entry)
|
static void context_destroy_fbo_entry(IWineD3DDeviceImpl *This, struct fbo_entry *entry)
|
||||||
{
|
{
|
||||||
if (entry->id)
|
if (entry->id)
|
||||||
{
|
{
|
||||||
|
@ -320,6 +320,46 @@ static void context_apply_fbo_state(IWineD3DDevice *iface)
|
||||||
context_check_fbo_status(iface);
|
context_check_fbo_status(iface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void context_resource_released(IWineD3DDevice *iface, IWineD3DResource *resource, WINED3DRESOURCETYPE type)
|
||||||
|
{
|
||||||
|
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||||
|
UINT i;
|
||||||
|
|
||||||
|
switch(type)
|
||||||
|
{
|
||||||
|
case WINED3DRTYPE_SURFACE:
|
||||||
|
{
|
||||||
|
for (i = 0; i < This->numContexts; ++i)
|
||||||
|
{
|
||||||
|
struct fbo_entry *entry, *entry2;
|
||||||
|
|
||||||
|
LIST_FOR_EACH_ENTRY_SAFE(entry, entry2, &This->contexts[i]->fbo_list, struct fbo_entry, entry)
|
||||||
|
{
|
||||||
|
BOOL destroyed = FALSE;
|
||||||
|
UINT j;
|
||||||
|
|
||||||
|
for (j = 0; !destroyed && j < GL_LIMITS(buffers); ++j)
|
||||||
|
{
|
||||||
|
if (entry->render_targets[j] == (IWineD3DSurface *)resource)
|
||||||
|
{
|
||||||
|
context_destroy_fbo_entry(This, entry);
|
||||||
|
destroyed = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!destroyed && entry->depth_stencil == (IWineD3DSurface *)resource)
|
||||||
|
context_destroy_fbo_entry(This, entry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Context_MarkStateDirty
|
* Context_MarkStateDirty
|
||||||
*
|
*
|
||||||
|
|
|
@ -7325,10 +7325,14 @@ static void WINAPI IWineD3DDeviceImpl_RemoveResource(IWineD3DDevice *iface, IWin
|
||||||
|
|
||||||
static void WINAPI IWineD3DDeviceImpl_ResourceReleased(IWineD3DDevice *iface, IWineD3DResource *resource){
|
static void WINAPI IWineD3DDeviceImpl_ResourceReleased(IWineD3DDevice *iface, IWineD3DResource *resource){
|
||||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
|
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
|
||||||
|
WINED3DRESOURCETYPE type = IWineD3DResource_GetType(resource);
|
||||||
int counter;
|
int counter;
|
||||||
|
|
||||||
TRACE("(%p) : resource %p\n", This, resource);
|
TRACE("(%p) : resource %p\n", This, resource);
|
||||||
switch(IWineD3DResource_GetType(resource)){
|
|
||||||
|
context_resource_released(iface, resource, type);
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
/* TODO: check front and back buffers, rendertargets etc.. possibly swapchains? */
|
/* TODO: check front and back buffers, rendertargets etc.. possibly swapchains? */
|
||||||
case WINED3DRTYPE_SURFACE: {
|
case WINED3DRTYPE_SURFACE: {
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
@ -7374,24 +7378,6 @@ static void WINAPI IWineD3DDeviceImpl_ResourceReleased(IWineD3DDevice *iface, IW
|
||||||
if (This->stencilBufferTarget == (IWineD3DSurface *)resource) {
|
if (This->stencilBufferTarget == (IWineD3DSurface *)resource) {
|
||||||
This->stencilBufferTarget = NULL;
|
This->stencilBufferTarget = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < This->numContexts; ++i) {
|
|
||||||
struct fbo_entry *entry, *entry2;
|
|
||||||
int j;
|
|
||||||
|
|
||||||
LIST_FOR_EACH_ENTRY_SAFE(entry, entry2, &This->contexts[i]->fbo_list, struct fbo_entry, entry) {
|
|
||||||
BOOL destroyed = FALSE;
|
|
||||||
for (j = 0; !destroyed && j < GL_LIMITS(buffers); ++j) {
|
|
||||||
if (entry->render_targets[j] == (IWineD3DSurface *)resource) {
|
|
||||||
context_destroy_fbo_entry(This, entry);
|
|
||||||
destroyed = TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!destroyed && entry->depth_stencil == (IWineD3DSurface *)resource) {
|
|
||||||
context_destroy_fbo_entry(This, entry);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -629,6 +629,7 @@ typedef enum ContextUsage {
|
||||||
void ActivateContext(IWineD3DDeviceImpl *device, IWineD3DSurface *target, ContextUsage usage);
|
void ActivateContext(IWineD3DDeviceImpl *device, IWineD3DSurface *target, ContextUsage usage);
|
||||||
WineD3DContext *CreateContext(IWineD3DDeviceImpl *This, IWineD3DSurfaceImpl *target, HWND win, BOOL create_pbuffer, const WINED3DPRESENT_PARAMETERS *pPresentParms);
|
WineD3DContext *CreateContext(IWineD3DDeviceImpl *This, IWineD3DSurfaceImpl *target, HWND win, BOOL create_pbuffer, const WINED3DPRESENT_PARAMETERS *pPresentParms);
|
||||||
void DestroyContext(IWineD3DDeviceImpl *This, WineD3DContext *context);
|
void DestroyContext(IWineD3DDeviceImpl *This, WineD3DContext *context);
|
||||||
|
void context_resource_released(IWineD3DDevice *iface, IWineD3DResource *resource, WINED3DRESOURCETYPE type);
|
||||||
void context_bind_fbo(IWineD3DDevice *iface, GLenum target, GLuint *fbo);
|
void context_bind_fbo(IWineD3DDevice *iface, GLenum target, GLuint *fbo);
|
||||||
void context_attach_depth_stencil_fbo(IWineD3DDeviceImpl *This, GLenum fbo_target, IWineD3DSurface *depth_stencil, BOOL use_render_buffer);
|
void context_attach_depth_stencil_fbo(IWineD3DDeviceImpl *This, GLenum fbo_target, IWineD3DSurface *depth_stencil, BOOL use_render_buffer);
|
||||||
void context_attach_surface_fbo(IWineD3DDeviceImpl *This, GLenum fbo_target, DWORD idx, IWineD3DSurface *surface);
|
void context_attach_surface_fbo(IWineD3DDeviceImpl *This, GLenum fbo_target, DWORD idx, IWineD3DSurface *surface);
|
||||||
|
@ -2442,6 +2443,4 @@ static inline BOOL use_ps(IWineD3DDeviceImpl *device) {
|
||||||
void stretch_rect_fbo(IWineD3DDevice *iface, IWineD3DSurface *src_surface, WINED3DRECT *src_rect,
|
void stretch_rect_fbo(IWineD3DDevice *iface, IWineD3DSurface *src_surface, WINED3DRECT *src_rect,
|
||||||
IWineD3DSurface *dst_surface, WINED3DRECT *dst_rect, const WINED3DTEXTUREFILTERTYPE filter, BOOL flip);
|
IWineD3DSurface *dst_surface, WINED3DRECT *dst_rect, const WINED3DTEXTUREFILTERTYPE filter, BOOL flip);
|
||||||
void depth_blt(IWineD3DDevice *iface, GLuint texture, GLsizei w, GLsizei h);
|
void depth_blt(IWineD3DDevice *iface, GLuint texture, GLsizei w, GLsizei h);
|
||||||
|
|
||||||
void context_destroy_fbo_entry(IWineD3DDeviceImpl *This, struct fbo_entry *entry);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue