Commit 14b2126e by Martin Radev Committed by Commit Bot

Relax multi-view end-point validation on detach

Passing invalid arguments to the multi-view end-points should not generate an error if a texture is being detached from the framebuffer. BUG=angleproject:2062 TEST=angle_end2end_tests Change-Id: I22e1ed13b64db046724031d0189612d5e111dcac Reviewed-on: https://chromium-review.googlesource.com/635166 Commit-Queue: Martin Radev <mradev@nvidia.com> Reviewed-by: 's avatarOlli Etuaho <oetuaho@nvidia.com> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org>
parent 39e78122
......@@ -257,11 +257,12 @@ Additions to Chapter 4 of the OpenGL ES 3.0 Specification
and does not name an existing texture object of type TEXTURE_2D_ARRAY.
An INVALID_OPERATION error is generated if texture is not zero,
and names a texture with a compressed texture format.
An INVALID_VALUE error is generated if baseViewIndex+numViews is
greater than GL_MAX_ARRAY_TEXTURE_LAYERS.
An INVALID_VALUE error is generated if numViews is less than 1
or greater than MAX_VIEWS_ANGLE.
An INVALID_VALUE error is generated if baseViewIndex is less than 0.
An INVALID_VALUE error is generated if texture is not zero, and
baseViewIndex+numViews is greater than GL_MAX_ARRAY_TEXTURE_LAYERS.
An INVALID_VALUE error is generated if texture is not zero, and
numViews is less than 1 or greater than MAX_VIEWS_ANGLE.
An INVALID_VALUE error is generated if texture is not zero, and
baseViewIndex is less than 0.
The command
......@@ -331,10 +332,10 @@ Additions to Chapter 4 of the OpenGL ES 3.0 Specification
and does not name an existing texture object of type TEXTURE_2D.
An INVALID_OPERATION error is generated if texture is not zero,
and names a texture with a compressed texture format.
An INVALID_VALUE error is generated if numViews is less than 1
or greater than MAX_VIEWS_ANGLE.
An INVALID_VALUE error is generated if viewportOffsets contains
negative values.
An INVALID_VALUE error is generated if texture is not zero, and
numViews is less than 1 or greater than MAX_VIEWS_ANGLE.
An INVALID_VALUE error is generated if texture is not zero, and
any of the first numViews * 2 values in viewportOffsets is negative.
Having overlapping scissor rectangles after viewport offsets are
applied causes undefined behavior.
......
......@@ -45,7 +45,7 @@ bool ValidateFramebufferTextureMultiviewBaseANGLE(Context *context,
return false;
}
if (numViews < 1)
if (texture != 0 && numViews < 1)
{
context->handleError(InvalidValue() << "numViews cannot be less than 1.");
return false;
......@@ -2727,14 +2727,14 @@ bool ValidateFramebufferTextureMultiviewLayeredANGLE(Context *context,
return false;
}
if (baseViewIndex < 0)
{
context->handleError(InvalidValue() << "baseViewIndex cannot be less than 0.");
return false;
}
if (texture != 0)
{
if (baseViewIndex < 0)
{
context->handleError(InvalidValue() << "baseViewIndex cannot be less than 0.");
return false;
}
Texture *tex = context->getTexture(texture);
ASSERT(tex);
......@@ -2781,19 +2781,19 @@ bool ValidateFramebufferTextureMultiviewSideBySideANGLE(Context *context,
return false;
}
const GLsizei numViewportOffsetValues = numViews * 2;
for (GLsizei i = 0; i < numViewportOffsetValues; ++i)
if (texture != 0)
{
if (viewportOffsets[i] < 0)
const GLsizei numViewportOffsetValues = numViews * 2;
for (GLsizei i = 0; i < numViewportOffsetValues; ++i)
{
context->handleError(InvalidValue()
<< "viewportOffsets cannot contain negative values.");
return false;
if (viewportOffsets[i] < 0)
{
context->handleError(InvalidValue()
<< "viewportOffsets cannot contain negative values.");
return false;
}
}
}
if (texture != 0)
{
Texture *tex = context->getTexture(texture);
ASSERT(tex);
......
......@@ -1294,6 +1294,39 @@ TEST_P(FramebufferMultiviewLayeredClearTest, ScissoredClearBufferfi)
EXPECT_EQ(GLColor::red, getLayerColor(3, GL_COLOR_ATTACHMENT0, 0, 1));
}
// Test that detaching an attachment does not generate an error whenever the multi-view related
// arguments are invalid.
TEST_P(FramebufferMultiviewTest, InvalidMultiviewArgumentsOnDetach)
{
if (!requestMultiviewExtension())
{
return;
}
GLFramebuffer fbo;
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
// Invalid base view index.
glFramebufferTextureMultiviewLayeredANGLE(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, 0, 0, -1, 1);
EXPECT_GL_NO_ERROR();
// Invalid number of views.
glFramebufferTextureMultiviewLayeredANGLE(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, 0, 0, 0, 0);
EXPECT_GL_NO_ERROR();
// Invalid number of views.
const GLint kValidViewportOffsets[2] = {0, 0};
glFramebufferTextureMultiviewSideBySideANGLE(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, 0, 0, 0,
kValidViewportOffsets);
EXPECT_GL_NO_ERROR();
// Invalid viewport offsets.
const GLint kInvalidViewportOffsets[2] = {-1, -1};
glFramebufferTextureMultiviewSideBySideANGLE(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, 0, 0, 1,
kInvalidViewportOffsets);
EXPECT_GL_NO_ERROR();
}
ANGLE_INSTANTIATE_TEST(FramebufferMultiviewTest, ES3_OPENGL());
ANGLE_INSTANTIATE_TEST(FramebufferMultiviewSideBySideClearTest, ES3_OPENGL(), ES3_D3D11());
ANGLE_INSTANTIATE_TEST(FramebufferMultiviewLayeredClearTest, ES3_OPENGL(), ES3_D3D11());
\ 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