Fix CopyTexSubImage validation.
Now that we preserve the sized-ness information, we can validate
CopyTexSubImage and related methods correctly.
Fixed a lot of WebGL 2 tests when using ANGLE.
BUG=angleproject:1228
Change-Id: I959322c0a9bb16a2f16d60dce7cd1e63ca95b45a
Reviewed-on: https://chromium-review.googlesource.com/362618
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/validationES2.cpp b/src/libANGLE/validationES2.cpp
index 540ed1a..c25d1e5 100644
--- a/src/libANGLE/validationES2.cpp
+++ b/src/libANGLE/validationES2.cpp
@@ -630,29 +630,28 @@
GLsizei height,
GLint border)
{
- GLenum textureInternalFormat = GL_NONE;
-
if (!ValidTexture2DDestinationTarget(context, target))
{
context->handleError(Error(GL_INVALID_ENUM, "Invalid texture target"));
return false;
}
+ Format textureFormat = Format::Invalid();
if (!ValidateCopyTexImageParametersBase(context, target, level, internalformat, isSubImage,
- xoffset, yoffset, 0, x, y, width, height, border, &textureInternalFormat))
+ xoffset, yoffset, 0, x, y, width, height, border,
+ &textureFormat))
{
return false;
}
const gl::Framebuffer *framebuffer = context->getGLState().getReadFramebuffer();
GLenum colorbufferFormat = framebuffer->getReadColorbuffer()->getFormat().asSized();
- const auto &internalFormatInfo = gl::GetInternalFormatInfo(textureInternalFormat);
- GLenum textureFormat = internalFormatInfo.format;
+ const auto &formatInfo = *textureFormat.info;
// [OpenGL ES 2.0.24] table 3.9
if (isSubImage)
{
- switch (textureFormat)
+ switch (formatInfo.format)
{
case GL_ALPHA:
if (colorbufferFormat != GL_ALPHA8_EXT &&
@@ -750,8 +749,7 @@
return false;
}
- if (internalFormatInfo.type == GL_FLOAT &&
- !context->getExtensions().textureFloat)
+ if (formatInfo.type == GL_FLOAT && !context->getExtensions().textureFloat)
{
context->handleError(Error(GL_INVALID_OPERATION));
return false;