mirror of
https://github.com/godotengine/godot-angle-static.git
synced 2026-01-06 02:09:55 +03:00
Fix initialization for ETC2 punchthrough alpha formats
* Zero-filled ETC2_A1 data must be treated as opaque black * Removed init functions when emulation is not needed * Fixed initialization for emulated ETC2_R8G8B8A1_SRGB_BLOCK Bug: angleproject:6936 Bug: angleproject:6941 Change-Id: Ie5555bbaa6b1a2bcfd9c22cb9c17d1a96e72aa70 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3406761 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
This commit is contained in:
committed by
Angle LUCI CQ
parent
cac4e54a6b
commit
a20cd8b733
@@ -4,7 +4,7 @@
|
||||
"src/libANGLE/renderer/Format_table_autogen.cpp":
|
||||
"afe82012cba43b1bab4b40f890b1eb89",
|
||||
"src/libANGLE/renderer/angle_format.py":
|
||||
"74d6c9842128293118ccf128aeae896a",
|
||||
"2f8fa768088e22b0963bbdf842d3e725",
|
||||
"src/libANGLE/renderer/angle_format_data.json":
|
||||
"bad90135a5d792928071aacdf80219c9",
|
||||
"src/libANGLE/renderer/angle_format_map.json":
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"src/libANGLE/renderer/angle_format.py":
|
||||
"74d6c9842128293118ccf128aeae896a",
|
||||
"2f8fa768088e22b0963bbdf842d3e725",
|
||||
"src/libANGLE/renderer/gen_load_functions_table.py":
|
||||
"c131c494e7e0b35b65a8a097b4b8e5ce",
|
||||
"src/libANGLE/renderer/load_functions_data.json":
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"src/libANGLE/renderer/angle_format.py":
|
||||
"74d6c9842128293118ccf128aeae896a",
|
||||
"2f8fa768088e22b0963bbdf842d3e725",
|
||||
"src/libANGLE/renderer/gen_load_texture_border_functions_table.py":
|
||||
"77210fd59d00504369691ce2107c1598",
|
||||
"src/libANGLE/renderer/load_texture_border_functions_data.json":
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"src/libANGLE/renderer/angle_format.py":
|
||||
"74d6c9842128293118ccf128aeae896a",
|
||||
"2f8fa768088e22b0963bbdf842d3e725",
|
||||
"src/libANGLE/renderer/d3d/d3d11/gen_texture_format_table.py":
|
||||
"2b34c48ecd50e81b4938e0788407a6ce",
|
||||
"src/libANGLE/renderer/d3d/d3d11/texture_format_data.json":
|
||||
@@ -8,5 +8,5 @@
|
||||
"src/libANGLE/renderer/d3d/d3d11/texture_format_map.json":
|
||||
"c2019facd60d49228232b0e0b5e5048b",
|
||||
"src/libANGLE/renderer/d3d/d3d11/texture_format_table_autogen.cpp":
|
||||
"2479ac57d25ded7eec0fa4aecd300f91"
|
||||
"85307e3ecf179bfe3ffc42513f1b361e"
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"src/libANGLE/renderer/angle_format.py":
|
||||
"74d6c9842128293118ccf128aeae896a",
|
||||
"2f8fa768088e22b0963bbdf842d3e725",
|
||||
"src/libANGLE/renderer/angle_format_map.json":
|
||||
"951e1bceaba86eecb5c23173e897d092",
|
||||
"src/libANGLE/renderer/dxgi_format_data.json":
|
||||
|
||||
@@ -6,5 +6,5 @@
|
||||
"src/libANGLE/gen_copy_conversion_table.py":
|
||||
"0a73b7580342b9e27d4c71ade3af55e5",
|
||||
"src/libANGLE/renderer/angle_format.py":
|
||||
"74d6c9842128293118ccf128aeae896a"
|
||||
"2f8fa768088e22b0963bbdf842d3e725"
|
||||
}
|
||||
@@ -8,5 +8,5 @@
|
||||
"src/libANGLE/gen_format_map.py":
|
||||
"2421e2cfb4e074ae3fa6baa031c6394e",
|
||||
"src/libANGLE/renderer/angle_format.py":
|
||||
"74d6c9842128293118ccf128aeae896a"
|
||||
"2f8fa768088e22b0963bbdf842d3e725"
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"src/libANGLE/renderer/angle_format.py":
|
||||
"74d6c9842128293118ccf128aeae896a",
|
||||
"2f8fa768088e22b0963bbdf842d3e725",
|
||||
"src/libANGLE/renderer/angle_format_map.json":
|
||||
"951e1bceaba86eecb5c23173e897d092",
|
||||
"src/libANGLE/renderer/gen_angle_format_table.py":
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"src/libANGLE/renderer/angle_format.py":
|
||||
"74d6c9842128293118ccf128aeae896a",
|
||||
"2f8fa768088e22b0963bbdf842d3e725",
|
||||
"src/libANGLE/renderer/angle_format_map.json":
|
||||
"951e1bceaba86eecb5c23173e897d092",
|
||||
"src/libANGLE/renderer/metal/gen_mtl_format_table.py":
|
||||
@@ -8,5 +8,5 @@
|
||||
"src/libANGLE/renderer/metal/mtl_format_map.json":
|
||||
"8ee95dde69a2f04973ea19434e4f9f3e",
|
||||
"src/libANGLE/renderer/metal/mtl_format_table_autogen.mm":
|
||||
"7de4639fbacbb72b0850cf16cbf31d3b"
|
||||
"dc15669905799afab8b22bdf400417ca"
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
"scripts/gl.xml":
|
||||
"467556b6f73fd024b08b703d0be83999",
|
||||
"src/libANGLE/renderer/angle_format.py":
|
||||
"74d6c9842128293118ccf128aeae896a",
|
||||
"2f8fa768088e22b0963bbdf842d3e725",
|
||||
"src/libANGLE/renderer/gl/DispatchTableGL_autogen.cpp":
|
||||
"f0d5c792843c9d7d9c06fd7b9b20724c",
|
||||
"src/libANGLE/renderer/gl/DispatchTableGL_autogen.h":
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"src/libANGLE/renderer/angle_format.py":
|
||||
"74d6c9842128293118ccf128aeae896a",
|
||||
"2f8fa768088e22b0963bbdf842d3e725",
|
||||
"src/libANGLE/renderer/angle_format_map.json":
|
||||
"951e1bceaba86eecb5c23173e897d092",
|
||||
"src/libANGLE/renderer/vulkan/gen_vk_format_table.py":
|
||||
@@ -8,5 +8,5 @@
|
||||
"src/libANGLE/renderer/vulkan/vk_format_map.json":
|
||||
"39f2bdd9574a0f1b6666862ef104297f",
|
||||
"src/libANGLE/renderer/vulkan/vk_format_table_autogen.cpp":
|
||||
"4bd34086514c7cecc764a8f7c8b50d48"
|
||||
"f012e32acb32d14edf565aedddcbd47b"
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"src/libANGLE/renderer/angle_format.py":
|
||||
"74d6c9842128293118ccf128aeae896a",
|
||||
"2f8fa768088e22b0963bbdf842d3e725",
|
||||
"src/libANGLE/renderer/vulkan/gen_vk_mandatory_format_support_table.py":
|
||||
"3e2b8cd80373275e862bb7c8ba20a745",
|
||||
"src/libANGLE/renderer/vulkan/vk_format_map.json":
|
||||
|
||||
@@ -149,7 +149,7 @@ def gl_format_channels(internal_format):
|
||||
if (internal_format.find('ALPHA') >= 0):
|
||||
return 'la'
|
||||
return 'l'
|
||||
if channels_string == 'SRGB':
|
||||
if channels_string == 'SRGB' or channels_string == 'RGB':
|
||||
if (internal_format.find('ALPHA') >= 0):
|
||||
return 'rgba'
|
||||
return 'rgb'
|
||||
@@ -167,6 +167,11 @@ def get_internal_format_initializer(internal_format, format_id):
|
||||
gl_format_no_alpha = gl_channels == 'rgb' or gl_channels == 'l'
|
||||
component_type, bits, channels = get_format_info(format_id)
|
||||
|
||||
# ETC2 punchthrough formats have per-pixel alpha values but a zero-filled block is parsed as opaque black.
|
||||
# Ensure correct initialization when the formats are emulated.
|
||||
if 'PUNCHTHROUGH_ALPHA1_ETC2' in internal_format and 'ETC2' not in format_id:
|
||||
return 'Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>'
|
||||
|
||||
if not gl_format_no_alpha or channels != 'rgba':
|
||||
return 'nullptr'
|
||||
|
||||
|
||||
@@ -1285,7 +1285,7 @@ const Format &Format::Get(GLenum internalFormat, const Renderer11DeviceCaps &dev
|
||||
DXGI_FORMAT_UNKNOWN,
|
||||
DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
|
||||
GL_SRGB8_ALPHA8,
|
||||
nullptr);
|
||||
Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>);
|
||||
return info;
|
||||
}
|
||||
case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE:
|
||||
|
||||
@@ -945,6 +945,7 @@ void Format::init(const DisplayMtl *display, angle::FormatID intendedFormatId_)
|
||||
|
||||
this->metalFormat = MTLPixelFormatRGBA8Unorm_sRGB;
|
||||
this->actualFormatId = angle::FormatID::R8G8B8A8_UNORM_SRGB;
|
||||
this->initFunction = Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>;
|
||||
break;
|
||||
|
||||
case angle::FormatID::ETC2_R8G8B8A1_UNORM_BLOCK:
|
||||
@@ -1125,7 +1126,6 @@ void Format::init(const DisplayMtl *display, angle::FormatID intendedFormatId_)
|
||||
|
||||
this->metalFormat = MTLPixelFormatETC2_RGB8A1;
|
||||
this->actualFormatId = angle::FormatID::ETC2_R8G8B8A1_UNORM_BLOCK;
|
||||
this->initFunction = Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>;
|
||||
break;
|
||||
|
||||
case angle::FormatID::ETC2_R8G8B8A8_SRGB_BLOCK:
|
||||
@@ -1639,7 +1639,6 @@ void Format::init(const DisplayMtl *display, angle::FormatID intendedFormatId_)
|
||||
|
||||
this->metalFormat = MTLPixelFormatETC2_RGB8A1;
|
||||
this->actualFormatId = angle::FormatID::ETC2_R8G8B8A1_UNORM_BLOCK;
|
||||
this->initFunction = Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>;
|
||||
break;
|
||||
|
||||
case angle::FormatID::ETC2_R8G8B8A8_SRGB_BLOCK:
|
||||
@@ -2207,6 +2206,7 @@ void Format::init(const DisplayMtl *display, angle::FormatID intendedFormatId_)
|
||||
{
|
||||
this->metalFormat = MTLPixelFormatRGBA8Unorm_sRGB;
|
||||
this->actualFormatId = angle::FormatID::R8G8B8A8_UNORM_SRGB;
|
||||
this->initFunction = Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -2216,7 +2216,6 @@ void Format::init(const DisplayMtl *display, angle::FormatID intendedFormatId_)
|
||||
{
|
||||
this->metalFormat = MTLPixelFormatETC2_RGB8A1;
|
||||
this->actualFormatId = angle::FormatID::ETC2_R8G8B8A1_UNORM_BLOCK;
|
||||
this->initFunction = Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -875,7 +875,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat)
|
||||
{
|
||||
static constexpr ImageFormatInitInfo kInfo[] = {
|
||||
{angle::FormatID::ETC2_R8G8B8A1_SRGB_BLOCK, nullptr},
|
||||
{angle::FormatID::R8G8B8A8_UNORM_SRGB, nullptr}};
|
||||
{angle::FormatID::R8G8B8A8_UNORM_SRGB,
|
||||
Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>}};
|
||||
initImageFallback(renderer, kInfo, ArraySize(kInfo));
|
||||
}
|
||||
mActualBufferFormatID = angle::FormatID::ETC2_R8G8B8A1_SRGB_BLOCK;
|
||||
@@ -888,8 +889,7 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat)
|
||||
mIntendedGLFormat = GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2;
|
||||
{
|
||||
static constexpr ImageFormatInitInfo kInfo[] = {
|
||||
{angle::FormatID::ETC2_R8G8B8A1_UNORM_BLOCK,
|
||||
Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>},
|
||||
{angle::FormatID::ETC2_R8G8B8A1_UNORM_BLOCK, nullptr},
|
||||
{angle::FormatID::R8G8B8A8_UNORM,
|
||||
Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>}};
|
||||
initImageFallback(renderer, kInfo, ArraySize(kInfo));
|
||||
|
||||
@@ -490,3 +490,11 @@
|
||||
2861 ANDROID GLES : RobustBufferAccessBehaviorTest.NoBufferData/* = SKIP
|
||||
2861 ANDROID GLES : RobustBufferAccessBehaviorTest.EmptyBuffer/* = SKIP
|
||||
3099 AMD OPENGL : RobustBufferAccessBehaviorTest.EmptyBuffer/* = SKIP
|
||||
|
||||
// Missing ETC2 support on macOS OpenGL
|
||||
3853 MAC OPENGL : Texture2DTestES3RobustInit.TextureCOMPRESSEDRGB8A1ETC2/* = SKIP
|
||||
3853 MAC OPENGL : Texture2DTestES3RobustInit.TextureCOMPRESSEDSRGB8A1ETC2/* = SKIP
|
||||
|
||||
// Missing Vulkan image initialization
|
||||
6941 VULKAN : Texture2DTestES3RobustInit.TextureCOMPRESSEDRGB8A1ETC2/* = SKIP
|
||||
6941 VULKAN : Texture2DTestES3RobustInit.TextureCOMPRESSEDSRGB8A1ETC2/* = SKIP
|
||||
|
||||
@@ -201,3 +201,6 @@
|
||||
6663 : Texture2DTest.UploadThenFSThenVSThenNewRPThenFS/* = NOT_RUN
|
||||
|
||||
6741 : VulkanImageTest.* = SKIP_FOR_CAPTURE
|
||||
|
||||
6941 : Texture2DTestES3RobustInit.TextureCOMPRESSEDRGB8A1ETC2/* = NOT_RUN
|
||||
6941 : Texture2DTestES3RobustInit.TextureCOMPRESSEDSRGB8A1ETC2/* = NOT_RUN
|
||||
|
||||
@@ -468,6 +468,12 @@ class Texture2DTestES3 : public Texture2DTest
|
||||
}
|
||||
};
|
||||
|
||||
class Texture2DTestES3RobustInit : public Texture2DTestES3
|
||||
{
|
||||
protected:
|
||||
Texture2DTestES3RobustInit() : Texture2DTestES3() { setRobustResourceInit(true); }
|
||||
};
|
||||
|
||||
class Texture2DBaseMaxTestES3 : public ANGLETest
|
||||
{
|
||||
protected:
|
||||
@@ -5942,6 +5948,36 @@ TEST_P(Texture2DTestES3, TextureCOMPRESSEDSRGB8ETC2ImplicitAlpha1)
|
||||
EXPECT_PIXEL_ALPHA_EQ(0, 0, 255);
|
||||
}
|
||||
|
||||
// ETC2 punchthrough alpha formats must be initialized to opaque black when emulated
|
||||
// http://anglebug.com/6936
|
||||
TEST_P(Texture2DTestES3RobustInit, TextureCOMPRESSEDRGB8A1ETC2)
|
||||
{
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, mTexture2D);
|
||||
glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, 1, 1, 0,
|
||||
8, nullptr);
|
||||
EXPECT_GL_NO_ERROR();
|
||||
|
||||
drawQuad(mProgram, "position", 0.5f);
|
||||
|
||||
EXPECT_PIXEL_ALPHA_EQ(0, 0, 255);
|
||||
}
|
||||
|
||||
// ETC2 punchthrough alpha formats must be initialized to opaque black when emulated
|
||||
// http://anglebug.com/6936
|
||||
TEST_P(Texture2DTestES3RobustInit, TextureCOMPRESSEDSRGB8A1ETC2)
|
||||
{
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, mTexture2D);
|
||||
glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, 1, 1, 0,
|
||||
8, nullptr);
|
||||
EXPECT_GL_NO_ERROR();
|
||||
|
||||
drawQuad(mProgram, "position", 0.5f);
|
||||
|
||||
EXPECT_PIXEL_ALPHA_EQ(0, 0, 255);
|
||||
}
|
||||
|
||||
// Test that compressed textures ignore the pixel unpack state.
|
||||
// (https://crbug.org/1267496)
|
||||
TEST_P(Texture2DTestES3, PixelUnpackStateTexImage)
|
||||
@@ -10339,6 +10375,9 @@ ANGLE_INSTANTIATE_TEST_ES2(SamplerArrayAsFunctionParameterTest);
|
||||
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(Texture2DTestES3);
|
||||
ANGLE_INSTANTIATE_TEST_ES3_AND(Texture2DTestES3, WithAllocateNonZeroMemory(ES3_VULKAN()));
|
||||
|
||||
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(Texture2DTestES3RobustInit);
|
||||
ANGLE_INSTANTIATE_TEST_ES3(Texture2DTestES3RobustInit);
|
||||
|
||||
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(Texture2DTestES31PPO);
|
||||
ANGLE_INSTANTIATE_TEST_ES31(Texture2DTestES31PPO);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user