Commit e88e4548 by Geoff Lang Committed by Commit Bot

Implement extensions exposing ETC2 compressed texture formats in ES2.

BUG=angleproject:2527 Change-Id: I000f68366de4119375b6d3c79bc2eff3ebd5db9e Reviewed-on: https://chromium-review.googlesource.com/1042885 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org>
parent 983460e6
...@@ -160,6 +160,16 @@ Extensions::Extensions() ...@@ -160,6 +160,16 @@ Extensions::Extensions()
textureCompressionASTCHDR(false), textureCompressionASTCHDR(false),
textureCompressionASTCLDR(false), textureCompressionASTCLDR(false),
compressedETC1RGB8Texture(false), compressedETC1RGB8Texture(false),
compressedETC2RGB8Texture(false),
compressedETC2sRGB8Texture(false),
compressedETC2PunchthroughARGB8Texture(false),
compressedETC2PunchthroughAsRGB8AlphaTexture(false),
compressedETC2RGBA8Texture(false),
compressedETC2sRGB8Alpha8Texture(false),
compressedEACR11UnsignedTexture(false),
compressedEACR11SignedTexture(false),
compressedEACRG11UnsignedTexture(false),
compressedEACRG11SignedTexture(false),
sRGB(false), sRGB(false),
depthTextures(false), depthTextures(false),
depth32(false), depth32(false),
...@@ -492,6 +502,106 @@ static bool DetermineETC1RGB8TextureSupport(const TextureCapsMap &textureCaps) ...@@ -492,6 +502,106 @@ static bool DetermineETC1RGB8TextureSupport(const TextureCapsMap &textureCaps)
return GetFormatSupport(textureCaps, requiredFormats, true, true, false); return GetFormatSupport(textureCaps, requiredFormats, true, true, false);
} }
// Check for OES_compressed_ETC2_RGB8_texture
static bool DetermineETC2RGB8TextureSupport(const TextureCapsMap &textureCaps)
{
constexpr GLenum requiredFormats[] = {
GL_COMPRESSED_RGB8_ETC2,
};
return GetFormatSupport(textureCaps, requiredFormats, true, true, false);
}
// Check for OES_compressed_ETC2_sRGB8_texture
static bool DetermineETC2sRGB8TextureSupport(const TextureCapsMap &textureCaps)
{
constexpr GLenum requiredFormats[] = {
GL_COMPRESSED_SRGB8_ETC2,
};
return GetFormatSupport(textureCaps, requiredFormats, true, true, false);
}
// Check for OES_compressed_ETC2_punchthroughA_RGBA8_texture
static bool DetermineETC2PunchthroughARGB8TextureSupport(const TextureCapsMap &textureCaps)
{
constexpr GLenum requiredFormats[] = {
GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
};
return GetFormatSupport(textureCaps, requiredFormats, true, true, false);
}
// Check for OES_compressed_ETC2_punchthroughA_sRGB8_alpha_texture
static bool DetermineETC2PunchthroughAsRGB8AlphaTextureSupport(const TextureCapsMap &textureCaps)
{
constexpr GLenum requiredFormats[] = {
GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,
};
return GetFormatSupport(textureCaps, requiredFormats, true, true, false);
}
// Check for OES_compressed_ETC2_RGBA8_texture
static bool DetermineETC2RGBA8TextureSupport(const TextureCapsMap &textureCaps)
{
constexpr GLenum requiredFormats[] = {
GL_COMPRESSED_RGBA8_ETC2_EAC,
};
return GetFormatSupport(textureCaps, requiredFormats, true, true, false);
}
// Check for OES_compressed_ETC2_sRGB8_alpha8_texture
static bool DetermineETC2sRGB8Alpha8TextureSupport(const TextureCapsMap &textureCaps)
{
constexpr GLenum requiredFormats[] = {
GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,
};
return GetFormatSupport(textureCaps, requiredFormats, true, true, false);
}
// Check for OES_compressed_EAC_R11_unsigned_texture
static bool DetermineEACR11UnsignedTextureSupport(const TextureCapsMap &textureCaps)
{
constexpr GLenum requiredFormats[] = {
GL_COMPRESSED_R11_EAC,
};
return GetFormatSupport(textureCaps, requiredFormats, true, true, false);
}
// Check for OES_compressed_EAC_R11_signed_texture
static bool DetermineEACR11SignedTextureSupport(const TextureCapsMap &textureCaps)
{
constexpr GLenum requiredFormats[] = {
GL_COMPRESSED_SIGNED_R11_EAC,
};
return GetFormatSupport(textureCaps, requiredFormats, true, true, false);
}
// Check for OES_compressed_EAC_RG11_unsigned_texture
static bool DetermineEACRG11UnsignedTextureSupport(const TextureCapsMap &textureCaps)
{
constexpr GLenum requiredFormats[] = {
GL_COMPRESSED_RG11_EAC,
};
return GetFormatSupport(textureCaps, requiredFormats, true, true, false);
}
// Check for OES_compressed_EAC_RG11_signed_texture
static bool DetermineEACRG11SignedTextureSupport(const TextureCapsMap &textureCaps)
{
constexpr GLenum requiredFormats[] = {
GL_COMPRESSED_SIGNED_RG11_EAC,
};
return GetFormatSupport(textureCaps, requiredFormats, true, true, false);
}
// Check for GL_ANGLE_texture_compression_dxt5 // Check for GL_ANGLE_texture_compression_dxt5
static bool DetermineSRGBTextureSupport(const TextureCapsMap &textureCaps) static bool DetermineSRGBTextureSupport(const TextureCapsMap &textureCaps)
{ {
...@@ -591,6 +701,18 @@ void Extensions::setTextureExtensionSupport(const TextureCapsMap &textureCaps) ...@@ -591,6 +701,18 @@ void Extensions::setTextureExtensionSupport(const TextureCapsMap &textureCaps)
textureCompressionASTCHDR = DetermineASTCTextureSupport(textureCaps); textureCompressionASTCHDR = DetermineASTCTextureSupport(textureCaps);
textureCompressionASTCLDR = textureCompressionASTCHDR; textureCompressionASTCLDR = textureCompressionASTCHDR;
compressedETC1RGB8Texture = DetermineETC1RGB8TextureSupport(textureCaps); compressedETC1RGB8Texture = DetermineETC1RGB8TextureSupport(textureCaps);
compressedETC2RGB8Texture = DetermineETC2RGB8TextureSupport(textureCaps);
compressedETC2sRGB8Texture = DetermineETC2sRGB8TextureSupport(textureCaps);
compressedETC2PunchthroughARGB8Texture =
DetermineETC2PunchthroughARGB8TextureSupport(textureCaps);
compressedETC2PunchthroughAsRGB8AlphaTexture =
DetermineETC2PunchthroughAsRGB8AlphaTextureSupport(textureCaps);
compressedETC2RGBA8Texture = DetermineETC2RGBA8TextureSupport(textureCaps);
compressedETC2sRGB8Alpha8Texture = DetermineETC2sRGB8Alpha8TextureSupport(textureCaps);
compressedEACR11UnsignedTexture = DetermineEACR11UnsignedTextureSupport(textureCaps);
compressedEACR11SignedTexture = DetermineEACR11SignedTextureSupport(textureCaps);
compressedEACRG11UnsignedTexture = DetermineEACRG11UnsignedTextureSupport(textureCaps);
compressedEACRG11SignedTexture = DetermineEACRG11SignedTextureSupport(textureCaps);
sRGB = DetermineSRGBTextureSupport(textureCaps); sRGB = DetermineSRGBTextureSupport(textureCaps);
depthTextures = DetermineDepthTextureSupport(textureCaps); depthTextures = DetermineDepthTextureSupport(textureCaps);
depth32 = DetermineDepth32Support(textureCaps); depth32 = DetermineDepth32Support(textureCaps);
...@@ -640,6 +762,16 @@ const ExtensionInfoMap &GetExtensionInfoMap() ...@@ -640,6 +762,16 @@ const ExtensionInfoMap &GetExtensionInfoMap()
map["GL_KHR_texture_compression_astc_hdr"] = enableableExtension(&Extensions::textureCompressionASTCHDR); map["GL_KHR_texture_compression_astc_hdr"] = enableableExtension(&Extensions::textureCompressionASTCHDR);
map["GL_KHR_texture_compression_astc_ldr"] = enableableExtension(&Extensions::textureCompressionASTCLDR); map["GL_KHR_texture_compression_astc_ldr"] = enableableExtension(&Extensions::textureCompressionASTCLDR);
map["GL_OES_compressed_ETC1_RGB8_texture"] = enableableExtension(&Extensions::compressedETC1RGB8Texture); map["GL_OES_compressed_ETC1_RGB8_texture"] = enableableExtension(&Extensions::compressedETC1RGB8Texture);
map["OES_compressed_ETC2_RGB8_texture"] = enableableExtension(&Extensions::compressedETC2RGB8Texture);
map["OES_compressed_ETC2_sRGB8_texture"] = enableableExtension(&Extensions::compressedETC2sRGB8Texture);
map["OES_compressed_ETC2_punchthroughA_RGBA8_texture"] = enableableExtension(&Extensions::compressedETC2PunchthroughARGB8Texture);
map["OES_compressed_ETC2_punchthroughA_sRGB8_alpha_texture"] = enableableExtension(&Extensions::compressedETC2PunchthroughAsRGB8AlphaTexture);
map["OES_compressed_ETC2_RGBA8_texture"] = enableableExtension(&Extensions::compressedETC2RGBA8Texture);
map["OES_compressed_ETC2_sRGB8_alpha8_texture"] = enableableExtension(&Extensions::compressedETC2sRGB8Alpha8Texture);
map["OES_compressed_EAC_R11_unsigned_texture"] = enableableExtension(&Extensions::compressedEACR11UnsignedTexture);
map["OES_compressed_EAC_R11_signed_texture"] = enableableExtension(&Extensions::compressedEACR11SignedTexture);
map["OES_compressed_EAC_RG11_unsigned_texture"] = enableableExtension(&Extensions::compressedEACRG11UnsignedTexture);
map["OES_compressed_EAC_RG11_signed_texture"] = enableableExtension(&Extensions::compressedEACRG11SignedTexture);
map["GL_EXT_sRGB"] = enableableExtension(&Extensions::sRGB); map["GL_EXT_sRGB"] = enableableExtension(&Extensions::sRGB);
map["GL_ANGLE_depth_texture"] = esOnlyExtension(&Extensions::depthTextures); map["GL_ANGLE_depth_texture"] = esOnlyExtension(&Extensions::depthTextures);
map["GL_OES_depth32"] = esOnlyExtension(&Extensions::depth32); map["GL_OES_depth32"] = esOnlyExtension(&Extensions::depth32);
......
...@@ -183,6 +183,36 @@ struct Extensions ...@@ -183,6 +183,36 @@ struct Extensions
// Implies that TextureCaps for GL_ETC1_RGB8_OES exist // Implies that TextureCaps for GL_ETC1_RGB8_OES exist
bool compressedETC1RGB8Texture; bool compressedETC1RGB8Texture;
// OES_compressed_ETC2_RGB8_texture
bool compressedETC2RGB8Texture;
// OES_compressed_ETC2_sRGB8_texture
bool compressedETC2sRGB8Texture;
// OES_compressed_ETC2_punchthroughA_RGBA8_texture
bool compressedETC2PunchthroughARGB8Texture;
// OES_compressed_ETC2_punchthroughA_sRGB8_alpha_texture
bool compressedETC2PunchthroughAsRGB8AlphaTexture;
// OES_compressed_ETC2_RGBA8_texture
bool compressedETC2RGBA8Texture;
// OES_compressed_ETC2_sRGB8_alpha8_texture
bool compressedETC2sRGB8Alpha8Texture;
// OES_compressed_EAC_R11_unsigned_texture
bool compressedEACR11UnsignedTexture;
// OES_compressed_EAC_R11_signed_texture
bool compressedEACR11SignedTexture;
// OES_compressed_EAC_RG11_unsigned_texture
bool compressedEACRG11UnsignedTexture;
// OES_compressed_EAC_RG11_signed_texture
bool compressedEACRG11SignedTexture;
// GL_EXT_sRGB // GL_EXT_sRGB
// Implies that TextureCaps for GL_SRGB8_ALPHA8 and GL_SRGB8 exist // Implies that TextureCaps for GL_SRGB8_ALPHA8 and GL_SRGB8 exist
// TODO: Don't advertise this extension in ES3 // TODO: Don't advertise this extension in ES3
......
...@@ -758,17 +758,17 @@ static InternalFormatInfoMap BuildInternalFormatInfoMap() ...@@ -758,17 +758,17 @@ static InternalFormatInfoMap BuildInternalFormatInfoMap()
AddLUMAFormat(&map, GL_LUMINANCE_ALPHA32F_EXT, true, 32, 32, GL_LUMINANCE_ALPHA, GL_FLOAT, GL_FLOAT, RequireExtAndExt<&Extensions::textureStorage, &Extensions::textureFloat>, NeverSupported, RequireExt<&Extensions::textureFloatLinear>); AddLUMAFormat(&map, GL_LUMINANCE_ALPHA32F_EXT, true, 32, 32, GL_LUMINANCE_ALPHA, GL_FLOAT, GL_FLOAT, RequireExtAndExt<&Extensions::textureStorage, &Extensions::textureFloat>, NeverSupported, RequireExt<&Extensions::textureFloatLinear>);
// Compressed formats, From ES 3.0.1 spec, table 3.16 // Compressed formats, From ES 3.0.1 spec, table 3.16
// | Internal format |W |H | BS |CC| Format | Type | SRGB | Supported | Renderable | Filterable | // | Internal format |W |H | BS |CC| Format | Type | SRGB | Supported | Renderable | Filterable |
AddCompressedFormat(&map, GL_COMPRESSED_R11_EAC, 4, 4, 64, 1, GL_RED, GL_UNSIGNED_BYTE, false, RequireES<3, 0>, NeverSupported, AlwaysSupported); AddCompressedFormat(&map, GL_COMPRESSED_R11_EAC, 4, 4, 64, 1, GL_RED, GL_UNSIGNED_BYTE, false, RequireESOrExt<3, 0, &Extensions::compressedEACR11UnsignedTexture>, NeverSupported, AlwaysSupported);
AddCompressedFormat(&map, GL_COMPRESSED_SIGNED_R11_EAC, 4, 4, 64, 1, GL_RED, GL_UNSIGNED_BYTE, false, RequireES<3, 0>, NeverSupported, AlwaysSupported); AddCompressedFormat(&map, GL_COMPRESSED_SIGNED_R11_EAC, 4, 4, 64, 1, GL_RED, GL_UNSIGNED_BYTE, false, RequireESOrExt<3, 0, &Extensions::compressedEACR11SignedTexture>, NeverSupported, AlwaysSupported);
AddCompressedFormat(&map, GL_COMPRESSED_RG11_EAC, 4, 4, 128, 2, GL_RG, GL_UNSIGNED_BYTE, false, RequireES<3, 0>, NeverSupported, AlwaysSupported); AddCompressedFormat(&map, GL_COMPRESSED_RG11_EAC, 4, 4, 128, 2, GL_RG, GL_UNSIGNED_BYTE, false, RequireESOrExt<3, 0, &Extensions::compressedEACRG11UnsignedTexture>, NeverSupported, AlwaysSupported);
AddCompressedFormat(&map, GL_COMPRESSED_SIGNED_RG11_EAC, 4, 4, 128, 2, GL_RG, GL_UNSIGNED_BYTE, false, RequireES<3, 0>, NeverSupported, AlwaysSupported); AddCompressedFormat(&map, GL_COMPRESSED_SIGNED_RG11_EAC, 4, 4, 128, 2, GL_RG, GL_UNSIGNED_BYTE, false, RequireESOrExt<3, 0, &Extensions::compressedEACRG11SignedTexture>, NeverSupported, AlwaysSupported);
AddCompressedFormat(&map, GL_COMPRESSED_RGB8_ETC2, 4, 4, 64, 3, GL_RGB, GL_UNSIGNED_BYTE, false, RequireES<3, 0>, NeverSupported, AlwaysSupported); AddCompressedFormat(&map, GL_COMPRESSED_RGB8_ETC2, 4, 4, 64, 3, GL_RGB, GL_UNSIGNED_BYTE, false, RequireESOrExt<3, 0, &Extensions::compressedETC2RGB8Texture>, NeverSupported, AlwaysSupported);
AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_ETC2, 4, 4, 64, 3, GL_RGB, GL_UNSIGNED_BYTE, true, RequireES<3, 0>, NeverSupported, AlwaysSupported); AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_ETC2, 4, 4, 64, 3, GL_RGB, GL_UNSIGNED_BYTE, true, RequireESOrExt<3, 0, &Extensions::compressedETC2sRGB8Texture>, NeverSupported, AlwaysSupported);
AddCompressedFormat(&map, GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, 4, 4, 64, 3, GL_RGB, GL_UNSIGNED_BYTE, false, RequireES<3, 0>, NeverSupported, AlwaysSupported); AddCompressedFormat(&map, GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, 4, 4, 64, 3, GL_RGB, GL_UNSIGNED_BYTE, false, RequireESOrExt<3, 0, &Extensions::compressedETC2PunchthroughARGB8Texture>, NeverSupported, AlwaysSupported);
AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, 4, 4, 64, 3, GL_RGB, GL_UNSIGNED_BYTE, true, RequireES<3, 0>, NeverSupported, AlwaysSupported); AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, 4, 4, 64, 3, GL_RGB, GL_UNSIGNED_BYTE, true, RequireESOrExt<3, 0, &Extensions::compressedETC2PunchthroughAsRGB8AlphaTexture>, NeverSupported, AlwaysSupported);
AddCompressedFormat(&map, GL_COMPRESSED_RGBA8_ETC2_EAC, 4, 4, 128, 4, GL_RGBA, GL_UNSIGNED_BYTE, false, RequireES<3, 0>, NeverSupported, AlwaysSupported); AddCompressedFormat(&map, GL_COMPRESSED_RGBA8_ETC2_EAC, 4, 4, 128, 4, GL_RGBA, GL_UNSIGNED_BYTE, false, RequireESOrExt<3, 0, &Extensions::compressedETC2RGBA8Texture>, NeverSupported, AlwaysSupported);
AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, 4, 4, 128, 4, GL_RGBA, GL_UNSIGNED_BYTE, true, RequireES<3, 0>, NeverSupported, AlwaysSupported); AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, 4, 4, 128, 4, GL_RGBA, GL_UNSIGNED_BYTE, true, RequireESOrExt<3, 0, &Extensions::compressedETC2sRGB8Alpha8Texture>, NeverSupported, AlwaysSupported);
// From GL_EXT_texture_compression_dxt1 // From GL_EXT_texture_compression_dxt1
// | Internal format |W |H | BS |CC| Format | Type | SRGB | Supported | Renderable | Filterable | // | Internal format |W |H | BS |CC| Format | Type | SRGB | Supported | Renderable | Filterable |
......
...@@ -241,16 +241,17 @@ static InternalFormatInfoMap BuildInternalFormatInfoMap() ...@@ -241,16 +241,17 @@ static InternalFormatInfoMap BuildInternalFormatInfoMap()
InsertFormatMapping(&map, GL_LUMINANCE_ALPHA32F_EXT, VersionOrExts(3, 0, "GL_ARB_texture_float"), AlwaysSupported(), NeverSupported(), ExtsOnly("GL_EXT_texture_storage OES_texture_float"), ExtsOnly("GL_OES_texture_float_linear"), NeverSupported()); InsertFormatMapping(&map, GL_LUMINANCE_ALPHA32F_EXT, VersionOrExts(3, 0, "GL_ARB_texture_float"), AlwaysSupported(), NeverSupported(), ExtsOnly("GL_EXT_texture_storage OES_texture_float"), ExtsOnly("GL_OES_texture_float_linear"), NeverSupported());
// Compressed formats, From ES 3.0.1 spec, table 3.16 // Compressed formats, From ES 3.0.1 spec, table 3.16
InsertFormatMapping(&map, GL_COMPRESSED_R11_EAC, VersionOrExts(4, 3, "GL_ARB_ES3_compatibility"), AlwaysSupported(), NeverSupported(), VersionOnly(3, 0), AlwaysSupported(), NeverSupported()); // | Format | OpenGL texture support | Filter | Render | OpenGL ES texture support | Filter | Render |
InsertFormatMapping(&map, GL_COMPRESSED_SIGNED_R11_EAC, VersionOrExts(4, 3, "GL_ARB_ES3_compatibility"), AlwaysSupported(), NeverSupported(), VersionOnly(3, 0), AlwaysSupported(), NeverSupported()); InsertFormatMapping(&map, GL_COMPRESSED_R11_EAC, VersionOrExts(4, 3, "GL_ARB_ES3_compatibility"), AlwaysSupported(), NeverSupported(), VersionOrExts(3, 0, "OES_compressed_EAC_R11_unsigned_texture"), AlwaysSupported(), NeverSupported());
InsertFormatMapping(&map, GL_COMPRESSED_RG11_EAC, VersionOrExts(4, 3, "GL_ARB_ES3_compatibility"), AlwaysSupported(), NeverSupported(), VersionOnly(3, 0), AlwaysSupported(), NeverSupported()); InsertFormatMapping(&map, GL_COMPRESSED_SIGNED_R11_EAC, VersionOrExts(4, 3, "GL_ARB_ES3_compatibility"), AlwaysSupported(), NeverSupported(), VersionOrExts(3, 0, "OES_compressed_EAC_R11_signed_texture"), AlwaysSupported(), NeverSupported());
InsertFormatMapping(&map, GL_COMPRESSED_SIGNED_RG11_EAC, VersionOrExts(4, 3, "GL_ARB_ES3_compatibility"), AlwaysSupported(), NeverSupported(), VersionOnly(3, 0), AlwaysSupported(), NeverSupported()); InsertFormatMapping(&map, GL_COMPRESSED_RG11_EAC, VersionOrExts(4, 3, "GL_ARB_ES3_compatibility"), AlwaysSupported(), NeverSupported(), VersionOrExts(3, 0, "OES_compressed_EAC_RG11_unsigned_texture"), AlwaysSupported(), NeverSupported());
InsertFormatMapping(&map, GL_COMPRESSED_RGB8_ETC2, VersionOrExts(4, 3, "GL_ARB_ES3_compatibility"), AlwaysSupported(), NeverSupported(), VersionOnly(3, 0), AlwaysSupported(), NeverSupported()); InsertFormatMapping(&map, GL_COMPRESSED_SIGNED_RG11_EAC, VersionOrExts(4, 3, "GL_ARB_ES3_compatibility"), AlwaysSupported(), NeverSupported(), VersionOrExts(3, 0, "OES_compressed_EAC_RG11_signed_texture"), AlwaysSupported(), NeverSupported());
InsertFormatMapping(&map, GL_COMPRESSED_SRGB8_ETC2, VersionOrExts(4, 3, "GL_ARB_ES3_compatibility"), AlwaysSupported(), NeverSupported(), VersionOnly(3, 0), AlwaysSupported(), NeverSupported()); InsertFormatMapping(&map, GL_COMPRESSED_RGB8_ETC2, VersionOrExts(4, 3, "GL_ARB_ES3_compatibility"), AlwaysSupported(), NeverSupported(), VersionOrExts(3, 0, "OES_compressed_ETC2_RGB8_texture"), AlwaysSupported(), NeverSupported());
InsertFormatMapping(&map, GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, VersionOrExts(4, 3, "GL_ARB_ES3_compatibility"), AlwaysSupported(), NeverSupported(), VersionOnly(3, 0), AlwaysSupported(), NeverSupported()); InsertFormatMapping(&map, GL_COMPRESSED_SRGB8_ETC2, VersionOrExts(4, 3, "GL_ARB_ES3_compatibility"), AlwaysSupported(), NeverSupported(), VersionOrExts(3, 0, "OES_compressed_ETC2_sRGB8_texture"), AlwaysSupported(), NeverSupported());
InsertFormatMapping(&map, GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, VersionOrExts(4, 3, "GL_ARB_ES3_compatibility"), AlwaysSupported(), NeverSupported(), VersionOnly(3, 0), AlwaysSupported(), NeverSupported()); InsertFormatMapping(&map, GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, VersionOrExts(4, 3, "GL_ARB_ES3_compatibility"), AlwaysSupported(), NeverSupported(), VersionOrExts(3, 0, "OES_compressed_ETC2_punchthroughA_RGBA8_texture"), AlwaysSupported(), NeverSupported());
InsertFormatMapping(&map, GL_COMPRESSED_RGBA8_ETC2_EAC, VersionOrExts(4, 3, "GL_ARB_ES3_compatibility"), AlwaysSupported(), NeverSupported(), VersionOnly(3, 0), AlwaysSupported(), NeverSupported()); InsertFormatMapping(&map, GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, VersionOrExts(4, 3, "GL_ARB_ES3_compatibility"), AlwaysSupported(), NeverSupported(), VersionOrExts(3, 0, "OES_compressed_ETC2_punchthroughA_sRGB8_alpha_texture"), AlwaysSupported(), NeverSupported());
InsertFormatMapping(&map, GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, VersionOrExts(4, 3, "GL_ARB_ES3_compatibility"), AlwaysSupported(), NeverSupported(), VersionOnly(3, 0), AlwaysSupported(), NeverSupported()); InsertFormatMapping(&map, GL_COMPRESSED_RGBA8_ETC2_EAC, VersionOrExts(4, 3, "GL_ARB_ES3_compatibility"), AlwaysSupported(), NeverSupported(), VersionOrExts(3, 0, "OES_compressed_ETC2_RGBA8_texture"), AlwaysSupported(), NeverSupported());
InsertFormatMapping(&map, GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, VersionOrExts(4, 3, "GL_ARB_ES3_compatibility"), AlwaysSupported(), NeverSupported(), VersionOrExts(3, 0, "OES_compressed_ETC2_sRGB8_alpha8_texture"), AlwaysSupported(), NeverSupported());
// From GL_EXT_texture_compression_dxt1 // From GL_EXT_texture_compression_dxt1
// | Format | OpenGL texture support | Filter | Render | OpenGL ES texture support | Filter | Render | // | Format | OpenGL texture support | Filter | Render | OpenGL ES texture support | Filter | Render |
......
...@@ -1192,70 +1192,34 @@ bool ValidateES2TexImageParameters(Context *context, ...@@ -1192,70 +1192,34 @@ bool ValidateES2TexImageParameters(Context *context,
GLenum actualInternalFormat = GLenum actualInternalFormat =
isSubImage ? texture->getFormat(target, level).info->sizedInternalFormat isSubImage ? texture->getFormat(target, level).info->sizedInternalFormat
: internalformat; : internalformat;
switch (actualInternalFormat)
const InternalFormat &internalFormatInfo = GetSizedInternalFormatInfo(actualInternalFormat);
if (!internalFormatInfo.compressed)
{ {
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidInternalFormat);
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: return false;
if (!context->getExtensions().textureCompressionDXT1) }
{
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidInternalFormat); if (!internalFormatInfo.textureSupport(context->getClientVersion(),
return false; context->getExtensions()))
} {
break; ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidInternalFormat);
case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE: return false;
if (!context->getExtensions().textureCompressionDXT3)
{
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidInternalFormat);
return false;
}
break;
case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
if (!context->getExtensions().textureCompressionDXT5)
{
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidInternalFormat);
return false;
}
break;
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:
if (!context->getExtensions().textureCompressionS3TCsRGB)
{
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidInternalFormat);
return false;
}
break;
case GL_ETC1_RGB8_OES:
if (!context->getExtensions().compressedETC1RGB8Texture)
{
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidInternalFormat);
return false;
}
if (isSubImage)
{
ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidInternalFormat);
return false;
}
break;
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:
if (!context->getExtensions().lossyETCDecode)
{
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidInternalFormat);
return false;
}
break;
default:
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidInternalFormat);
return false;
} }
if (isSubImage) if (isSubImage)
{ {
// From the OES_compressed_ETC1_RGB8_texture spec:
// INVALID_OPERATION is generated by CompressedTexSubImage2D, TexSubImage2D, or
// CopyTexSubImage2D if the texture image <level> bound to <target> has internal format
// ETC1_RGB8_OES.
if (actualInternalFormat == GL_ETC1_RGB8_OES)
{
ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidInternalFormat);
return false;
}
if (!ValidCompressedSubImageSize(context, actualInternalFormat, xoffset, yoffset, width, if (!ValidCompressedSubImageSize(context, actualInternalFormat, xoffset, yoffset, width,
height, texture->getWidth(target, level), height, texture->getWidth(target, level),
texture->getHeight(target, level))) texture->getHeight(target, level)))
......
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