wined3d: Call ActivateContext before any gl call in IWineD3DSurfaceImpl_Release.
This commit is contained in:
parent
18b9c2bb83
commit
a68637b59b
|
@ -423,8 +423,6 @@ ULONG WINAPI IWineD3DSurfaceImpl_Release(IWineD3DSurface *iface) {
|
|||
renderbuffer_entry_t *entry, *entry2;
|
||||
TRACE("(%p) : cleaning up\n", This);
|
||||
|
||||
if (This->glDescription.textureName != 0) { /* release the openGL texture.. */
|
||||
|
||||
/* Need a context to destroy the texture. Use the currently active render target, but only if
|
||||
* the primary render target exists. Otherwise lastActiveRenderTarget is garbage, see above.
|
||||
* When destroying the primary rt, Uninit3D will activate a context before doing anything
|
||||
|
@ -433,19 +431,23 @@ ULONG WINAPI IWineD3DSurfaceImpl_Release(IWineD3DSurface *iface) {
|
|||
ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
|
||||
}
|
||||
|
||||
TRACE("Deleting texture %d\n", This->glDescription.textureName);
|
||||
ENTER_GL();
|
||||
if (This->glDescription.textureName != 0) { /* release the openGL texture.. */
|
||||
TRACE("Deleting texture %d\n", This->glDescription.textureName);
|
||||
glDeleteTextures(1, &This->glDescription.textureName);
|
||||
LEAVE_GL();
|
||||
}
|
||||
|
||||
if(This->Flags & SFLAG_PBO) {
|
||||
/* Delete the PBO */
|
||||
ENTER_GL();
|
||||
GL_EXTCALL(glDeleteBuffersARB(1, &This->pbo));
|
||||
LEAVE_GL();
|
||||
}
|
||||
|
||||
LIST_FOR_EACH_ENTRY_SAFE(entry, entry2, &This->renderbuffers, renderbuffer_entry_t, entry) {
|
||||
GL_EXTCALL(glDeleteRenderbuffersEXT(1, &entry->id));
|
||||
HeapFree(GetProcessHeap(), 0, entry);
|
||||
}
|
||||
LEAVE_GL();
|
||||
|
||||
if(This->Flags & SFLAG_DIBSECTION) {
|
||||
/* Release the DC */
|
||||
SelectObject(This->hDC, This->dib.holdbitmap);
|
||||
|
@ -463,13 +465,6 @@ ULONG WINAPI IWineD3DSurfaceImpl_Release(IWineD3DSurface *iface) {
|
|||
if(iface == device->ddraw_primary)
|
||||
device->ddraw_primary = NULL;
|
||||
|
||||
ENTER_GL();
|
||||
LIST_FOR_EACH_ENTRY_SAFE(entry, entry2, &This->renderbuffers, renderbuffer_entry_t, entry) {
|
||||
GL_EXTCALL(glDeleteRenderbuffersEXT(1, &entry->id));
|
||||
HeapFree(GetProcessHeap(), 0, entry);
|
||||
}
|
||||
LEAVE_GL();
|
||||
|
||||
TRACE("(%p) Released\n", This);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
|
||||
|
|
Loading…
Reference in New Issue