Commit 2803168e by Martin Radev Committed by Commit Bot

Disallow glReadPixels with multi-view read framebuffers

According to the ANGLE_multiview spec, glReadPixels 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: Ia5311ff7a62c5ff732491eb80befd32de57b9d44 Reviewed-on: https://chromium-review.googlesource.com/591368 Commit-Queue: Martin Radev <mradev@nvidia.com> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 2bde9199
...@@ -161,7 +161,7 @@ Additions to Chapter 4 of the OpenGL ES 3.0 Specification ...@@ -161,7 +161,7 @@ Additions to Chapter 4 of the OpenGL ES 3.0 Specification
Add to the end of the section: Add to the end of the section:
" ReadPixels generates an INVALID_FRAMEBUFFER_OPERATION error if " ReadPixels generates an INVALID_FRAMEBUFFER_OPERATION error if
the multi-view layout of the current read buffer is not NONE." the multi-view layout of the current read framebuffer is not NONE."
Modify section 4.3.3 (Copying pixels), p. 198 Modify section 4.3.3 (Copying pixels), p. 198
......
...@@ -5456,6 +5456,16 @@ bool ValidateReadPixelsBase(Context *context, ...@@ -5456,6 +5456,16 @@ bool ValidateReadPixelsBase(Context *context,
return false; return false;
} }
// ANGLE_multiview, Revision 1:
// ReadPixels generates an INVALID_FRAMEBUFFER_OPERATION error if the multi-view layout of the
// current read framebuffer is not NONE.
if (readBuffer->getMultiviewLayout() != GL_NONE)
{
context->handleError(InvalidFramebufferOperation()
<< "Attempting to read from a multi-view framebuffer.");
return false;
}
if (context->getExtensions().webglCompatibility) if (context->getExtensions().webglCompatibility)
{ {
// The ES 2.0 spec states that the format must be "among those defined in table 3.4, // The ES 2.0 spec states that the format must be "among those defined in table 3.4,
......
...@@ -458,4 +458,27 @@ TEST_P(FramebufferMultiviewTest, InvalidBlit) ...@@ -458,4 +458,27 @@ TEST_P(FramebufferMultiviewTest, InvalidBlit)
} }
} }
// Test that glReadPixels generates an invalid framebuffer operation error if the current read
// framebuffer has a multi-view layout.
TEST_P(FramebufferMultiviewTest, InvalidReadPixels)
{
if (!requestMultiviewExtension())
{
return;
}
mTexture2D = CreateTexture2D(GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE);
ASSERT_GL_NO_ERROR();
const GLint viewportOffsets[2] = {0};
glFramebufferTextureMultiviewSideBySideANGLE(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, mTexture2D,
0, 1, &viewportOffsets[0]);
ASSERT_GLENUM_EQ(GL_FRAMEBUFFER_COMPLETE, glCheckFramebufferStatus(GL_FRAMEBUFFER));
ASSERT_GL_NO_ERROR();
GLColor pixelColor;
glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &pixelColor.R);
EXPECT_GL_ERROR(GL_INVALID_FRAMEBUFFER_OPERATION);
}
ANGLE_INSTANTIATE_TEST(FramebufferMultiviewTest, ES3_OPENGL()); ANGLE_INSTANTIATE_TEST(FramebufferMultiviewTest, ES3_OPENGL());
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment