FramebufferGL: add readPixels workarounds
Implements workarounds for:
- The pack state making rows overlap in memory, which causes crashes on
some drivers.
- The driver adding an extra last row padding when checking if the
pixel pack buffer is large enough for the readPixels.
BUG=angleproject:1512
Change-Id: I120ff58649bb523e8b01da6ef03d8fcadaf076b2
Reviewed-on: https://chromium-review.googlesource.com/388029
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/Context.cpp b/src/libANGLE/Context.cpp
index 1ed648c..755f12b 100644
--- a/src/libANGLE/Context.cpp
+++ b/src/libANGLE/Context.cpp
@@ -2569,6 +2569,11 @@
GLenum type,
GLvoid *pixels)
{
+ if (width == 0 || height == 0)
+ {
+ return;
+ }
+
syncStateForReadPixels();
Framebuffer *framebufferObject = mGLState.getReadFramebuffer();
@@ -2607,6 +2612,11 @@
GLsizei width,
GLsizei height)
{
+ if (width == 0 || height == 0)
+ {
+ return;
+ }
+
// Only sync the read FBO
mGLState.syncDirtyObject(GL_READ_FRAMEBUFFER);
@@ -2629,6 +2639,11 @@
GLsizei width,
GLsizei height)
{
+ if (width == 0 || height == 0)
+ {
+ return;
+ }
+
// Only sync the read FBO
mGLState.syncDirtyObject(GL_READ_FRAMEBUFFER);