diff options
author | Mikkel Krautz <mikkel@krautz.dk> | 2016-07-02 13:18:57 +0300 |
---|---|---|
committer | Mikkel Krautz <mikkel@krautz.dk> | 2016-07-02 13:18:57 +0300 |
commit | 8272e4872fd7edf3cd40f3ab90f4383ed1c784f0 (patch) | |
tree | bd1f730ce4c2ae051995e3348a71b63a06c38615 /overlay | |
parent | daba32f68eeb9ab03f30364021ada3d5f66bd00e (diff) |
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
Diffstat (limited to 'overlay')
-rw-r--r-- | overlay/d3d10.cpp | 2 | ||||
-rw-r--r-- | overlay/d3d11.cpp | 2 | ||||
-rw-r--r-- | overlay/d3d9.cpp | 2 | ||||
-rw-r--r-- | overlay/lib.cpp | 4 |
4 files changed, 6 insertions, 4 deletions
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: |