Validation layer fixes for compressedtexsubimage* dEQP tests
* Change order of validation in ValidateCompressedTexSubImage3D
to get the errors in the same order as the dEQP tests are
expecting them.
* ES 3.1: Section 8.7, page 169: If the internal format is ETC2/EAC,
the target must be a GL_TEXTURE_2D_ARRAY.
* ES 3.1: Section 8.7, page 171: For sub textures, ET2/EAC formats
also requires exact size to be validated.
Bug: angleproject:2327
Change-Id: Ib049c70a52ed5683885a73fb06503898a85786d1
Reviewed-on: https://chromium-review.googlesource.com/897726
Commit-Queue: Luc Ferron <lucferron@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/validationES.cpp b/src/libANGLE/validationES.cpp
index 41e859a..1d948f8 100644
--- a/src/libANGLE/validationES.cpp
+++ b/src/libANGLE/validationES.cpp
@@ -33,7 +33,40 @@
{
namespace
{
+bool CompressedTextureFormatRequiresExactSize(GLenum internalFormat)
+{
+ // List of compressed format that require that the texture size is smaller than or a multiple of
+ // the compressed block size.
+ switch (internalFormat)
+ {
+ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
+ case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+ case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
+ case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
+ case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
+ case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
+ case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
+ case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
+ case GL_ETC1_RGB8_LOSSY_DECODE_ANGLE:
+ case GL_COMPRESSED_RGB8_LOSSY_DECODE_ETC2_ANGLE:
+ case GL_COMPRESSED_SRGB8_LOSSY_DECODE_ETC2_ANGLE:
+ case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE:
+ case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE:
+ case GL_COMPRESSED_RGBA8_LOSSY_DECODE_ETC2_EAC_ANGLE:
+ case GL_COMPRESSED_SRGB8_ALPHA8_LOSSY_DECODE_ETC2_EAC_ANGLE:
+ return true;
+ default:
+ return false;
+ }
+}
+bool CompressedSubTextureFormatRequiresExactSize(GLenum internalFormat)
+{
+ // Compressed sub textures have additional formats that requires exact size.
+ // ES 3.1, Section 8.7, Page 171
+ return CompressedTextureFormatRequiresExactSize(internalFormat) ||
+ IsETC2EACFormat(internalFormat);
+}
bool ValidateDrawAttribs(ValidationContext *context,
GLint primcount,
GLint maxVertex,
@@ -462,6 +495,28 @@
} // anonymous namespace
+bool IsETC2EACFormat(const GLenum format)
+{
+ // ES 3.1, Table 8.19
+ switch (format)
+ {
+ case GL_COMPRESSED_R11_EAC:
+ case GL_COMPRESSED_SIGNED_R11_EAC:
+ case GL_COMPRESSED_RG11_EAC:
+ case GL_COMPRESSED_SIGNED_RG11_EAC:
+ case GL_COMPRESSED_RGB8_ETC2:
+ case GL_COMPRESSED_SRGB8_ETC2:
+ case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:
+ case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:
+ case GL_COMPRESSED_RGBA8_ETC2_EAC:
+ case GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:
+ return true;
+
+ default:
+ return false;
+ }
+}
+
bool ValidTextureTarget(const ValidationContext *context, GLenum target)
{
switch (target)
@@ -736,34 +791,6 @@
return true;
}
-bool CompressedTextureFormatRequiresExactSize(GLenum internalFormat)
-{
- // List of compressed format that require that the texture size is smaller than or a multiple of
- // the compressed block size.
- switch (internalFormat)
- {
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
- case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
- case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
- case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
- case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
- case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
- case GL_ETC1_RGB8_LOSSY_DECODE_ANGLE:
- case GL_COMPRESSED_RGB8_LOSSY_DECODE_ETC2_ANGLE:
- case GL_COMPRESSED_SRGB8_LOSSY_DECODE_ETC2_ANGLE:
- case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE:
- case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE:
- case GL_COMPRESSED_RGBA8_LOSSY_DECODE_ETC2_EAC_ANGLE:
- case GL_COMPRESSED_SRGB8_ALPHA8_LOSSY_DECODE_ETC2_EAC_ANGLE:
- return true;
-
- default:
- return false;
- }
-}
-
bool ValidCompressedDimension(GLsizei size, GLuint blockSize, bool smallerThanBlockSizeAllowed)
{
return (smallerThanBlockSizeAllowed && (size > 0) && (blockSize % size == 0)) ||
@@ -826,7 +853,7 @@
return false;
}
- if (CompressedTextureFormatRequiresExactSize(internalFormat))
+ if (CompressedSubTextureFormatRequiresExactSize(internalFormat))
{
if (xoffset % formatInfo.compressedBlockWidth != 0 ||
yoffset % formatInfo.compressedBlockHeight != 0)