GL: Realized we need another sanity check in the readback code

Added similar checks to Vulkan, just because.
This commit is contained in:
Henrik Rydgård
2018-11-24 17:20:56 +01:00
parent 036baf04d0
commit d1910de166
2 changed files with 17 additions and 4 deletions
+4
View File
@@ -1306,6 +1306,10 @@ void GLQueueRunner::CopyReadbackBuffer(int width, int height, Draw::DataFormat s
// don't usually provide very optimized conversion implementations, though some do.
// Just need to be careful about dithering, which may break Danganronpa.
int bpp = (int)Draw::DataFormatSizeInBytes(destFormat);
if (!readbackBuffer_ || bpp <= 0 || !pixels) {
// Something went wrong during the read and no readback buffer was allocated, probably.
return;
}
for (int y = 0; y < height; y++) {
memcpy(pixels + y * pixelStride * bpp, readbackBuffer_ + y * width * bpp, width * bpp);
}