Commit a3ed4576 by Martin Radev Committed by Commit Bot

Disallow glBlitFramebuffer for multi-view framebuffers

According to the ANGLE_multiview spec, glBlitFramebuffer must generate an INVALID_FRAMEBUFFER_OPERATION error if either the active read framebuffer, or active draw framebuffer has a multi-view layout. BUG=angleproject:2062 TEST=angle_end2end_tests Change-Id: I885bdc970c9606cfad882f31759f5780c65d15e5 Reviewed-on: https://chromium-review.googlesource.com/590237 Commit-Queue: Martin Radev <mradev@nvidia.com> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 04e2c3bc
...@@ -1564,6 +1564,16 @@ GLint Framebuffer::getDefaultSamples() const ...@@ -1564,6 +1564,16 @@ GLint Framebuffer::getDefaultSamples() const
return mState.getDefaultSamples(); return mState.getDefaultSamples();
} }
GLenum Framebuffer::getMultiviewLayout() const
{
const FramebufferAttachment *firstAttachment = getFirstNonNullAttachment();
if (firstAttachment == nullptr)
{
return GL_NONE;
}
return firstAttachment->getMultiviewLayout();
}
GLboolean Framebuffer::getDefaultFixedSampleLocations() const GLboolean Framebuffer::getDefaultFixedSampleLocations() const
{ {
return mState.getDefaultFixedSampleLocations(); return mState.getDefaultFixedSampleLocations();
......
...@@ -291,6 +291,7 @@ class Framebuffer final : public LabeledObject, public OnAttachmentDirtyReceiver ...@@ -291,6 +291,7 @@ class Framebuffer final : public LabeledObject, public OnAttachmentDirtyReceiver
bool formsCopyingFeedbackLoopWith(GLuint copyTextureID, bool formsCopyingFeedbackLoopWith(GLuint copyTextureID,
GLint copyTextureLevel, GLint copyTextureLevel,
GLint copyTextureLayer) const; GLint copyTextureLayer) const;
GLenum getMultiviewLayout() const;
private: private:
void detachResourceById(const Context *context, GLenum resourceType, GLuint resourceId); void detachResourceById(const Context *context, GLenum resourceType, GLuint resourceId);
......
...@@ -1809,6 +1809,22 @@ bool ValidateBlitFramebufferParameters(ValidationContext *context, ...@@ -1809,6 +1809,22 @@ bool ValidateBlitFramebufferParameters(ValidationContext *context,
} }
} }
// ANGLE_multiview, Revision 1:
// Calling BlitFramebuffer will result in an INVALID_FRAMEBUFFER_OPERATION error if the
// multi-view layout of the current draw framebuffer or read framebuffer is not NONE.
if (readFramebuffer->getMultiviewLayout() != GL_NONE)
{
context->handleError(InvalidFramebufferOperation()
<< "Attempt to read from a multi-view framebuffer.");
return false;
}
if (drawFramebuffer->getMultiviewLayout() != GL_NONE)
{
context->handleError(InvalidFramebufferOperation()
<< "Attempt to write to a multi-view framebuffer.");
return false;
}
return true; return true;
} }
......
...@@ -423,4 +423,39 @@ TEST_P(FramebufferMultiviewTest, InvalidCopyTex) ...@@ -423,4 +423,39 @@ TEST_P(FramebufferMultiviewTest, InvalidCopyTex)
} }
} }
// Test that glBlitFramebuffer generates an invalid framebuffer operation when either the current
// draw framebuffer, or current read framebuffer have multiview attachments.
TEST_P(FramebufferMultiviewTest, InvalidBlit)
{
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();
// Blit with the active read framebuffer having multiview attachments.
{
glBindFramebuffer(GL_READ_FRAMEBUFFER, mFramebuffer);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
glBlitFramebuffer(0, 0, 1, 1, 0, 0, 1, 1, GL_COLOR_BUFFER_BIT, GL_NEAREST);
EXPECT_GL_ERROR(GL_INVALID_FRAMEBUFFER_OPERATION);
}
// Blit with the active draw framebuffer having multiview attachments.
{
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, mFramebuffer);
glBlitFramebuffer(0, 0, 1, 1, 0, 0, 1, 1, GL_COLOR_BUFFER_BIT, GL_NEAREST);
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