Commit 6e653981 by Le Quyen Committed by Commit Bot

Added PVRTC compression extension needed for Metal on iOS.

Bug: angleproject:2634 Change-Id: I413f754fe5551b1e248bc2b824b327b92d8c70f9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1849076 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent ad5f7164
...@@ -59,3 +59,4 @@ Thomas Miller ...@@ -59,3 +59,4 @@ Thomas Miller
Till Rathmann Till Rathmann
Nick Shaforostov Nick Shaforostov
Jaime Bernardo Jaime Bernardo
Le Hoang Quyen
{ {
"src/libANGLE/renderer/FormatID_autogen.h": "src/libANGLE/renderer/FormatID_autogen.h":
"0e45fa793ccf180d7f608dbe2d9927a5", "6df4632c2908751635396a073c206da6",
"src/libANGLE/renderer/Format_table_autogen.cpp": "src/libANGLE/renderer/Format_table_autogen.cpp":
"808c9476e937a1d79d41451c84622541", "69d5325f5a71af4d7a5017b0a85743a4",
"src/libANGLE/renderer/angle_format.py": "src/libANGLE/renderer/angle_format.py":
"32ba71942c0fd00e6807104f1bb80a3c", "32ba71942c0fd00e6807104f1bb80a3c",
"src/libANGLE/renderer/angle_format_data.json": "src/libANGLE/renderer/angle_format_data.json":
"e39704d451d108335e737c39ad423113", "b0c39827c36941a283f679345fea6d3e",
"src/libANGLE/renderer/angle_format_map.json": "src/libANGLE/renderer/angle_format_map.json":
"7c89f37c637323a34f4ec46ca11a6078", "bca5e686001f6dd0af306af234a36677",
"src/libANGLE/renderer/gen_angle_format_table.py": "src/libANGLE/renderer/gen_angle_format_table.py":
"8e349a643e81a028ebb54bde3756f9f7" "8e349a643e81a028ebb54bde3756f9f7"
} }
\ No newline at end of file
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
"src/libANGLE/renderer/d3d/d3d11/texture_format_data.json": "src/libANGLE/renderer/d3d/d3d11/texture_format_data.json":
"d7483ece817e819588f4ca157716dc7b", "d7483ece817e819588f4ca157716dc7b",
"src/libANGLE/renderer/d3d/d3d11/texture_format_map.json": "src/libANGLE/renderer/d3d/d3d11/texture_format_map.json":
"511730c698bfc3da18f745d2036c70c7", "e9dfbd51ff183809f595f8fc5db9c217",
"src/libANGLE/renderer/d3d/d3d11/texture_format_table_autogen.cpp": "src/libANGLE/renderer/d3d/d3d11/texture_format_table_autogen.cpp":
"2e6fef6d2b8bfb0da5a90f5e6aa550b8" "03d2b85db28de5c94f1e38d2ed4ee385"
} }
\ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"src/libANGLE/renderer/angle_format.py": "src/libANGLE/renderer/angle_format.py":
"32ba71942c0fd00e6807104f1bb80a3c", "32ba71942c0fd00e6807104f1bb80a3c",
"src/libANGLE/renderer/angle_format_map.json": "src/libANGLE/renderer/angle_format_map.json":
"7c89f37c637323a34f4ec46ca11a6078", "bca5e686001f6dd0af306af234a36677",
"src/libANGLE/renderer/d3d/d3d11/dxgi_format_data.json": "src/libANGLE/renderer/d3d/d3d11/dxgi_format_data.json":
"24f525b05dc665fbbc8c6d68fb863719", "24f525b05dc665fbbc8c6d68fb863719",
"src/libANGLE/renderer/d3d/d3d11/dxgi_format_map_autogen.cpp": "src/libANGLE/renderer/d3d/d3d11/dxgi_format_map_autogen.cpp":
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
"src/libANGLE/es3_format_type_combinations.json": "src/libANGLE/es3_format_type_combinations.json":
"b44b222c27eea6839c0da3076ee540fc", "b44b222c27eea6839c0da3076ee540fc",
"src/libANGLE/format_map_autogen.cpp": "src/libANGLE/format_map_autogen.cpp":
"e59660c3ae6360cb8638fc69583ba7a2", "4b9927afc6cc47fcea6bfcbcd602b6e5",
"src/libANGLE/format_map_data.json": "src/libANGLE/format_map_data.json":
"e7985d3132fa396e8d39a5daee29260a", "2dd1986f49c441ad9a71b82410f57d6e",
"src/libANGLE/gen_format_map.py": "src/libANGLE/gen_format_map.py":
"dbc855d50826670a9e1a4ff2747e7583" "dbc855d50826670a9e1a4ff2747e7583"
} }
\ No newline at end of file
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
"src/libANGLE/renderer/angle_format.py": "src/libANGLE/renderer/angle_format.py":
"32ba71942c0fd00e6807104f1bb80a3c", "32ba71942c0fd00e6807104f1bb80a3c",
"src/libANGLE/renderer/angle_format_map.json": "src/libANGLE/renderer/angle_format_map.json":
"7c89f37c637323a34f4ec46ca11a6078", "bca5e686001f6dd0af306af234a36677",
"src/libANGLE/renderer/vulkan/gen_vk_format_table.py": "src/libANGLE/renderer/vulkan/gen_vk_format_table.py":
"ed6800108a872709e5e53fde2833aa86", "ed6800108a872709e5e53fde2833aa86",
"src/libANGLE/renderer/vulkan/vk_format_map.json": "src/libANGLE/renderer/vulkan/vk_format_map.json":
"ef0c23a6620215cfacfc690e9995ba31", "ef0c23a6620215cfacfc690e9995ba31",
"src/libANGLE/renderer/vulkan/vk_format_table_autogen.cpp": "src/libANGLE/renderer/vulkan/vk_format_table_autogen.cpp":
"ab30905d3d43b2186296f85c69db7e20" "8363fab619a371c0892f2bebaa480965"
} }
\ No newline at end of file
...@@ -662,6 +662,26 @@ static bool DetermineBPTCTextureSupport(const TextureCapsMap &textureCaps) ...@@ -662,6 +662,26 @@ static bool DetermineBPTCTextureSupport(const TextureCapsMap &textureCaps)
return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false); return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false);
} }
// Check for GL_IMG_texture_compression_pvrtc
static bool DeterminePVRTCTextureSupport(const TextureCapsMap &textureCaps)
{
constexpr GLenum requiredFormats[] = {
GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG, GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG,
GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG, GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG};
return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false);
}
// Check for GL_EXT_pvrtc_sRGB
static bool DeterminePVRTCsRGBTextureSupport(const TextureCapsMap &textureCaps)
{
constexpr GLenum requiredFormats[] = {
GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT, GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT,
GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT, GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT};
return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false);
}
bool DetermineCompressedTextureETCSupport(const TextureCapsMap &textureCaps) bool DetermineCompressedTextureETCSupport(const TextureCapsMap &textureCaps)
{ {
constexpr GLenum requiredFormats[] = {GL_COMPRESSED_R11_EAC, constexpr GLenum requiredFormats[] = {GL_COMPRESSED_R11_EAC,
...@@ -722,6 +742,8 @@ void Extensions::setTextureExtensionSupport(const TextureCapsMap &textureCaps) ...@@ -722,6 +742,8 @@ void Extensions::setTextureExtensionSupport(const TextureCapsMap &textureCaps)
colorBufferFloat = DetermineColorBufferFloatSupport(textureCaps); colorBufferFloat = DetermineColorBufferFloatSupport(textureCaps);
textureNorm16 = DetermineTextureNorm16Support(textureCaps); textureNorm16 = DetermineTextureNorm16Support(textureCaps);
textureCompressionBPTC = DetermineBPTCTextureSupport(textureCaps); textureCompressionBPTC = DetermineBPTCTextureSupport(textureCaps);
compressedTexturePVRTC = DeterminePVRTCTextureSupport(textureCaps);
compressedTexturePVRTCsRGB = DeterminePVRTCsRGBTextureSupport(textureCaps);
} }
const ExtensionInfoMap &GetExtensionInfoMap() const ExtensionInfoMap &GetExtensionInfoMap()
...@@ -778,6 +800,8 @@ const ExtensionInfoMap &GetExtensionInfoMap() ...@@ -778,6 +800,8 @@ const ExtensionInfoMap &GetExtensionInfoMap()
map["GL_OES_compressed_EAC_RG11_unsigned_texture"] = enableableExtension(&Extensions::compressedEACRG11UnsignedTexture); map["GL_OES_compressed_EAC_RG11_unsigned_texture"] = enableableExtension(&Extensions::compressedEACRG11UnsignedTexture);
map["GL_OES_compressed_EAC_RG11_signed_texture"] = enableableExtension(&Extensions::compressedEACRG11SignedTexture); map["GL_OES_compressed_EAC_RG11_signed_texture"] = enableableExtension(&Extensions::compressedEACRG11SignedTexture);
map["GL_ANGLE_compressed_texture_etc"] = enableableExtension(&Extensions::compressedTextureETC); map["GL_ANGLE_compressed_texture_etc"] = enableableExtension(&Extensions::compressedTextureETC);
map["GL_IMG_texture_compression_pvrtc"] = enableableExtension(&Extensions::compressedTexturePVRTC);
map["GL_EXT_pvrtc_sRGB"] = enableableExtension(&Extensions::compressedTexturePVRTCsRGB);
map["GL_EXT_sRGB"] = enableableExtension(&Extensions::sRGB); map["GL_EXT_sRGB"] = enableableExtension(&Extensions::sRGB);
map["GL_ANGLE_depth_texture"] = esOnlyExtension(&Extensions::depthTextureANGLE); map["GL_ANGLE_depth_texture"] = esOnlyExtension(&Extensions::depthTextureANGLE);
map["GL_OES_depth_texture"] = esOnlyExtension(&Extensions::depthTextureOES); map["GL_OES_depth_texture"] = esOnlyExtension(&Extensions::depthTextureOES);
......
...@@ -241,6 +241,12 @@ struct Extensions ...@@ -241,6 +241,12 @@ struct Extensions
// individual formats required to support this extension are available. // individual formats required to support this extension are available.
bool compressedTextureETC = false; bool compressedTextureETC = false;
// GL_IMG_texture_compression_pvrtc
bool compressedTexturePVRTC = false;
// GL_EXT_pvrtc_sRGB
bool compressedTexturePVRTCsRGB = false;
// 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
......
...@@ -62,6 +62,26 @@ GLenum GetSizedFormatInternal(GLenum format, GLenum type) ...@@ -62,6 +62,26 @@ GLenum GetSizedFormatInternal(GLenum format, GLenum type)
} }
break; break;
case GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:
switch (type)
{
case GL_UNSIGNED_BYTE:
return GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;
default:
break;
}
break;
case GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:
switch (type)
{
case GL_UNSIGNED_BYTE:
return GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;
default:
break;
}
break;
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
switch (type) switch (type)
{ {
...@@ -112,6 +132,26 @@ GLenum GetSizedFormatInternal(GLenum format, GLenum type) ...@@ -112,6 +132,26 @@ GLenum GetSizedFormatInternal(GLenum format, GLenum type)
} }
break; break;
case GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG:
switch (type)
{
case GL_UNSIGNED_BYTE:
return GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG;
default:
break;
}
break;
case GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG:
switch (type)
{
case GL_UNSIGNED_BYTE:
return GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG;
default:
break;
}
break;
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
switch (type) switch (type)
{ {
...@@ -132,6 +172,26 @@ GLenum GetSizedFormatInternal(GLenum format, GLenum type) ...@@ -132,6 +172,26 @@ GLenum GetSizedFormatInternal(GLenum format, GLenum type)
} }
break; break;
case GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT:
switch (type)
{
case GL_UNSIGNED_BYTE:
return GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT;
default:
break;
}
break;
case GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT:
switch (type)
{
case GL_UNSIGNED_BYTE:
return GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT;
default:
break;
}
break;
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
switch (type) switch (type)
{ {
...@@ -162,6 +222,26 @@ GLenum GetSizedFormatInternal(GLenum format, GLenum type) ...@@ -162,6 +222,26 @@ GLenum GetSizedFormatInternal(GLenum format, GLenum type)
} }
break; break;
case GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT:
switch (type)
{
case GL_UNSIGNED_BYTE:
return GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT;
default:
break;
}
break;
case GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT:
switch (type)
{
case GL_UNSIGNED_BYTE:
return GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT;
default:
break;
}
break;
case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT: case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
switch (type) switch (type)
{ {
......
...@@ -151,5 +151,29 @@ ...@@ -151,5 +151,29 @@
"GL_DEPTH_STENCIL": { "GL_DEPTH_STENCIL": {
"GL_UNSIGNED_INT_24_8": "GL_DEPTH24_STENCIL8", "GL_UNSIGNED_INT_24_8": "GL_DEPTH24_STENCIL8",
"GL_FLOAT_32_UNSIGNED_INT_24_8_REV": "GL_DEPTH32F_STENCIL8" "GL_FLOAT_32_UNSIGNED_INT_24_8_REV": "GL_DEPTH32F_STENCIL8"
},
"GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG": {
"GL_UNSIGNED_BYTE": "GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG"
},
"GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG": {
"GL_UNSIGNED_BYTE": "GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG"
},
"GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG": {
"GL_UNSIGNED_BYTE": "GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG"
},
"GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG": {
"GL_UNSIGNED_BYTE": "GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG"
},
"GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT": {
"GL_UNSIGNED_BYTE": "GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT"
},
"GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT": {
"GL_UNSIGNED_BYTE": "GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT"
},
"GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT": {
"GL_UNSIGNED_BYTE": "GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT"
},
"GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT": {
"GL_UNSIGNED_BYTE": "GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT"
} }
} }
...@@ -392,6 +392,11 @@ GLenum InternalFormat::getReadPixelsType(const Version &version) const ...@@ -392,6 +392,11 @@ GLenum InternalFormat::getReadPixelsType(const Version &version) const
} }
} }
bool InternalFormat::supportSubImage() const
{
return !CompressedFormatRequiresWholeImage(internalFormat);
}
bool InternalFormat::isRequiredRenderbufferFormat(const Version &version) const bool InternalFormat::isRequiredRenderbufferFormat(const Version &version) const
{ {
// GLES 3.0.5 section 4.4.2.2: // GLES 3.0.5 section 4.4.2.2:
...@@ -932,6 +937,20 @@ static InternalFormatInfoMap BuildInternalFormatInfoMap() ...@@ -932,6 +937,20 @@ static InternalFormatInfoMap BuildInternalFormatInfoMap()
AddCompressedFormat(&map, GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT, 4, 4, 1, 128, 4, false, RequireExt<&Extensions::textureCompressionBPTC>, AlwaysSupported, NeverSupported, NeverSupported); AddCompressedFormat(&map, GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT, 4, 4, 1, 128, 4, false, RequireExt<&Extensions::textureCompressionBPTC>, AlwaysSupported, NeverSupported, NeverSupported);
AddCompressedFormat(&map, GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT, 4, 4, 1, 128, 4, false, RequireExt<&Extensions::textureCompressionBPTC>, AlwaysSupported, NeverSupported, NeverSupported); AddCompressedFormat(&map, GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT, 4, 4, 1, 128, 4, false, RequireExt<&Extensions::textureCompressionBPTC>, AlwaysSupported, NeverSupported, NeverSupported);
// From GL_IMG_texture_compression_pvrtc
// | Internal format | W | H | D | BS |CC| SRGB | Texture supported | Filterable | Texture attachment | Renderbuffer |
AddCompressedFormat(&map, GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG, 1, 1, 1, 1, 3, false, RequireExt<&Extensions::compressedTexturePVRTC>, AlwaysSupported, NeverSupported, NeverSupported);
AddCompressedFormat(&map, GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG, 1, 1, 1, 1, 3, false, RequireExt<&Extensions::compressedTexturePVRTC>, AlwaysSupported, NeverSupported, NeverSupported);
AddCompressedFormat(&map, GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG, 1, 1, 1, 1, 4, false, RequireExt<&Extensions::compressedTexturePVRTC>, AlwaysSupported, NeverSupported, NeverSupported);
AddCompressedFormat(&map, GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG, 1, 1, 1, 1, 4, false, RequireExt<&Extensions::compressedTexturePVRTC>, AlwaysSupported, NeverSupported, NeverSupported);
// From GL_EXT_pvrtc_sRGB
// | Internal format | W | H | D | BS |CC| SRGB | Texture supported | Filterable | Texture attachment | Renderbuffer |
AddCompressedFormat(&map, GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT, 1, 1, 1, 1, 3, true, RequireExt<&Extensions::compressedTexturePVRTCsRGB>, AlwaysSupported, NeverSupported, NeverSupported);
AddCompressedFormat(&map, GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT, 1, 1, 1, 1, 3, true, RequireExt<&Extensions::compressedTexturePVRTCsRGB>, AlwaysSupported, NeverSupported, NeverSupported);
AddCompressedFormat(&map, GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT, 1, 1, 1, 1, 4, true, RequireExt<&Extensions::compressedTexturePVRTCsRGB>, AlwaysSupported, NeverSupported, NeverSupported);
AddCompressedFormat(&map, GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT, 1, 1, 1, 1, 4, true, RequireExt<&Extensions::compressedTexturePVRTCsRGB>, AlwaysSupported, NeverSupported, NeverSupported);
// For STENCIL_INDEX8 we chose a normalized component type for the following reasons: // For STENCIL_INDEX8 we chose a normalized component type for the following reasons:
// - Multisampled buffer are disallowed for non-normalized integer component types and we want to support it for STENCIL_INDEX8 // - Multisampled buffer are disallowed for non-normalized integer component types and we want to support it for STENCIL_INDEX8
// - All other stencil formats (all depth-stencil) are either float or normalized // - All other stencil formats (all depth-stencil) are either float or normalized
...@@ -1350,6 +1369,27 @@ GLenum GetUnsizedFormat(GLenum internalFormat) ...@@ -1350,6 +1369,27 @@ GLenum GetUnsizedFormat(GLenum internalFormat)
return internalFormat; return internalFormat;
} }
bool CompressedFormatRequiresWholeImage(GLenum internalFormat)
{
// List of compressed texture format that require that the sub-image size is equal to texture's
// respective mip level's size
switch (internalFormat)
{
case GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG:
case GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG:
case GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:
case GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:
case GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT:
case GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT:
case GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT:
case GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT:
return true;
default:
return false;
}
}
const FormatSet &GetAllSizedInternalFormats() const FormatSet &GetAllSizedInternalFormats()
{ {
static angle::base::NoDestructor<FormatSet> formatSet(BuildAllSizedInternalFormatSet()); static angle::base::NoDestructor<FormatSet> formatSet(BuildAllSizedInternalFormatSet());
......
...@@ -120,6 +120,9 @@ struct InternalFormat ...@@ -120,6 +120,9 @@ struct InternalFormat
GLenum getReadPixelsFormat() const; GLenum getReadPixelsFormat() const;
GLenum getReadPixelsType(const Version &version) const; GLenum getReadPixelsType(const Version &version) const;
// Support upload a portion of image?
bool supportSubImage() const;
// Return true if the format is a required renderbuffer format in the given version of the core // Return true if the format is a required renderbuffer format in the given version of the core
// spec. Note that it isn't always clear whether all the rules that apply to core required // spec. Note that it isn't always clear whether all the rules that apply to core required
// renderbuffer formats also apply to additional formats added by extensions. Because of this // renderbuffer formats also apply to additional formats added by extensions. Because of this
...@@ -205,6 +208,9 @@ const InternalFormat &GetInternalFormatInfo(GLenum internalFormat, GLenum type); ...@@ -205,6 +208,9 @@ const InternalFormat &GetInternalFormatInfo(GLenum internalFormat, GLenum type);
// format is valid. // format is valid.
GLenum GetUnsizedFormat(GLenum internalFormat); GLenum GetUnsizedFormat(GLenum internalFormat);
// Return whether the compressed format requires whole image/mip level to be uploaded to texture.
bool CompressedFormatRequiresWholeImage(GLenum internalFormat);
typedef std::set<GLenum> FormatSet; typedef std::set<GLenum> FormatSet;
const FormatSet &GetAllSizedInternalFormats(); const FormatSet &GetAllSizedInternalFormats();
......
...@@ -120,6 +120,14 @@ enum class FormatID ...@@ -120,6 +120,14 @@ enum class FormatID
L32_FLOAT, L32_FLOAT,
L8A8_UNORM, L8A8_UNORM,
L8_UNORM, L8_UNORM,
PVRTC1_RGBA_2BPP_UNORM_BLOCK,
PVRTC1_RGBA_2BPP_UNORM_SRGB_BLOCK,
PVRTC1_RGBA_4BPP_UNORM_BLOCK,
PVRTC1_RGBA_4BPP_UNORM_SRGB_BLOCK,
PVRTC1_RGB_2BPP_UNORM_BLOCK,
PVRTC1_RGB_2BPP_UNORM_SRGB_BLOCK,
PVRTC1_RGB_4BPP_UNORM_BLOCK,
PVRTC1_RGB_4BPP_UNORM_SRGB_BLOCK,
R10G10B10A2_SINT, R10G10B10A2_SINT,
R10G10B10A2_SNORM, R10G10B10A2_SNORM,
R10G10B10A2_SSCALED, R10G10B10A2_SSCALED,
...@@ -229,7 +237,7 @@ enum class FormatID ...@@ -229,7 +237,7 @@ enum class FormatID
X2R10G10B10_USCALED_VERTEX X2R10G10B10_USCALED_VERTEX
}; };
constexpr uint32_t kNumANGLEFormats = 210; constexpr uint32_t kNumANGLEFormats = 218;
} // namespace angle } // namespace angle
......
...@@ -127,6 +127,14 @@ const Format gFormatInfoTable[] = { ...@@ -127,6 +127,14 @@ const Format gFormatInfoTable[] = {
{ FormatID::L32_FLOAT, GL_LUMINANCE32F_EXT, GL_LUMINANCE32F_EXT, GenerateMip<L32F>, NoCopyFunctions, ReadColor<L32F, GLfloat>, WriteColor<L32F, GLfloat>, GL_FLOAT, 0, 0, 0, 0, 32, 0, 0, 4, std::numeric_limits<GLuint>::max(), false, false, false, gl::VertexAttribType::Float }, { FormatID::L32_FLOAT, GL_LUMINANCE32F_EXT, GL_LUMINANCE32F_EXT, GenerateMip<L32F>, NoCopyFunctions, ReadColor<L32F, GLfloat>, WriteColor<L32F, GLfloat>, GL_FLOAT, 0, 0, 0, 0, 32, 0, 0, 4, std::numeric_limits<GLuint>::max(), false, false, false, gl::VertexAttribType::Float },
{ FormatID::L8A8_UNORM, GL_LUMINANCE8_ALPHA8_EXT, GL_LUMINANCE8_ALPHA8_EXT, GenerateMip<L8A8>, NoCopyFunctions, ReadColor<L8A8, GLfloat>, WriteColor<L8A8, GLfloat>, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 8, 8, 0, 0, 2, std::numeric_limits<GLuint>::max(), false, false, false, gl::VertexAttribType::InvalidEnum }, { FormatID::L8A8_UNORM, GL_LUMINANCE8_ALPHA8_EXT, GL_LUMINANCE8_ALPHA8_EXT, GenerateMip<L8A8>, NoCopyFunctions, ReadColor<L8A8, GLfloat>, WriteColor<L8A8, GLfloat>, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 8, 8, 0, 0, 2, std::numeric_limits<GLuint>::max(), false, false, false, gl::VertexAttribType::InvalidEnum },
{ FormatID::L8_UNORM, GL_LUMINANCE8_EXT, GL_LUMINANCE8_EXT, GenerateMip<L8>, NoCopyFunctions, ReadColor<L8, GLfloat>, WriteColor<L8, GLfloat>, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 8, 0, 0, 1, std::numeric_limits<GLuint>::max(), false, false, false, gl::VertexAttribType::InvalidEnum }, { FormatID::L8_UNORM, GL_LUMINANCE8_EXT, GL_LUMINANCE8_EXT, GenerateMip<L8>, NoCopyFunctions, ReadColor<L8, GLfloat>, WriteColor<L8, GLfloat>, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 8, 0, 0, 1, std::numeric_limits<GLuint>::max(), false, false, false, gl::VertexAttribType::InvalidEnum },
{ FormatID::PVRTC1_RGBA_2BPP_UNORM_BLOCK, GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG, GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 1, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
{ FormatID::PVRTC1_RGBA_2BPP_UNORM_SRGB_BLOCK, GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT, GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 1, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
{ FormatID::PVRTC1_RGBA_4BPP_UNORM_BLOCK, GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG, GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 1, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
{ FormatID::PVRTC1_RGBA_4BPP_UNORM_SRGB_BLOCK, GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT, GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 1, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
{ FormatID::PVRTC1_RGB_2BPP_UNORM_BLOCK, GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG, GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 1, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
{ FormatID::PVRTC1_RGB_2BPP_UNORM_SRGB_BLOCK, GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT, GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 1, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
{ FormatID::PVRTC1_RGB_4BPP_UNORM_BLOCK, GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG, GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 1, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
{ FormatID::PVRTC1_RGB_4BPP_UNORM_SRGB_BLOCK, GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT, GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 1, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
{ FormatID::R10G10B10A2_SINT, GL_RGB10_A2_SINT_ANGLEX, GL_RGB10_A2_SINT_ANGLEX, GenerateMip<R10G10B10A2S>, NoCopyFunctions, ReadColor<R10G10B10A2S, GLint>, WriteColor<R10G10B10A2S, GLint>, GL_INT, 10, 10, 10, 2, 0, 0, 0, 4, std::numeric_limits<GLuint>::max(), false, false, false, gl::VertexAttribType::Int2101010 }, { FormatID::R10G10B10A2_SINT, GL_RGB10_A2_SINT_ANGLEX, GL_RGB10_A2_SINT_ANGLEX, GenerateMip<R10G10B10A2S>, NoCopyFunctions, ReadColor<R10G10B10A2S, GLint>, WriteColor<R10G10B10A2S, GLint>, GL_INT, 10, 10, 10, 2, 0, 0, 0, 4, std::numeric_limits<GLuint>::max(), false, false, false, gl::VertexAttribType::Int2101010 },
{ FormatID::R10G10B10A2_SNORM, GL_RGB10_A2_SNORM_ANGLEX, GL_RGB10_A2_SNORM_ANGLEX, GenerateMip<R10G10B10A2S>, NoCopyFunctions, ReadColor<R10G10B10A2S, GLfloat>, WriteColor<R10G10B10A2S, GLfloat>, GL_SIGNED_NORMALIZED, 10, 10, 10, 2, 0, 0, 0, 4, std::numeric_limits<GLuint>::max(), false, false, false, gl::VertexAttribType::Int2101010 }, { FormatID::R10G10B10A2_SNORM, GL_RGB10_A2_SNORM_ANGLEX, GL_RGB10_A2_SNORM_ANGLEX, GenerateMip<R10G10B10A2S>, NoCopyFunctions, ReadColor<R10G10B10A2S, GLfloat>, WriteColor<R10G10B10A2S, GLfloat>, GL_SIGNED_NORMALIZED, 10, 10, 10, 2, 0, 0, 0, 4, std::numeric_limits<GLuint>::max(), false, false, false, gl::VertexAttribType::Int2101010 },
{ FormatID::R10G10B10A2_SSCALED, GL_RGB10_A2_SSCALED_ANGLEX, GL_RGB10_A2_SSCALED_ANGLEX, GenerateMip<R10G10B10A2S>, NoCopyFunctions, ReadColor<R10G10B10A2S, GLint>, WriteColor<R10G10B10A2S, GLint>, GL_INT, 10, 10, 10, 2, 0, 0, 0, 4, std::numeric_limits<GLuint>::max(), false, false, true, gl::VertexAttribType::Int2101010 }, { FormatID::R10G10B10A2_SSCALED, GL_RGB10_A2_SSCALED_ANGLEX, GL_RGB10_A2_SSCALED_ANGLEX, GenerateMip<R10G10B10A2S>, NoCopyFunctions, ReadColor<R10G10B10A2S, GLint>, WriteColor<R10G10B10A2S, GLint>, GL_INT, 10, 10, 10, 2, 0, 0, 0, 4, std::numeric_limits<GLuint>::max(), false, false, true, gl::VertexAttribType::Int2101010 },
...@@ -334,6 +342,10 @@ FormatID Format::InternalFormatToID(GLenum internalFormat) ...@@ -334,6 +342,10 @@ FormatID Format::InternalFormatToID(GLenum internalFormat)
return FormatID::ASTC_8x8_UNORM_BLOCK; return FormatID::ASTC_8x8_UNORM_BLOCK;
case GL_COMPRESSED_RGBA_BPTC_UNORM_EXT: case GL_COMPRESSED_RGBA_BPTC_UNORM_EXT:
return FormatID::BPTC_RGBA_UNORM_BLOCK; return FormatID::BPTC_RGBA_UNORM_BLOCK;
case GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:
return FormatID::PVRTC1_RGBA_2BPP_UNORM_BLOCK;
case GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:
return FormatID::PVRTC1_RGBA_4BPP_UNORM_BLOCK;
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
return FormatID::BC1_RGBA_UNORM_BLOCK; return FormatID::BC1_RGBA_UNORM_BLOCK;
case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE: case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
...@@ -344,6 +356,10 @@ FormatID Format::InternalFormatToID(GLenum internalFormat) ...@@ -344,6 +356,10 @@ FormatID Format::InternalFormatToID(GLenum internalFormat)
return FormatID::BPTC_RGB_SIGNED_FLOAT_BLOCK; return FormatID::BPTC_RGB_SIGNED_FLOAT_BLOCK;
case GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT: case GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT:
return FormatID::BPTC_RGB_UNSIGNED_FLOAT_BLOCK; return FormatID::BPTC_RGB_UNSIGNED_FLOAT_BLOCK;
case GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG:
return FormatID::PVRTC1_RGB_2BPP_UNORM_BLOCK;
case GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG:
return FormatID::PVRTC1_RGB_4BPP_UNORM_BLOCK;
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
return FormatID::BC1_RGB_UNORM_BLOCK; return FormatID::BC1_RGB_UNORM_BLOCK;
case GL_COMPRESSED_SIGNED_R11_EAC: case GL_COMPRESSED_SIGNED_R11_EAC:
...@@ -406,12 +422,20 @@ FormatID Format::InternalFormatToID(GLenum internalFormat) ...@@ -406,12 +422,20 @@ FormatID Format::InternalFormatToID(GLenum internalFormat)
return FormatID::ETC2_R8G8B8A1_SRGB_BLOCK; return FormatID::ETC2_R8G8B8A1_SRGB_BLOCK;
case GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT: case GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:
return FormatID::BPTC_SRGB_ALPHA_UNORM_BLOCK; return FormatID::BPTC_SRGB_ALPHA_UNORM_BLOCK;
case GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT:
return FormatID::PVRTC1_RGBA_2BPP_UNORM_SRGB_BLOCK;
case GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT:
return FormatID::PVRTC1_RGBA_4BPP_UNORM_SRGB_BLOCK;
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
return FormatID::BC1_RGBA_UNORM_SRGB_BLOCK; return FormatID::BC1_RGBA_UNORM_SRGB_BLOCK;
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
return FormatID::BC2_RGBA_UNORM_SRGB_BLOCK; return FormatID::BC2_RGBA_UNORM_SRGB_BLOCK;
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
return FormatID::BC3_RGBA_UNORM_SRGB_BLOCK; return FormatID::BC3_RGBA_UNORM_SRGB_BLOCK;
case GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT:
return FormatID::PVRTC1_RGB_2BPP_UNORM_SRGB_BLOCK;
case GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT:
return FormatID::PVRTC1_RGB_4BPP_UNORM_SRGB_BLOCK;
case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT: case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
return FormatID::BC1_RGB_UNORM_SRGB_BLOCK; return FormatID::BC1_RGB_UNORM_SRGB_BLOCK;
case GL_DEPTH24_STENCIL8: case GL_DEPTH24_STENCIL8:
......
...@@ -248,5 +248,29 @@ ...@@ -248,5 +248,29 @@
}, },
"ETC2_R8G8B8A8_SRGB_BLOCK": { "ETC2_R8G8B8A8_SRGB_BLOCK": {
"blockPixelBytes": "16" "blockPixelBytes": "16"
},
"PVRTC1_RGB_4BPP_UNORM_BLOCK": {
"blockPixelBytes": "1"
},
"PVRTC1_RGB_2BPP_UNORM_BLOCK": {
"blockPixelBytes": "1"
},
"PVRTC1_RGBA_4BPP_UNORM_BLOCK": {
"blockPixelBytes": "1"
},
"PVRTC1_RGBA_2BPP_UNORM_BLOCK": {
"blockPixelBytes": "1"
},
"PVRTC1_RGB_2BPP_UNORM_SRGB_BLOCK": {
"blockPixelBytes": "1"
},
"PVRTC1_RGB_4BPP_UNORM_SRGB_BLOCK": {
"blockPixelBytes": "1"
},
"PVRTC1_RGBA_2BPP_UNORM_SRGB_BLOCK": {
"blockPixelBytes": "1"
},
"PVRTC1_RGBA_4BPP_UNORM_SRGB_BLOCK": {
"blockPixelBytes": "1"
} }
} }
...@@ -210,5 +210,13 @@ ...@@ -210,5 +210,13 @@
[ "GL_X2_RGB10_USCALED_ANGLEX", "X2R10G10B10_USCALED_VERTEX" ], [ "GL_X2_RGB10_USCALED_ANGLEX", "X2R10G10B10_USCALED_VERTEX" ],
[ "GL_X2_RGB10_SSCALED_ANGLEX", "X2R10G10B10_SSCALED_VERTEX" ], [ "GL_X2_RGB10_SSCALED_ANGLEX", "X2R10G10B10_SSCALED_VERTEX" ],
[ "GL_X2_RGB10_UNORM_ANGLEX", "X2R10G10B10_UNORM_VERTEX" ], [ "GL_X2_RGB10_UNORM_ANGLEX", "X2R10G10B10_UNORM_VERTEX" ],
[ "GL_X2_RGB10_SNORM_ANGLEX", "X2R10G10B10_SNORM_VERTEX" ] [ "GL_X2_RGB10_SNORM_ANGLEX", "X2R10G10B10_SNORM_VERTEX" ],
[ "GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG", "PVRTC1_RGB_4BPP_UNORM_BLOCK" ],
[ "GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG", "PVRTC1_RGB_2BPP_UNORM_BLOCK" ],
[ "GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG", "PVRTC1_RGBA_4BPP_UNORM_BLOCK" ],
[ "GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG", "PVRTC1_RGBA_2BPP_UNORM_BLOCK" ],
[ "GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT", "PVRTC1_RGB_2BPP_UNORM_SRGB_BLOCK" ],
[ "GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT", "PVRTC1_RGB_4BPP_UNORM_SRGB_BLOCK" ],
[ "GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT", "PVRTC1_RGBA_2BPP_UNORM_SRGB_BLOCK" ],
[ "GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT", "PVRTC1_RGBA_4BPP_UNORM_SRGB_BLOCK" ]
] ]
...@@ -94,5 +94,13 @@ ...@@ -94,5 +94,13 @@
"GL_RGB16_SNORM_EXT": "R16G16B16A16_SNORM", "GL_RGB16_SNORM_EXT": "R16G16B16A16_SNORM",
"GL_RGB32F": "R32G32B32A32_FLOAT", "GL_RGB32F": "R32G32B32A32_FLOAT",
"GL_RGB32I": "R32G32B32A32_SINT", "GL_RGB32I": "R32G32B32A32_SINT",
"GL_RGB32UI": "R32G32B32A32_UINT" "GL_RGB32UI": "R32G32B32A32_UINT",
"GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG": "NONE",
"GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG": "NONE",
"GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG": "NONE",
"GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG": "NONE",
"GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT": "NONE",
"GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT": "NONE",
"GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT": "NONE",
"GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT": "NONE"
} }
...@@ -658,6 +658,34 @@ const Format &Format::Get(GLenum internalFormat, const Renderer11DeviceCaps &dev ...@@ -658,6 +658,34 @@ const Format &Format::Get(GLenum internalFormat, const Renderer11DeviceCaps &dev
nullptr); nullptr);
return info; return info;
} }
case GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:
{
static constexpr Format info(GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,
angle::FormatID::NONE,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_UNKNOWN,
GL_NONE,
nullptr);
return info;
}
case GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:
{
static constexpr Format info(GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,
angle::FormatID::NONE,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_UNKNOWN,
GL_NONE,
nullptr);
return info;
}
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
{ {
static constexpr Format info(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, static constexpr Format info(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,
...@@ -728,6 +756,34 @@ const Format &Format::Get(GLenum internalFormat, const Renderer11DeviceCaps &dev ...@@ -728,6 +756,34 @@ const Format &Format::Get(GLenum internalFormat, const Renderer11DeviceCaps &dev
nullptr); nullptr);
return info; return info;
} }
case GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG:
{
static constexpr Format info(GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG,
angle::FormatID::NONE,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_UNKNOWN,
GL_NONE,
nullptr);
return info;
}
case GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG:
{
static constexpr Format info(GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG,
angle::FormatID::NONE,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_UNKNOWN,
GL_NONE,
nullptr);
return info;
}
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
{ {
static constexpr Format info(GL_COMPRESSED_RGB_S3TC_DXT1_EXT, static constexpr Format info(GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
...@@ -1190,6 +1246,34 @@ const Format &Format::Get(GLenum internalFormat, const Renderer11DeviceCaps &dev ...@@ -1190,6 +1246,34 @@ const Format &Format::Get(GLenum internalFormat, const Renderer11DeviceCaps &dev
nullptr); nullptr);
return info; return info;
} }
case GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT:
{
static constexpr Format info(GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT,
angle::FormatID::NONE,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_UNKNOWN,
GL_NONE,
nullptr);
return info;
}
case GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT:
{
static constexpr Format info(GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT,
angle::FormatID::NONE,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_UNKNOWN,
GL_NONE,
nullptr);
return info;
}
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
{ {
static constexpr Format info(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, static constexpr Format info(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,
...@@ -1232,6 +1316,34 @@ const Format &Format::Get(GLenum internalFormat, const Renderer11DeviceCaps &dev ...@@ -1232,6 +1316,34 @@ const Format &Format::Get(GLenum internalFormat, const Renderer11DeviceCaps &dev
nullptr); nullptr);
return info; return info;
} }
case GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT:
{
static constexpr Format info(GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT,
angle::FormatID::NONE,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_UNKNOWN,
GL_NONE,
nullptr);
return info;
}
case GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT:
{
static constexpr Format info(GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT,
angle::FormatID::NONE,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_UNKNOWN,
GL_NONE,
nullptr);
return info;
}
case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT: case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
{ {
static constexpr Format info(GL_COMPRESSED_SRGB_S3TC_DXT1_EXT, static constexpr Format info(GL_COMPRESSED_SRGB_S3TC_DXT1_EXT,
......
...@@ -361,6 +361,20 @@ static InternalFormatInfoMap BuildInternalFormatInfoMap() ...@@ -361,6 +361,20 @@ static InternalFormatInfoMap BuildInternalFormatInfoMap()
InsertFormatMapping(&map, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x5_OES, NeverSupported(), NeverSupported(), NeverSupported(), ExtsOnly("GL_OES_texture_compression_astc"), AlwaysSupported(), NeverSupported(), NeverSupported()); InsertFormatMapping(&map, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x5_OES, NeverSupported(), NeverSupported(), NeverSupported(), ExtsOnly("GL_OES_texture_compression_astc"), AlwaysSupported(), NeverSupported(), NeverSupported());
InsertFormatMapping(&map, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x6_OES, NeverSupported(), NeverSupported(), NeverSupported(), ExtsOnly("GL_OES_texture_compression_astc"), AlwaysSupported(), NeverSupported(), NeverSupported()); InsertFormatMapping(&map, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x6_OES, NeverSupported(), NeverSupported(), NeverSupported(), ExtsOnly("GL_OES_texture_compression_astc"), AlwaysSupported(), NeverSupported(), NeverSupported());
// From GL_IMG_texture_compression_pvrtc
// | Format | OpenGL texture support | Filter | Render | OpenGL ES texture support | Filter | OpenGL ES texture attachment support | OpenGL ES renderbuffer support |
InsertFormatMapping(&map, GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG, ExtsOnly("GL_IMG_texture_compression_pvrtc"), AlwaysSupported(), NeverSupported(), ExtsOnly("GL_IMG_texture_compression_pvrtc"), AlwaysSupported(), NeverSupported(), NeverSupported() );
InsertFormatMapping(&map, GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG, ExtsOnly("GL_IMG_texture_compression_pvrtc"), AlwaysSupported(), NeverSupported(), ExtsOnly("GL_IMG_texture_compression_pvrtc"), AlwaysSupported(), NeverSupported(), NeverSupported() );
InsertFormatMapping(&map, GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG, ExtsOnly("GL_IMG_texture_compression_pvrtc"), AlwaysSupported(), NeverSupported(), ExtsOnly("GL_IMG_texture_compression_pvrtc"), AlwaysSupported(), NeverSupported(), NeverSupported() );
InsertFormatMapping(&map, GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG, ExtsOnly("GL_IMG_texture_compression_pvrtc"), AlwaysSupported(), NeverSupported(), ExtsOnly("GL_IMG_texture_compression_pvrtc"), AlwaysSupported(), NeverSupported(), NeverSupported() );
// From GL_EXT_pvrtc_sRGB
// | Format | OpenGL texture support | Filter | Render | OpenGL ES texture support | Filter | OpenGL ES texture attachment support | OpenGL ES renderbuffer support |
InsertFormatMapping(&map, GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT, NeverSupported(), NeverSupported(), NeverSupported(), ExtsOnly("GL_EXT_pvrtc_sRGB"), AlwaysSupported(), NeverSupported(), NeverSupported() );
InsertFormatMapping(&map, GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT, NeverSupported(), NeverSupported(), NeverSupported(), ExtsOnly("GL_EXT_pvrtc_sRGB"), AlwaysSupported(), NeverSupported(), NeverSupported() );
InsertFormatMapping(&map, GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT, NeverSupported(), NeverSupported(), NeverSupported(), ExtsOnly("GL_EXT_pvrtc_sRGB"), AlwaysSupported(), NeverSupported(), NeverSupported() );
InsertFormatMapping(&map, GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT, NeverSupported(), NeverSupported(), NeverSupported(), ExtsOnly("GL_EXT_pvrtc_sRGB"), AlwaysSupported(), NeverSupported(), NeverSupported() );
// clang-format on // clang-format on
return map; return map;
......
...@@ -1101,6 +1101,38 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) ...@@ -1101,6 +1101,38 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat)
// This format is not implemented in Vulkan. // This format is not implemented in Vulkan.
break; break;
case angle::FormatID::PVRTC1_RGBA_2BPP_UNORM_BLOCK:
// This format is not implemented in Vulkan.
break;
case angle::FormatID::PVRTC1_RGBA_2BPP_UNORM_SRGB_BLOCK:
// This format is not implemented in Vulkan.
break;
case angle::FormatID::PVRTC1_RGBA_4BPP_UNORM_BLOCK:
// This format is not implemented in Vulkan.
break;
case angle::FormatID::PVRTC1_RGBA_4BPP_UNORM_SRGB_BLOCK:
// This format is not implemented in Vulkan.
break;
case angle::FormatID::PVRTC1_RGB_2BPP_UNORM_BLOCK:
// This format is not implemented in Vulkan.
break;
case angle::FormatID::PVRTC1_RGB_2BPP_UNORM_SRGB_BLOCK:
// This format is not implemented in Vulkan.
break;
case angle::FormatID::PVRTC1_RGB_4BPP_UNORM_BLOCK:
// This format is not implemented in Vulkan.
break;
case angle::FormatID::PVRTC1_RGB_4BPP_UNORM_SRGB_BLOCK:
// This format is not implemented in Vulkan.
break;
case angle::FormatID::R10G10B10A2_SINT: case angle::FormatID::R10G10B10A2_SINT:
internalFormat = GL_RGB10_A2_SINT_ANGLEX; internalFormat = GL_RGB10_A2_SINT_ANGLEX;
imageFormatID = angle::FormatID::R10G10B10A2_SINT; imageFormatID = angle::FormatID::R10G10B10A2_SINT;
......
...@@ -894,6 +894,15 @@ bool ValidCompressedSubImageSize(const Context *context, ...@@ -894,6 +894,15 @@ bool ValidCompressedSubImageSize(const Context *context,
return false; return false;
} }
bool fillsEntireMip =
xoffset == 0 && yoffset == 0 && static_cast<size_t>(width) == textureWidth &&
static_cast<size_t>(height) == textureHeight && static_cast<size_t>(depth) == textureDepth;
if (CompressedFormatRequiresWholeImage(internalFormat))
{
return fillsEntireMip;
}
if (CompressedSubTextureFormatRequiresExactSize(internalFormat)) if (CompressedSubTextureFormatRequiresExactSize(internalFormat))
{ {
if (xoffset % formatInfo.compressedBlockWidth != 0 || if (xoffset % formatInfo.compressedBlockWidth != 0 ||
...@@ -905,10 +914,6 @@ bool ValidCompressedSubImageSize(const Context *context, ...@@ -905,10 +914,6 @@ bool ValidCompressedSubImageSize(const Context *context,
// Allowed to either have data that is a multiple of block size or is smaller than the block // Allowed to either have data that is a multiple of block size or is smaller than the block
// size but fills the entire mip // size but fills the entire mip
bool fillsEntireMip = xoffset == 0 && yoffset == 0 &&
static_cast<size_t>(width) == textureWidth &&
static_cast<size_t>(height) == textureHeight &&
static_cast<size_t>(depth) == textureDepth;
bool sizeMultipleOfBlockSize = (width % formatInfo.compressedBlockWidth) == 0 && bool sizeMultipleOfBlockSize = (width % formatInfo.compressedBlockWidth) == 0 &&
(height % formatInfo.compressedBlockHeight) == 0 && (height % formatInfo.compressedBlockHeight) == 0 &&
(depth % formatInfo.compressedBlockDepth) == 0; (depth % formatInfo.compressedBlockDepth) == 0;
......
...@@ -727,6 +727,36 @@ bool ValidateES2CopyTexImageParameters(Context *context, ...@@ -727,6 +727,36 @@ bool ValidateES2CopyTexImageParameters(Context *context,
return false; return false;
} }
break; break;
case GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG:
case GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG:
case GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:
case GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:
if (context->getExtensions().compressedTexturePVRTC)
{
context->validationError(GL_INVALID_OPERATION, kInvalidFormat);
return false;
}
else
{
context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
return false;
}
break;
case GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT:
case GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT:
case GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT:
case GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT:
if (context->getExtensions().compressedTexturePVRTCsRGB)
{
context->validationError(GL_INVALID_OPERATION, kInvalidFormat);
return false;
}
else
{
context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
return false;
}
break;
case GL_DEPTH_COMPONENT: case GL_DEPTH_COMPONENT:
case GL_DEPTH_COMPONENT16: case GL_DEPTH_COMPONENT16:
case GL_DEPTH_COMPONENT32_OES: case GL_DEPTH_COMPONENT32_OES:
...@@ -1563,6 +1593,36 @@ bool ValidateES2TexImageParametersBase(Context *context, ...@@ -1563,6 +1593,36 @@ bool ValidateES2TexImageParametersBase(Context *context,
return false; return false;
} }
break; break;
case GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG:
case GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG:
case GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:
case GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:
if (context->getExtensions().compressedTexturePVRTC)
{
context->validationError(GL_INVALID_OPERATION, kInvalidFormat);
return false;
}
else
{
context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
return false;
}
break;
case GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT:
case GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT:
case GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT:
case GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT:
if (context->getExtensions().compressedTexturePVRTCsRGB)
{
context->validationError(GL_INVALID_OPERATION, kInvalidFormat);
return false;
}
else
{
context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
return false;
}
break;
case GL_DEPTH_COMPONENT: case GL_DEPTH_COMPONENT:
case GL_DEPTH_STENCIL_OES: case GL_DEPTH_STENCIL_OES:
if (!context->getExtensions().depthTextureANGLE && if (!context->getExtensions().depthTextureANGLE &&
...@@ -1942,6 +2002,26 @@ bool ValidateES2TexStorageParameters(Context *context, ...@@ -1942,6 +2002,26 @@ bool ValidateES2TexStorageParameters(Context *context,
return false; return false;
} }
break; break;
case GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG:
case GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG:
case GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:
case GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:
if (!context->getExtensions().compressedTexturePVRTC)
{
context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
return false;
}
break;
case GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT:
case GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT:
case GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT:
case GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT:
if (!context->getExtensions().compressedTexturePVRTCsRGB)
{
context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
return false;
}
break;
case GL_RGBA32F_EXT: case GL_RGBA32F_EXT:
case GL_RGB32F_EXT: case GL_RGB32F_EXT:
case GL_ALPHA32F_EXT: case GL_ALPHA32F_EXT:
......
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