Commit 3c90ed6b by Corentin Wallez Committed by Commit Bot

Implement the WebGL restriction on reading from missing attachments

BUG=angleproject:1523 BUG=chromium:668223 Change-Id: I2dffa3c92dd32e384d3b3109084420650ca7f795 Reviewed-on: https://chromium-review.googlesource.com/421113Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
parent 7b91d0c1
...@@ -241,9 +241,13 @@ bool ValidateReadPixelsBase(ValidationContext *context, ...@@ -241,9 +241,13 @@ bool ValidateReadPixelsBase(ValidationContext *context,
} }
const FramebufferAttachment *readBuffer = framebuffer->getReadColorbuffer(); const FramebufferAttachment *readBuffer = framebuffer->getReadColorbuffer();
if (!readBuffer) // WebGL 1.0 [Section 6.26] Reading From a Missing Attachment
// 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 unconditionnaly as the
// situation is an application error that would lead to a crash in ANGLE.
if (readBuffer == nullptr)
{ {
context->handleError(Error(GL_INVALID_OPERATION)); context->handleError(Error(GL_INVALID_OPERATION, "Missing read attachment"));
return false; return false;
} }
...@@ -2952,6 +2956,16 @@ bool ValidateCopyTexImageParametersBase(ValidationContext *context, ...@@ -2952,6 +2956,16 @@ bool ValidateCopyTexImageParametersBase(ValidationContext *context,
return false; return false;
} }
// WebGL 1.0 [Section 6.26] Reading From a Missing Attachment
// 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 unconditionnaly as the
// situation is an application error that would lead to a crash in ANGLE.
if (readFramebuffer->getReadColorbuffer() == nullptr)
{
context->handleError(Error(GL_INVALID_OPERATION, "Missing read attachment"));
return false;
}
const gl::Caps &caps = context->getCaps(); const gl::Caps &caps = context->getCaps();
GLuint maxDimension = 0; GLuint maxDimension = 0;
......
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