Commit 0c8abca1 by Jamie Madill Committed by Commit Bot

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/362618Reviewed-by: 's avatarZhenyao Mo <zmo@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent a3944d4f
......@@ -1649,7 +1649,7 @@ bool ValidateCopyTexImageParametersBase(ValidationContext *context,
GLsizei width,
GLsizei height,
GLint border,
GLenum *textureFormatOut)
Format *textureFormatOut)
{
if (level < 0 || xoffset < 0 || yoffset < 0 || zoffset < 0 || width < 0 || height < 0)
{
......@@ -1786,7 +1786,10 @@ bool ValidateCopyTexImageParametersBase(ValidationContext *context,
}
}
*textureFormatOut = texture->getFormat(target, level).asSized();
if (textureFormatOut)
{
*textureFormatOut = texture->getFormat(target, level);
}
return true;
}
......
......@@ -23,6 +23,7 @@ class Image;
namespace gl
{
class Context;
struct Format;
class Program;
class Shader;
class ValidationContext;
......@@ -143,7 +144,7 @@ bool ValidateCopyTexImageParametersBase(ValidationContext *context,
GLsizei width,
GLsizei height,
GLint border,
GLenum *textureInternalFormatOut);
Format *textureFormatOut);
bool ValidateDrawArrays(ValidationContext *context,
GLenum mode,
......
......@@ -630,29 +630,28 @@ bool ValidateES2CopyTexImageParameters(ValidationContext *context,
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 @@ bool ValidateES2CopyTexImageParameters(ValidationContext *context,
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;
......
......@@ -80,7 +80,6 @@
1020 WIN : dEQP-GLES2.functional.texture.mipmap.cube.projected.linear_nearest = FAIL
1020 WIN : dEQP-GLES2.functional.texture.mipmap.cube.bias.linear_nearest = FAIL
1020 WIN : dEQP-GLES2.functional.texture.mipmap.cube.bias.linear_linear = FAIL
1021 WIN : dEQP-GLES2.functional.texture.specification.basic_copyteximage2d.cube_luminance = FAIL
1025 WIN : dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_* = FAIL
1025 WIN : dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_ops.* = FAIL
1025 WIN : dEQP-GLES2.functional.fragment_ops.depth_stencil.write_mask.* = FAIL
......
......@@ -122,14 +122,6 @@
1092 WIN : dEQP-GLES3.functional.shaders.texture_functions.textureoffset.sampler3d_float_fragment = FAIL
1092 WIN : dEQP-GLES3.functional.shaders.texture_functions.textureprojoffset.sampler3d_fixed_fragment = FAIL
1092 WIN : dEQP-GLES3.functional.shaders.texture_functions.textureprojoffset.sampler3d_float_fragment = FAIL
1095 WIN : dEQP-GLES3.functional.texture.specification.basic_copytexsubimage2d.2d_rgba = FAIL
1095 WIN : dEQP-GLES3.functional.texture.specification.basic_copytexsubimage2d.2d_alpha = FAIL
1095 WIN : dEQP-GLES3.functional.texture.specification.basic_copytexsubimage2d.2d_luminance_alpha = FAIL
1095 WIN : dEQP-GLES3.functional.texture.specification.basic_copytexsubimage2d.2d_rgb = FAIL
1095 WIN : dEQP-GLES3.functional.texture.specification.basic_copytexsubimage2d.cube_rgba = FAIL
1095 WIN : dEQP-GLES3.functional.texture.specification.basic_copytexsubimage2d.cube_alpha = FAIL
1095 WIN : dEQP-GLES3.functional.texture.specification.basic_copytexsubimage2d.cube_luminance_alpha = FAIL
1095 WIN : dEQP-GLES3.functional.texture.specification.basic_copytexsubimage2d.cube_rgb = FAIL
1096 WIN : dEQP-GLES3.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_* = FAIL
1096 WIN : dEQP-GLES3.functional.fragment_ops.depth_stencil.stencil_ops.* = FAIL
1096 WIN : dEQP-GLES3.functional.fragment_ops.depth_stencil.write_mask.* = FAIL
......
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