Disallow glCopyTex* with multi-view read framebuffers
According to the ANGLE_multiview spec, glCopyTex* functions must
generate an INVALID_FRAMEBUFFER_OPERATION error if the active read
framebuffer has a multi-view layout.
BUG=angleproject:2062
TEST=angle_end2end_tests
Change-Id: Icadc4ac79843986076594da25a90ba807e511d1e
Reviewed-on: https://chromium-review.googlesource.com/589447
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Martin Radev <mradev@nvidia.com>
diff --git a/src/libANGLE/validationES.cpp b/src/libANGLE/validationES.cpp
index 5e7806b..206762a 100644
--- a/src/libANGLE/validationES.cpp
+++ b/src/libANGLE/validationES.cpp
@@ -2624,12 +2624,24 @@
// 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 unconditionally as the
// situation is an application error that would lead to a crash in ANGLE.
- if (readFramebuffer->getReadColorbuffer() == nullptr)
+ const FramebufferAttachment *source = readFramebuffer->getReadColorbuffer();
+ if (source == nullptr)
{
ANGLE_VALIDATION_ERR(context, InvalidOperation(), MissingReadAttachment);
return false;
}
+ // ANGLE_multiview spec, Revision 1:
+ // Calling CopyTexSubImage3D, CopyTexImage2D, or CopyTexSubImage2D will result in an
+ // INVALID_FRAMEBUFFER_OPERATION error if the multi-view layout of the current read framebuffer
+ // is not NONE.
+ if (source->getMultiviewLayout() != GL_NONE)
+ {
+ context->handleError(InvalidFramebufferOperation()
+ << "The active read framebuffer object has multiview attachments.");
+ return false;
+ }
+
const gl::Caps &caps = context->getCaps();
GLuint maxDimension = 0;