Generate errors when read buffers are missing in BlitFramebuffer.
The corresponding gl_tests has been updated too.
BUG=672719
Change-Id: Ief37bc397f7aa065bf99d6ebad0a1b50b1917dac
Reviewed-on: https://chromium-review.googlesource.com/420469
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/validationES.cpp b/src/libANGLE/validationES.cpp
index afd7a5a..4fc9eb7 100644
--- a/src/libANGLE/validationES.cpp
+++ b/src/libANGLE/validationES.cpp
@@ -1987,10 +1987,9 @@
if (mask & GL_COLOR_BUFFER_BIT)
{
const gl::FramebufferAttachment *readColorBuffer = readFramebuffer->getReadColorbuffer();
- const gl::FramebufferAttachment *drawColorBuffer = drawFramebuffer->getFirstColorbuffer();
const Extensions &extensions = context->getExtensions();
- if (readColorBuffer && drawColorBuffer)
+ if (readColorBuffer)
{
const Format &readFormat = readColorBuffer->getFormat();
@@ -2070,6 +2069,17 @@
return false;
}
}
+ // WebGL 2.0 BlitFramebuffer when blitting from a missing attachment
+ // In OpenGL ES it is undefined what happens when an operation tries to blit from a missing
+ // attachment and WebGL defines it to be an error. We do the check unconditionally as the
+ // situation is an application error that would lead to a crash in ANGLE.
+ else if (drawFramebuffer->hasEnabledDrawBuffer())
+ {
+ context->handleError(Error(
+ GL_INVALID_OPERATION,
+ "Attempt to read from a missing color attachment of a complete framebuffer."));
+ return false;
+ }
}
GLenum masks[] = {GL_DEPTH_BUFFER_BIT, GL_STENCIL_BUFFER_BIT};
@@ -2097,6 +2107,14 @@
return false;
}
}
+ // WebGL 2.0 BlitFramebuffer when blitting from a missing attachment
+ else if (drawBuffer)
+ {
+ context->handleError(Error(GL_INVALID_OPERATION,
+ "Attempt to read from a missing depth/stencil "
+ "attachment of a complete framebuffer."));
+ return false;
+ }
}
}
@@ -2974,7 +2992,7 @@
// WebGL 1.0 [Section 6.26] Reading From a Missing Attachment
// In OpenGL ES it is undefined what happens when an operation tries to read from a missing
- // attachment and WebGL defines it to be an error. We do the check unconditionnaly as the
+ // attachment and WebGL defines it to be an error. We do the check unconditionally as the
// situation is an application error that would lead to a crash in ANGLE.
if (readFramebuffer->getReadColorbuffer() == nullptr)
{