Commit 835bcb1e by Alexey Knyazev Committed by Commit Bot

Vulkan: Support GL_EXT_texture_sRGB_RG8

For completeness, added mappings of R8_SRGB and R8G8_SRGB to OpenGL and Metal. Bug: angleproject:4932 Change-Id: Ic8e44e3a94c114e985f6965fcd43fbcb8071432d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2880661 Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent ac42dbf9
{
"src/libANGLE/renderer/FormatID_autogen.h":
"27b489d26f03514a466c5b3a8302eb4b",
"14285e7bdfd0346aa99712b48ec63967",
"src/libANGLE/renderer/Format_table_autogen.cpp":
"b28fd3a6ed2ff60197dbb40c4b122d31",
"da0b1b6dbbbb4ff1228c18c09c03827c",
"src/libANGLE/renderer/angle_format.py":
"74d6c9842128293118ccf128aeae896a",
"src/libANGLE/renderer/angle_format_data.json":
"10e2ee1ed8ee54226edb644de30f512d",
"src/libANGLE/renderer/angle_format_map.json":
"5cfbdcad0391a5d70dca1466c5361ee4",
"623bcd907ccba69766fbc17c4b9a5b9a",
"src/libANGLE/renderer/gen_angle_format_table.py":
"70bdbceee30506d4b14bf52f2bbd8f2b"
}
\ No newline at end of file
......@@ -4,7 +4,7 @@
"src/libANGLE/renderer/gen_load_functions_table.py":
"c131c494e7e0b35b65a8a097b4b8e5ce",
"src/libANGLE/renderer/load_functions_data.json":
"912670e6835fbe5074533bbeba44ef02",
"ab3cd63d53e261abdeaf8146db5566ed",
"src/libANGLE/renderer/load_functions_table_autogen.cpp":
"bd36b4eca9fcbfe16c0911b58dc1f449"
"21a13d65def3db572442cf980816a6f7"
}
\ No newline at end of file
......@@ -6,7 +6,7 @@
"src/libANGLE/renderer/d3d/d3d11/texture_format_data.json":
"3666635f9fd4f1a80fb24153271c5f59",
"src/libANGLE/renderer/d3d/d3d11/texture_format_map.json":
"d45aee3519b8c9a15411617bbb00c77f",
"a93580dafc099d642ab746a4486404cd",
"src/libANGLE/renderer/d3d/d3d11/texture_format_table_autogen.cpp":
"2c667bd412c58424a9b3a25ffb00f01c"
"366e3cb6418fb63da6784218c469e182"
}
\ No newline at end of file
......@@ -2,7 +2,7 @@
"src/libANGLE/renderer/angle_format.py":
"74d6c9842128293118ccf128aeae896a",
"src/libANGLE/renderer/angle_format_map.json":
"5cfbdcad0391a5d70dca1466c5361ee4",
"623bcd907ccba69766fbc17c4b9a5b9a",
"src/libANGLE/renderer/dxgi_format_data.json":
"3428e4761ccd05f960adffd6ccbd86c5",
"src/libANGLE/renderer/dxgi_format_map_autogen.cpp":
......
{
"src/libANGLE/es3_format_type_combinations.json":
"b7d0c224864b87afd09a557a0099c2bb",
"30346b958cd180089e137daf69b21ab5",
"src/libANGLE/format_map_autogen.cpp":
"b71c162b72facbbe89d2366b5e7cc4bf",
"fe6dd8e61e9b7b77f8b10266a2d8115f",
"src/libANGLE/format_map_data.json":
"2e5db33b6d6b142b569123f614f3ddb7",
"src/libANGLE/gen_format_map.py":
......
......@@ -2,7 +2,7 @@
"src/libANGLE/renderer/angle_format.py":
"74d6c9842128293118ccf128aeae896a",
"src/libANGLE/renderer/angle_format_map.json":
"5cfbdcad0391a5d70dca1466c5361ee4",
"623bcd907ccba69766fbc17c4b9a5b9a",
"src/libANGLE/renderer/gen_angle_format_table.py":
"70bdbceee30506d4b14bf52f2bbd8f2b",
"src/libANGLE/renderer/metal/shaders/blit.metal":
......@@ -16,7 +16,7 @@
"src/libANGLE/renderer/metal/shaders/copy_buffer.metal":
"83d33cc789cb5df7b173b98c50770c0f",
"src/libANGLE/renderer/metal/shaders/format_autogen.h":
"078e03a4b530b6a9ec4740d291beb6e9",
"76a3054ef29e42aa541cb835a82db7a0",
"src/libANGLE/renderer/metal/shaders/gen_indices.metal":
"06e2b6f259fe019b46e2a9710eb11bff",
"src/libANGLE/renderer/metal/shaders/gen_mipmap.metal":
......@@ -24,7 +24,7 @@
"src/libANGLE/renderer/metal/shaders/gen_mtl_internal_shaders.py":
"ba74ebbfa2ceb825f36e84f2985b3d3d",
"src/libANGLE/renderer/metal/shaders/mtl_default_shaders_src_autogen.inc":
"c9dbe9e35cd7e84104687bb04730a3c4",
"fbeb201f151948c222cb8b8348002d81",
"src/libANGLE/renderer/metal/shaders/visibility.metal":
"b82aa740cf4b0aed606aacef1024beea"
}
\ No newline at end of file
......@@ -2,11 +2,11 @@
"src/libANGLE/renderer/angle_format.py":
"74d6c9842128293118ccf128aeae896a",
"src/libANGLE/renderer/angle_format_map.json":
"5cfbdcad0391a5d70dca1466c5361ee4",
"623bcd907ccba69766fbc17c4b9a5b9a",
"src/libANGLE/renderer/metal/gen_mtl_format_table.py":
"4b9bc5e4c59175d30de4a42fd110c3b5",
"src/libANGLE/renderer/metal/mtl_format_map.json":
"811f4f892ea3f1d3036709be0760cba5",
"6c10d43f4097807591acbd0a1dfc051d",
"src/libANGLE/renderer/metal/mtl_format_table_autogen.mm":
"f5fffccd14f237868d299def82765486"
"1ba42aa43cee9a05364319f4f1055acd"
}
\ No newline at end of file
......@@ -2,11 +2,11 @@
"src/libANGLE/renderer/angle_format.py":
"74d6c9842128293118ccf128aeae896a",
"src/libANGLE/renderer/angle_format_map.json":
"5cfbdcad0391a5d70dca1466c5361ee4",
"623bcd907ccba69766fbc17c4b9a5b9a",
"src/libANGLE/renderer/vulkan/gen_vk_format_table.py":
"ffeebc0e8ec8db860e472c7cf04cd880",
"src/libANGLE/renderer/vulkan/vk_format_map.json":
"e95cc5c7cdeec22369acb5dfb811303e",
"b5e35a7c708d764ae66ac39bf2beb054",
"src/libANGLE/renderer/vulkan/vk_format_table_autogen.cpp":
"559bf794dcccf632481864189b1469ab"
"50a29ee869bbae62fca78d597aa695ee"
}
\ No newline at end of file
......@@ -4,11 +4,11 @@
"src/libANGLE/renderer/vulkan/gen_vk_mandatory_format_support_table.py":
"3e2b8cd80373275e862bb7c8ba20a745",
"src/libANGLE/renderer/vulkan/vk_format_map.json":
"e95cc5c7cdeec22369acb5dfb811303e",
"b5e35a7c708d764ae66ac39bf2beb054",
"src/libANGLE/renderer/vulkan/vk_mandatory_format_support_data.json":
"fa2bd54c1bb0ab2cf1d386061a4bc5c5",
"src/libANGLE/renderer/vulkan/vk_mandatory_format_support_table_autogen.cpp":
"4d9b8f552adb1bf953e77540f021ea0c",
"5b3158f99d4e3f316d9bf89cca9174d6",
"third_party/vulkan-deps/vulkan-headers/src/registry/vk.xml":
"0a77e84bf347f2ecd11d5dc3b6f99462"
}
\ No newline at end of file
......@@ -639,6 +639,14 @@ static bool DetermineSRGBR8TextureSupport(const TextureCapsMap &textureCaps)
return GetFormatSupport(textureCaps, requiredFilterFormats, true, true, false, false, false);
}
// Check for GL_EXT_texture_sRGB_RG8 support
static bool DetermineSRGBRG8TextureSupport(const TextureCapsMap &textureCaps)
{
constexpr GLenum requiredFilterFormats[] = {GL_SRG8_EXT};
return GetFormatSupport(textureCaps, requiredFilterFormats, true, true, false, false, false);
}
// Check for GL_ANGLE_depth_texture support
static bool DetermineDepthTextureANGLESupport(const TextureCapsMap &textureCaps)
{
......@@ -859,6 +867,7 @@ void Extensions::setTextureExtensionSupport(const TextureCapsMap &textureCaps)
compressedEACRG11SignedTextureOES = DetermineEACRG11SignedTextureSupport(textureCaps);
sRGB = DetermineSRGBTextureSupport(textureCaps);
sRGBR8EXT = DetermineSRGBR8TextureSupport(textureCaps);
sRGBRG8EXT = DetermineSRGBRG8TextureSupport(textureCaps);
depthTextureANGLE = DetermineDepthTextureANGLESupport(textureCaps);
depthTextureOES = DetermineDepthTextureOESSupport(textureCaps);
depth24OES = DetermineDepth24OESSupport(textureCaps);
......@@ -946,6 +955,7 @@ const ExtensionInfoMap &GetExtensionInfoMap()
map["GL_EXT_pvrtc_sRGB"] = enableableExtension(&Extensions::compressedTexturePVRTCsRGB);
map["GL_EXT_sRGB"] = enableableExtension(&Extensions::sRGB);
map["GL_EXT_texture_sRGB_R8"] = enableableExtension(&Extensions::sRGBR8EXT);
map["GL_EXT_texture_sRGB_RG8"] = enableableExtension(&Extensions::sRGBRG8EXT);
map["GL_ANGLE_depth_texture"] = esOnlyExtension(&Extensions::depthTextureANGLE);
map["GL_OES_depth_texture"] = esOnlyExtension(&Extensions::depthTextureOES);
map["GL_OES_depth_texture_cube_map"] = enableableExtension(&Extensions::depthTextureCubeMapOES);
......
......@@ -285,6 +285,9 @@ struct Extensions
// GL_EXT_texture_sRGB_R8
bool sRGBR8EXT = false;
// GL_EXT_texture_sRGB_RG8
bool sRGBRG8EXT = false;
// GL_ANGLE_depth_texture
bool depthTextureANGLE = false;
......
......@@ -109,6 +109,10 @@
[
[ "GL_SR8_EXT", "GL_RED", "GL_UNSIGNED_BYTE" ]
],
"From GL_EXT_texture_sRGB_RG8":
[
[ "GL_SRG8_EXT", "GL_RG", "GL_UNSIGNED_BYTE" ]
],
"From GL_OES_texture_float":
[
[ "GL_RGBA", "GL_RGBA", "GL_FLOAT" ],
......
......@@ -1183,6 +1183,7 @@ bool ValidES3FormatCombination(GLenum format, GLenum type, GLenum internalFormat
{
case GL_RG8:
case GL_RG:
case GL_SRG8_EXT:
return true;
default:
break;
......
......@@ -1010,6 +1010,10 @@ static InternalFormatInfoMap BuildInternalFormatInfoMap()
// | Internal format |sized| R | G | B | A |S | Format | Type | Component type | SRGB | Texture supported | Filterable | Texture attachment | Renderbuffer | Blend
AddRGBAFormat(&map, GL_SR8_EXT, true, 8, 0, 0, 0, 0, GL_RED, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, true, RequireExt<&Extensions::sRGBR8EXT>, AlwaysSupported, NeverSupported, NeverSupported, NeverSupported);
// From EXT_texture_sRGB_RG8
// | Internal format |sized| R | G | B | A |S | Format | Type | Component type | SRGB | Texture supported | Filterable | Texture attachment | Renderbuffer | Blend
AddRGBAFormat(&map, GL_SRG8_EXT, true, 8, 8, 0, 0, 0, GL_RG, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, true, RequireExt<&Extensions::sRGBRG8EXT>, AlwaysSupported, NeverSupported, NeverSupported, NeverSupported);
// Unsized formats
// | Internal format |sized | R | G | B | A |S | Format | Type | Component type | SRGB | Texture supported | Filterable | Texture attachment | Renderbuffer | Blend
AddRGBAFormat(&map, GL_RED, false, 8, 0, 0, 0, 0, GL_RED, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, RequireExt<&Extensions::textureRG>, AlwaysSupported, RequireExt<&Extensions::textureRG>, NeverSupported, NeverSupported);
......
......@@ -228,6 +228,7 @@ enum class FormatID
R8G8_SSCALED,
R8G8_UINT,
R8G8_UNORM,
R8G8_UNORM_SRGB,
R8G8_USCALED,
R8_SINT,
R8_SNORM,
......@@ -245,7 +246,7 @@ enum class FormatID
X2R10G10B10_USCALED_VERTEX
};
constexpr uint32_t kNumANGLEFormats = 226;
constexpr uint32_t kNumANGLEFormats = 227;
} // namespace angle
......
......@@ -235,6 +235,7 @@ const Format gFormatInfoTable[] = {
{ FormatID::R8G8_SSCALED, GL_RG8_SSCALED_ANGLEX, GL_RG8_SSCALED_ANGLEX, GenerateMip<R8G8S>, NoCopyFunctions, ReadColor<R8G8S, GLint>, WriteColor<R8G8S, GLint>, GL_INT, 8, 8, 0, 0, 0, 0, 0, 2, 0, false, false, true, false, false, gl::VertexAttribType::Byte },
{ FormatID::R8G8_UINT, GL_RG8UI, GL_RG8UI, GenerateMip<R8G8>, NoCopyFunctions, ReadColor<R8G8, GLuint>, WriteColor<R8G8, GLuint>, GL_UNSIGNED_INT, 8, 8, 0, 0, 0, 0, 0, 2, 0, false, false, false, false, false, gl::VertexAttribType::UnsignedByte },
{ FormatID::R8G8_UNORM, GL_RG8, GL_RG8, GenerateMip<R8G8>, NoCopyFunctions, ReadColor<R8G8, GLfloat>, WriteColor<R8G8, GLfloat>, GL_UNSIGNED_NORMALIZED, 8, 8, 0, 0, 0, 0, 0, 2, 0, false, false, false, false, false, gl::VertexAttribType::UnsignedByte },
{ FormatID::R8G8_UNORM_SRGB, GL_SRG8_EXT, GL_SRG8_EXT, GenerateMip<R8G8>, NoCopyFunctions, ReadColor<R8G8, GLfloat>, WriteColor<R8G8, GLfloat>, GL_UNSIGNED_NORMALIZED, 8, 8, 0, 0, 0, 0, 0, 2, 0, false, false, false, true, false, gl::VertexAttribType::Byte },
{ FormatID::R8G8_USCALED, GL_RG8_USCALED_ANGLEX, GL_RG8_USCALED_ANGLEX, GenerateMip<R8G8>, NoCopyFunctions, ReadColor<R8G8, GLuint>, WriteColor<R8G8, GLuint>, GL_UNSIGNED_INT, 8, 8, 0, 0, 0, 0, 0, 2, 0, false, false, true, false, false, gl::VertexAttribType::UnsignedByte },
{ FormatID::R8_SINT, GL_R8I, GL_R8I, GenerateMip<R8S>, NoCopyFunctions, ReadColor<R8S, GLint>, WriteColor<R8S, GLint>, GL_INT, 8, 0, 0, 0, 0, 0, 0, 1, 0, false, false, false, false, false, gl::VertexAttribType::Byte },
{ FormatID::R8_SNORM, GL_R8_SNORM, GL_R8_SNORM, GenerateMip<R8S>, NoCopyFunctions, ReadColor<R8S, GLfloat>, WriteColor<R8S, GLfloat>, GL_SIGNED_NORMALIZED, 8, 0, 0, 0, 0, 0, 0, 1, 0, false, false, false, false, false, gl::VertexAttribType::Byte },
......@@ -694,6 +695,8 @@ FormatID Format::InternalFormatToID(GLenum internalFormat)
return FormatID::R8G8B8A8_USCALED;
case GL_SR8_EXT:
return FormatID::R8_UNORM_SRGB;
case GL_SRG8_EXT:
return FormatID::R8G8_UNORM_SRGB;
case GL_SRGB8:
return FormatID::R8G8B8_UNORM_SRGB;
case GL_SRGB8_ALPHA8:
......
......@@ -153,6 +153,7 @@
[ "GL_RGBA8_SNORM", "R8G8B8A8_SNORM" ],
[ "GL_SRGB8", "R8G8B8_UNORM_SRGB" ],
[ "GL_SR8_EXT", "R8_UNORM_SRGB" ],
[ "GL_SRG8_EXT", "R8G8_UNORM_SRGB" ],
[ "GL_SRGB8_ALPHA8", "R8G8B8A8_UNORM_SRGB" ],
[ "GL_STENCIL_INDEX8", "S8_UINT" ],
[ "GL_R16_EXT", "R16_UNORM" ],
......
......@@ -103,5 +103,6 @@
"GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT": "NONE",
"GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT": "NONE",
"GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT": "NONE",
"GL_SR8_EXT": "NONE"
"GL_SR8_EXT": "NONE",
"GL_SRG8_EXT": "NONE"
}
......@@ -2583,6 +2583,20 @@ const Format &Format::Get(GLenum internalFormat, const Renderer11DeviceCaps &dev
nullptr);
return info;
}
case GL_SRG8_EXT:
{
static constexpr Format info(GL_SRG8_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_SRGB8:
{
static constexpr Format info(GL_SRGB8,
......
......@@ -303,6 +303,11 @@ static InternalFormatInfoMap BuildInternalFormatInfoMap()
InsertFormatMapping(&map, GL_LUMINANCE32F_EXT, VersionOrExts(3, 0, "GL_ARB_texture_float"), AlwaysSupported(), NeverSupported(), VersionOrExts(3, 0, "GL_OES_texture_float"), ExtsOnly("GL_OES_texture_float_linear"), NeverSupported(), NeverSupported() );
InsertFormatMapping(&map, GL_LUMINANCE_ALPHA32F_EXT, VersionOrExts(3, 0, "GL_ARB_texture_float"), AlwaysSupported(), NeverSupported(), VersionOrExts(3, 0, "GL_OES_texture_float"), ExtsOnly("GL_OES_texture_float_linear"), NeverSupported(), NeverSupported() );
// GL_EXT_texture_sRGB_R8 and GL_EXT_texture_sRGB_RG8 formats
// | Format | OpenGL texture support | Filter | Render | OpenGL ES texture support | Filter | OpenGL ES texture attachment support | OpenGL ES renderbuffer support |
InsertFormatMapping(&map, GL_SR8_EXT, ExtsOnly("GL_EXT_texture_sRGB_R8"), AlwaysSupported(), NeverSupported(), ExtsOnly("GL_EXT_texture_sRGB_R8"), AlwaysSupported(), NeverSupported(), NeverSupported() );
InsertFormatMapping(&map, GL_SRG8_EXT, ExtsOnly("GL_EXT_texture_sRGB_RG8"), AlwaysSupported(), NeverSupported(), ExtsOnly("GL_EXT_texture_sRGB_RG8"), AlwaysSupported(), NeverSupported(), NeverSupported() );
// EXT_texture_compression_rgtc formats
// | Format | OpenGL texture support | Filter | Render | OpenGL ES texture support | Filter | OpenGL ES texture attachment support | OpenGL ES renderbuffer support |
InsertFormatMapping(&map, GL_COMPRESSED_RED_RGTC1_EXT, VersionOrExts(3, 0, "GL_ARB_texture_compression_rgtc"), AlwaysSupported(), NeverSupported(), ExtsOnly("GL_EXT_texture_compression_rgtc"), AlwaysSupported(), NeverSupported(), NeverSupported() );
......
......@@ -17,6 +17,11 @@
"GL_UNSIGNED_BYTE": "LoadToNative<GLbyte, 1>"
}
},
"GL_SRG8_EXT": {
"R8G8_UNORM_SRGB": {
"GL_UNSIGNED_BYTE": "LoadToNative<GLbyte, 2>"
}
},
"GL_RGBA8I": {
"R8G8B8A8_SINT": {
"GL_BYTE": "LoadToNative<GLbyte, 4>"
......
......@@ -3126,6 +3126,18 @@ LoadImageFunctionInfo SR8_EXT_to_R8_UNORM_SRGB(GLenum type)
}
}
LoadImageFunctionInfo SRG8_EXT_to_R8G8_UNORM_SRGB(GLenum type)
{
switch (type)
{
case GL_UNSIGNED_BYTE:
return LoadImageFunctionInfo(LoadToNative<GLbyte, 2>, false);
default:
UNREACHABLE();
return LoadImageFunctionInfo(UnreachableLoadFunction, true);
}
}
LoadImageFunctionInfo SRGB8_to_R8G8B8A8_UNORM_SRGB(GLenum type)
{
switch (type)
......@@ -4537,6 +4549,17 @@ LoadFunctionMap GetLoadFunctionsMap(GLenum internalFormat, FormatID angleFormat)
}
break;
}
case GL_SRG8_EXT:
{
switch (angleFormat)
{
case FormatID::R8G8_UNORM_SRGB:
return SRG8_EXT_to_R8G8_UNORM_SRGB;
default:
break;
}
break;
}
case GL_SRGB8:
{
switch (angleFormat)
......
......@@ -81,6 +81,8 @@
"R9G9B9E5_SHAREDEXP": "MTLPixelFormatRGB9E5Float"
},
"map_ios": {
"R8_UNORM_SRGB": "MTLPixelFormatR8Unorm_sRGB",
"R8G8_UNORM_SRGB": "MTLPixelFormatRG8Unorm_sRGB",
"R5G6B5_UNORM": "MTLPixelFormatB5G6R5Unorm",
"R5G5B5A1_UNORM": "MTLPixelFormatA1BGR5Unorm",
"R4G4B4A4_UNORM": "MTLPixelFormatABGR4Unorm",
......@@ -662,6 +664,22 @@
}
},
"caps_ios": {
"MTLPixelFormatR8Unorm_sRGB":{
"filterable": "display->supportsAppleGPUFamily(1)",
"writable": "display->supportsAppleGPUFamily(2)",
"blendable": "display->supportsAppleGPUFamily(1)",
"multisample": "display->supportsAppleGPUFamily(1)",
"resolve": "display->supportsAppleGPUFamily(1)",
"colorRenderable": "display->supportsAppleGPUFamily(1)"
},
"MTLPixelFormatRG8Unorm_sRGB":{
"filterable": "display->supportsAppleGPUFamily(1)",
"writable": "display->supportsAppleGPUFamily(2)",
"blendable": "display->supportsAppleGPUFamily(1)",
"multisample": "display->supportsAppleGPUFamily(1)",
"resolve": "display->supportsAppleGPUFamily(1)",
"colorRenderable": "display->supportsAppleGPUFamily(1)"
},
"MTLPixelFormatB5G6R5Unorm":{
"filterable": "display->supportsAppleGPUFamily(1)",
"writable": "false",
......
......@@ -233,6 +233,10 @@ angle::FormatID Format::MetalToAngleFormatID(MTLPixelFormat formatMtl)
return angle::FormatID::R5G5B5A1_UNORM;
case MTLPixelFormatB5G6R5Unorm:
return angle::FormatID::R5G6B5_UNORM;
case MTLPixelFormatRG8Unorm_sRGB:
return angle::FormatID::R8G8_UNORM_SRGB;
case MTLPixelFormatR8Unorm_sRGB:
return angle::FormatID::R8_UNORM_SRGB;
case MTLPixelFormatASTC_10x10_LDR:
return angle::FormatID::ASTC_10x10_UNORM_BLOCK;
case MTLPixelFormatASTC_10x10_HDR:
......@@ -1615,6 +1619,24 @@ void Format::init(const DisplayMtl *display, angle::FormatID intendedFormatId_)
this->swizzled = false;
break;
case angle::FormatID::R8G8_UNORM_SRGB:
this->metalFormat = MTLPixelFormatRG8Unorm_sRGB;
this->actualFormatId = angle::FormatID::R8G8_UNORM_SRGB;
this->initFunction = nullptr;
this->swizzled = false;
break;
case angle::FormatID::R8_UNORM_SRGB:
this->metalFormat = MTLPixelFormatR8Unorm_sRGB;
this->actualFormatId = angle::FormatID::R8_UNORM_SRGB;
this->initFunction = nullptr;
this->swizzled = false;
break;
case angle::FormatID::D16_UNORM:
this->metalFormat = MTLPixelFormatDepth32Float;
......@@ -2337,6 +2359,24 @@ void Format::init(const DisplayMtl *display, angle::FormatID intendedFormatId_)
this->swizzled = false;
break;
case angle::FormatID::R8G8_UNORM_SRGB:
this->metalFormat = MTLPixelFormatRG8Unorm_sRGB;
this->actualFormatId = angle::FormatID::R8G8_UNORM_SRGB;
this->initFunction = nullptr;
this->swizzled = false;
break;
case angle::FormatID::R8_UNORM_SRGB:
this->metalFormat = MTLPixelFormatR8Unorm_sRGB;
this->actualFormatId = angle::FormatID::R8_UNORM_SRGB;
this->initFunction = nullptr;
this->swizzled = false;
break;
case angle::FormatID::ASTC_10x10_UNORM_BLOCK:
if (display->supportsAppleGPUFamily(6))
......@@ -4280,6 +4320,22 @@ void FormatTable::initNativeFormatCapsAutogen(const DisplayMtl *display)
/** blendable*/ false, /** multisample*/ false, /** resolve*/ false,
/** colorRenderable*/ false, /** depthRenderable*/ false);
setFormatCaps(MTLPixelFormatR8Unorm_sRGB, /** filterable*/ display->supportsAppleGPUFamily(1),
/** writable*/ display->supportsAppleGPUFamily(2),
/** blendable*/ display->supportsAppleGPUFamily(1),
/** multisample*/ display->supportsAppleGPUFamily(1),
/** resolve*/ display->supportsAppleGPUFamily(1),
/** colorRenderable*/ display->supportsAppleGPUFamily(1),
/** depthRenderable*/ false);
setFormatCaps(MTLPixelFormatRG8Unorm_sRGB, /** filterable*/ display->supportsAppleGPUFamily(1),
/** writable*/ display->supportsAppleGPUFamily(2),
/** blendable*/ display->supportsAppleGPUFamily(1),
/** multisample*/ display->supportsAppleGPUFamily(1),
/** resolve*/ display->supportsAppleGPUFamily(1),
/** colorRenderable*/ display->supportsAppleGPUFamily(1),
/** depthRenderable*/ false);
#endif
}
......
......@@ -228,6 +228,7 @@ enum
R8G8_SSCALED,
R8G8_UINT,
R8G8_UNORM,
R8G8_UNORM_SRGB,
R8G8_USCALED,
R8_SINT,
R8_SNORM,
......@@ -244,7 +245,6 @@ enum
X2R10G10B10_UNORM_VERTEX,
X2R10G10B10_USCALED_VERTEX
};
}
} // namespace mtl_shader
......
......@@ -1346,6 +1346,7 @@ enum
R8G8_SSCALED,
R8G8_UINT,
R8G8_UNORM,
R8G8_UNORM_SRGB,
R8G8_USCALED,
R8_SINT,
R8_SNORM,
......
......@@ -1279,6 +1279,8 @@ angle::FormatID ConvertToSRGB(angle::FormatID formatID)
{
case angle::FormatID::R8_UNORM:
return angle::FormatID::R8_UNORM_SRGB;
case angle::FormatID::R8G8_UNORM:
return angle::FormatID::R8G8_UNORM_SRGB;
case angle::FormatID::R8G8B8_UNORM:
return angle::FormatID::R8G8B8_UNORM_SRGB;
case angle::FormatID::R8G8B8A8_UNORM:
......@@ -1340,6 +1342,8 @@ angle::FormatID ConvertToLinear(angle::FormatID formatID)
{
case angle::FormatID::R8_UNORM_SRGB:
return angle::FormatID::R8_UNORM;
case angle::FormatID::R8G8_UNORM_SRGB:
return angle::FormatID::R8G8_UNORM;
case angle::FormatID::R8G8B8_UNORM_SRGB:
return angle::FormatID::R8G8B8_UNORM;
case angle::FormatID::R8G8B8A8_UNORM_SRGB:
......
......@@ -123,6 +123,7 @@ bool GetTextureSRGBOverrideSupport(const RendererVk *rendererVk,
GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,
GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT};
std::vector<GLenum> optionalR8LinearFormats = {GL_R8};
std::vector<GLenum> optionalRG8LinearFormats = {GL_RG8};
std::vector<GLenum> optionalBPTCLinearFormats = {GL_COMPRESSED_RGBA_BPTC_UNORM_EXT};
if (!FormatReinterpretationSupported(optionalLinearFormats, rendererVk, kNonLinearColorspace))
......@@ -130,7 +131,7 @@ bool GetTextureSRGBOverrideSupport(const RendererVk *rendererVk,
return false;
}
if (supportedExtensions.textureCompressionS3TCsRGB == true)
if (supportedExtensions.textureCompressionS3TCsRGB)
{
if (!FormatReinterpretationSupported(optionalS3TCLinearFormats, rendererVk,
kNonLinearColorspace))
......@@ -139,7 +140,7 @@ bool GetTextureSRGBOverrideSupport(const RendererVk *rendererVk,
}
}
if (supportedExtensions.sRGBR8EXT == true)
if (supportedExtensions.sRGBR8EXT)
{
if (!FormatReinterpretationSupported(optionalR8LinearFormats, rendererVk,
kNonLinearColorspace))
......@@ -148,9 +149,16 @@ bool GetTextureSRGBOverrideSupport(const RendererVk *rendererVk,
}
}
// TODO: http://anglebug.com/4932 check EXT_texture_sRGB_RG8
if (supportedExtensions.sRGBRG8EXT)
{
if (!FormatReinterpretationSupported(optionalRG8LinearFormats, rendererVk,
kNonLinearColorspace))
{
return false;
}
}
if (supportedExtensions.textureCompressionBPTC == true)
if (supportedExtensions.textureCompressionBPTC)
{
if (!FormatReinterpretationSupported(optionalBPTCLinearFormats, rendererVk,
kNonLinearColorspace))
......
......@@ -36,6 +36,7 @@
"R8_USCALED": "VK_FORMAT_R8_USCALED",
"R8_SSCALED": "VK_FORMAT_R8_SSCALED",
"R8G8_UNORM": "VK_FORMAT_R8G8_UNORM",
"R8G8_UNORM_SRGB": "VK_FORMAT_R8G8_SRGB",
"R8G8_SNORM": "VK_FORMAT_R8G8_SNORM",
"R8G8_UINT": "VK_FORMAT_R8G8_UINT",
"R8G8_SINT": "VK_FORMAT_R8G8_SINT",
......
......@@ -2168,6 +2168,16 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat)
vertexLoadRequiresConversion = false;
break;
case angle::FormatID::R8G8_UNORM_SRGB:
intendedGLFormat = GL_SRG8_EXT;
actualImageFormatID = angle::FormatID::R8G8_UNORM_SRGB;
imageInitializerFunction = nullptr;
actualBufferFormatID = angle::FormatID::R8G8_UNORM_SRGB;
vkBufferFormatIsPacked = false;
vertexLoadFunction = CopyNativeVertexData<GLubyte, 2, 2, 0>;
vertexLoadRequiresConversion = false;
break;
case angle::FormatID::R8G8_USCALED:
intendedGLFormat = GL_RG8_USCALED_ANGLEX;
actualImageFormatID = angle::FormatID::R8G8_USCALED;
......@@ -2492,6 +2502,7 @@ VkFormat GetVkFormatFromFormatID(angle::FormatID formatID)
{angle::FormatID::R8G8_SSCALED, VK_FORMAT_R8G8_SSCALED},
{angle::FormatID::R8G8_UINT, VK_FORMAT_R8G8_UINT},
{angle::FormatID::R8G8_UNORM, VK_FORMAT_R8G8_UNORM},
{angle::FormatID::R8G8_UNORM_SRGB, VK_FORMAT_R8G8_SRGB},
{angle::FormatID::R8G8_USCALED, VK_FORMAT_R8G8_USCALED},
{angle::FormatID::R8_SINT, VK_FORMAT_R8_SINT},
{angle::FormatID::R8_SNORM, VK_FORMAT_R8_SNORM},
......@@ -2784,6 +2795,8 @@ angle::FormatID GetFormatIDFromVkFormat(VkFormat vkFormat)
return angle::FormatID::R8G8_UINT;
case VK_FORMAT_R8G8_UNORM:
return angle::FormatID::R8G8_UNORM;
case VK_FORMAT_R8G8_SRGB:
return angle::FormatID::R8G8_UNORM_SRGB;
case VK_FORMAT_R8G8_USCALED:
return angle::FormatID::R8G8_USCALED;
case VK_FORMAT_R8_SINT:
......
......@@ -44,6 +44,7 @@ constexpr FormatMap<VkFormatProperties> kFormatProperties = {
{FormatID::R8G8_USCALED, {0, 0, 0}},
{FormatID::D32_FLOAT_S8X24_UINT, {0, 0, 0}},
{FormatID::ETC2_R8G8B8_SRGB_BLOCK, {0, 0, 0}},
{FormatID::R8G8_UNORM_SRGB, {0, 0, 0}},
{FormatID::R32G32B32A32_SINT,
{0, BLIT_DST | BLIT_SRC | COLOR_ATTACHMENT | SAMPLED_IMAGE | STORAGE_IMAGE,
STORAGE_TEXEL_BUFFER | UNIFORM_TEXEL_BUFFER | VERTEX_BUFFER}},
......
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