D3D11 CopyFBToMemory: Clamp rect to fb size. Last-minute style fix, should really debug where the bad parameters came from.

Affects MGS Peace Walker intro
This commit is contained in:
Henrik Rydgård committed 2018-05-03 23:12:39 +02:00
1 parent 3f7602227c
commit a3bbe87914
1 file changed
+10
+10
View File
@@ -1365,6 +1365,16 @@ bool D3D11DrawContext::CopyFramebufferToMemorySync(Framebuffer *src, int channel
assert(fb->colorFormat == DXGI_FORMAT_R8G8B8A8_UNORM);
}
// TODO: Figure out where the badness really comes from.
if (bx + bw > fb->width) {
bw -= (bx + bw) - fb->width;
}
if (by + bh > fb->height) {
bh -= (by + bh) - fb->height;
}
if (bh <= 0 || bw <= 0)
return true;
bool useGlobalPacktex = (bx + bw <= 512 && by + bh <= 512) && channelBits == FB_COLOR_BIT;
ID3D11Texture2D *packTex;