From 8272e4872fd7edf3cd40f3ab90f4383ed1c784f0 Mon Sep 17 00:00:00 2001 From: Mikkel Krautz Date: Sat, 2 Jul 2016 12:18:57 +0200 Subject: overlay: optimize blit() to not perform a blit if the active item rect is empty. It seems that in EVE Online, if we update our overlay texture but do not draw to the screen, the texture mapping is never freed, until we begin drawing again. I do not know enough D3D11 to know why. Instead, this commit works around the issue by introducing a fully legal optimization to the blit() method: If the rect of active overlay elements is empty (that is, the screen is empty), do not perform a blit at all. The change also introduces an extra call to blit upon receiving OVERLAY_MSG_ACTIVE. That message is the message that signals that the rect of active elements has changed. We need to blit here to ensure we redraw correctly once the rect of active overlay elements changes. Fixes mumble-voip/mumble#1123 --- overlay/d3d10.cpp | 2 +- overlay/d3d11.cpp | 2 +- overlay/d3d9.cpp | 2 +- overlay/lib.cpp | 4 +++- 4 files changed, 6 insertions(+), 4 deletions(-) (limited to 'overlay') diff --git a/overlay/d3d10.cpp b/overlay/d3d10.cpp index 4494b8256..6b91ebed0 100644 --- a/overlay/d3d10.cpp +++ b/overlay/d3d10.cpp @@ -109,7 +109,7 @@ void D10State::blit(unsigned int x, unsigned int y, unsigned int w, unsigned int ods("D3D10: Blit %d %d %d %d", x, y, w, h); - if (! pTexture || ! pSRView) + if (! pTexture || ! pSRView || uiLeft == uiRight) return; D3D10_MAPPED_TEXTURE2D mappedTex; diff --git a/overlay/d3d11.cpp b/overlay/d3d11.cpp index f70873d41..e47f008cb 100644 --- a/overlay/d3d11.cpp +++ b/overlay/d3d11.cpp @@ -140,7 +140,7 @@ void D11State::blit(unsigned int x, unsigned int y, unsigned int w, unsigned int ods("D3D11: Blit %d %d %d %d", x, y, w, h); - if (! pTexture || ! pSRView) + if (! pTexture || ! pSRView || uiLeft == uiRight) return; D3D11_MAPPED_SUBRESOURCE mappedTex; diff --git a/overlay/d3d9.cpp b/overlay/d3d9.cpp index 3ffe6cf60..e64cb5d7a 100644 --- a/overlay/d3d9.cpp +++ b/overlay/d3d9.cpp @@ -114,7 +114,7 @@ void DevState::blit(unsigned int x, unsigned int y, unsigned int w, unsigned int ods("D3D9: Blit %d %d %d %d", x, y, w, h); #endif - if (! texTexture || !a_ucTexture) + if (! texTexture || !a_ucTexture || uiLeft == uiRight) return; D3DLOCKED_RECT lr; diff --git a/overlay/lib.cpp b/overlay/lib.cpp index ab3baf558..43613bc98 100644 --- a/overlay/lib.cpp +++ b/overlay/lib.cpp @@ -298,8 +298,10 @@ void Pipe::checkMessage(unsigned int width, unsigned int height) { uiTop = omMsg.oma.y; uiRight = omMsg.oma.x + omMsg.oma.w; uiBottom = omMsg.oma.y + omMsg.oma.h; - if (a_ucTexture) + if (a_ucTexture) { setRect(); + blit(0, 0, uiWidth, uiHeight); + } } break; default: -- cgit v1.2.3