wined3d: Call ActivateContext before any gl call in IWineD3DSurfaceImpl_Release.
This commit is contained in:
parent
18b9c2bb83
commit
a68637b59b
|
@ -423,29 +423,31 @@ ULONG WINAPI IWineD3DSurfaceImpl_Release(IWineD3DSurface *iface) {
|
||||||
renderbuffer_entry_t *entry, *entry2;
|
renderbuffer_entry_t *entry, *entry2;
|
||||||
TRACE("(%p) : cleaning up\n", This);
|
TRACE("(%p) : cleaning up\n", This);
|
||||||
|
|
||||||
|
/* 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
|
||||||
|
*/
|
||||||
|
if(device->render_targets && device->render_targets[0]) {
|
||||||
|
ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
|
||||||
|
}
|
||||||
|
|
||||||
|
ENTER_GL();
|
||||||
if (This->glDescription.textureName != 0) { /* release the openGL texture.. */
|
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
|
|
||||||
*/
|
|
||||||
if(device->render_targets && device->render_targets[0]) {
|
|
||||||
ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
|
|
||||||
}
|
|
||||||
|
|
||||||
TRACE("Deleting texture %d\n", This->glDescription.textureName);
|
TRACE("Deleting texture %d\n", This->glDescription.textureName);
|
||||||
ENTER_GL();
|
|
||||||
glDeleteTextures(1, &This->glDescription.textureName);
|
glDeleteTextures(1, &This->glDescription.textureName);
|
||||||
LEAVE_GL();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(This->Flags & SFLAG_PBO) {
|
if(This->Flags & SFLAG_PBO) {
|
||||||
/* Delete the PBO */
|
/* Delete the PBO */
|
||||||
ENTER_GL();
|
|
||||||
GL_EXTCALL(glDeleteBuffersARB(1, &This->pbo));
|
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) {
|
if(This->Flags & SFLAG_DIBSECTION) {
|
||||||
/* Release the DC */
|
/* Release the DC */
|
||||||
SelectObject(This->hDC, This->dib.holdbitmap);
|
SelectObject(This->hDC, This->dib.holdbitmap);
|
||||||
|
@ -463,13 +465,6 @@ ULONG WINAPI IWineD3DSurfaceImpl_Release(IWineD3DSurface *iface) {
|
||||||
if(iface == device->ddraw_primary)
|
if(iface == device->ddraw_primary)
|
||||||
device->ddraw_primary = NULL;
|
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);
|
TRACE("(%p) Released\n", This);
|
||||||
HeapFree(GetProcessHeap(), 0, This);
|
HeapFree(GetProcessHeap(), 0, This);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue