Commit 46c88567 by Tim Van Patten Committed by Commit Bot

Correct glCompressedTexSubImage3D() Parameter Checking

GL_INVALID_OPERATION is generated if format is an ETC2/EAC format and the target is not GL_TEXTURE_2D_ARRAY. Bug: angleproject:3895 Test: dEQP-GLES3.functional.negative_api.texture.compressedtex*image3d Test: KHR-GLES2.texture_3d.compressed_texture.negative_compressed_tex_image Change-Id: I7f653192328f0bb067cc4a0c0285a2d3acec7024 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1784060 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent c1af9abf
...@@ -475,6 +475,17 @@ bool ValidateES3TexImageParametersBase(Context *context, ...@@ -475,6 +475,17 @@ bool ValidateES3TexImageParametersBase(Context *context,
return false; return false;
} }
if (isCompressed && texType == TextureType::_3D)
{
GLenum compressedDataFormat = isSubImage ? format : internalformat;
if (IsETC2EACFormat(compressedDataFormat))
{
// ES 3.1, Section 8.7, page 169.
context->validationError(GL_INVALID_OPERATION, kInternalFormatRequiresTexture2DArray);
return false;
}
}
// Validate texture formats // Validate texture formats
GLenum actualInternalFormat = GLenum actualInternalFormat =
isSubImage ? texture->getFormat(target, level).info->internalFormat : internalformat; isSubImage ? texture->getFormat(target, level).info->internalFormat : internalformat;
...@@ -534,13 +545,6 @@ bool ValidateES3TexImageParametersBase(Context *context, ...@@ -534,13 +545,6 @@ bool ValidateES3TexImageParametersBase(Context *context,
return false; return false;
} }
if ((texType == TextureType::_3D) && IsETC2EACFormat(internalformat))
{
// ES 3.1, Section 8.7, page 169.
context->validationError(GL_INVALID_OPERATION, kInternalFormatRequiresTexture2DArray);
return false;
}
// Disallow 3D-only compressed formats from being set on 2D textures // Disallow 3D-only compressed formats from being set on 2D textures
if (actualFormatInfo.compressedBlockDepth > 1 && texType != TextureType::_2DArray) if (actualFormatInfo.compressedBlockDepth > 1 && texType != TextureType::_2DArray)
{ {
......
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