Commit 491b0d60 by Bryan Bernhart (Intel Americas Inc) Committed by Commit Bot

WebGLCompatibility: Allow GL_DEPTH_STENCIL_ATTACHMENT.

Permits depth-stencil attachment points for WebGL. BUG=angleproject:2090 Change-Id: I7f5a7c63f2a4a76116ce5639833e5fd8d7f50ffb Reviewed-on: https://chromium-review.googlesource.com/764591Reviewed-by: 's avatarBryan Bernhart <bryan.bernhart@intel.com> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
parent be0e2c0c
......@@ -69,7 +69,7 @@ ERRMSG(InvalidFilterTexture, "Texture only supports NEAREST and LINEAR filtering
ERRMSG(InvalidFormat, "Invalid format.");
ERRMSG(InvalidFramebufferTarget, "Invalid framebuffer target.");
ERRMSG(InvalidFramebufferTextureLevel, "Mipmap level must be 0 when attaching a texture.");
ERRMSG(InvalidFramebufferTextureParameter, "Invalid parameter name for framebuffer attachment.");
ERRMSG(InvalidFramebufferAttachmentParameter, "Invalid parameter name for framebuffer attachment.");
ERRMSG(InvalidInternalFormat, "Invalid internal format.");
ERRMSG(InvalidMatrixMode, "Invalid matrix mode.");
ERRMSG(InvalidMipLevel, "Level of detail outside of range.");
......
......@@ -3857,10 +3857,8 @@ bool ValidateGetFramebufferAttachmentParameterivBase(ValidationContext *context,
switch (attachment)
{
case GL_BACK:
case GL_FRONT:
case GL_DEPTH:
case GL_STENCIL:
case GL_DEPTH_STENCIL_ATTACHMENT:
if (clientVersion < 3)
{
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidAttachment);
......@@ -3868,6 +3866,14 @@ bool ValidateGetFramebufferAttachmentParameterivBase(ValidationContext *context,
}
break;
case GL_DEPTH_STENCIL_ATTACHMENT:
if (clientVersion < 3 && !context->isWebGL1())
{
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidAttachment);
return false;
}
break;
case GL_COLOR_ATTACHMENT0:
case GL_DEPTH_ATTACHMENT:
case GL_STENCIL_ATTACHMENT:
......@@ -3922,7 +3928,7 @@ bool ValidateGetFramebufferAttachmentParameterivBase(ValidationContext *context,
break;
case GL_DEPTH_STENCIL_ATTACHMENT:
if (!framebuffer->hasValidDepthStencil())
if (!framebuffer->hasValidDepthStencil() && !context->isWebGL1())
{
context->handleError(InvalidOperation());
return false;
......@@ -4008,7 +4014,7 @@ bool ValidateGetFramebufferAttachmentParameterivBase(ValidationContext *context,
if (clientVersion < 3)
{
ANGLE_VALIDATION_ERR(context, InvalidEnum(),
InvalidFramebufferTextureParameter);
InvalidFramebufferAttachmentParameter);
return false;
}
break;
......@@ -4017,13 +4023,13 @@ bool ValidateGetFramebufferAttachmentParameterivBase(ValidationContext *context,
if (clientVersion < 3)
{
ANGLE_VALIDATION_ERR(context, InvalidEnum(),
InvalidFramebufferTextureParameter);
InvalidFramebufferAttachmentParameter);
return false;
}
else
{
ANGLE_VALIDATION_ERR(context, InvalidOperation(),
InvalidFramebufferTextureParameter);
InvalidFramebufferAttachmentParameter);
return false;
}
}
......
......@@ -2921,6 +2921,37 @@ TEST_P(WebGLCompatibilityTest, SizedRGBA32FFormats)
}
}
// Verify GL_DEPTH_STENCIL_ATTACHMENT is a valid attachment point.
TEST_P(WebGLCompatibilityTest, DepthStencilAttachment)
{
ANGLE_SKIP_TEST_IF(getClientMajorVersion() > 2);
// Test that attaching a bound texture succeeds.
GLTexture texture;
glBindTexture(GL_TEXTURE_2D, texture);
GLFramebuffer fbo;
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D, texture, 0);
GLint attachmentType;
glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT,
GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE,
/*param*/ &attachmentType);
EXPECT_GL_NO_ERROR();
EXPECT_GLENUM_EQ(GL_TEXTURE, attachmentType);
// Test when if no attach object at the named attachment point and pname is not OBJECT_TYPE.
GLFramebuffer fbo2;
glBindFramebuffer(GL_FRAMEBUFFER, fbo2);
glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT,
GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME,
/*param*/ &attachmentType);
EXPECT_GL_ERROR(GL_INVALID_ENUM);
}
// This tests that rendering feedback loops works as expected with WebGL 2.
// Based on WebGL test conformance2/rendering/rendering-sampling-feedback-loop.html
TEST_P(WebGL2CompatibilityTest, RenderingFeedbackLoopWithDrawBuffers)
......
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