From 45e5cf014778b2ec4ac0c8255879af36feb56698 Mon Sep 17 00:00:00 2001 From: Lubosz Sarnecki Date: Fri, 3 Jun 2022 14:29:23 +0200 Subject: [PATCH] Vulkan: Implement ASTC emulation. Implement ASTC emulation using the astc-encoder library. Add copy_image tests to deqp_gles31_test_expectations for desktop cards. Add emulatedAstc limitation. Don't expose emulated ASTC from WebGL contexts. Introduce ANGLE_HAS_ASTCENC define to check for build availability. Only build on angle_standalone configurations. DEPS: Add astc-encoder. image_util: Decode ASTC to RGBA. TracePerfTest: Skip car_chase and genshin_impact on NVIDIA. Bug: angleproject:7415 Change-Id: Ib2f3fd3f710164a2ecd5d5edf780227031bbfb84 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3697999 Commit-Queue: Lubosz Sarnecki Reviewed-by: Shahbaz Youssefi Reviewed-by: Cody Northrop --- .gitignore | 1 + BUILD.gn | 9 + DEPS | 4 + gni/angle.gni | 5 + .../ANGLE_load_functions_table.json | 4 +- .../code_generation_hashes/Vulkan_format.json | 4 +- ...Vulkan_mandatory_format_support_table.json | 2 +- src/image_util/loadimage.h | 23 + src/image_util/loadimage.inc | 15 + src/image_util/loadimage_astc.cpp | 84 +++ src/libANGLE/Caps.h | 3 + src/libANGLE/Context.cpp | 13 + .../renderer/load_functions_data.json | 84 +++ .../renderer/load_functions_table_autogen.cpp | 616 +++++++++++++++++- .../renderer/vulkan/vk_caps_utils.cpp | 7 + .../renderer/vulkan/vk_format_map.json | 85 +++ .../vulkan/vk_format_table_autogen.cpp | 504 ++++++++------ src/libANGLE/renderer/vulkan/vk_helpers.cpp | 13 + src/libGLESv2.gni | 1 + .../deqp_gles31_test_expectations.txt | 8 +- src/tests/perf_tests/TracePerfTest.cpp | 10 + third_party/astc-encoder/BUILD.gn | 49 ++ third_party/astc-encoder/README.angle | 10 + 23 files changed, 1324 insertions(+), 230 deletions(-) create mode 100644 src/image_util/loadimage_astc.cpp create mode 100644 third_party/astc-encoder/BUILD.gn create mode 100644 third_party/astc-encoder/README.angle diff --git a/.gitignore b/.gitignore index 07eb50a36..a18584c27 100644 --- a/.gitignore +++ b/.gitignore @@ -37,6 +37,7 @@ /third_party/android_platform /third_party/android_sdk /third_party/android_system_sdk/*.jar +/third_party/astc-encoder/src /third_party/bazel/desugar/*.jar /third_party/catapult /third_party/cherry diff --git a/BUILD.gn b/BUILD.gn index 3d94badcd..cf238a2dd 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -186,6 +186,10 @@ config("internal_config") { if (is_lsan) { defines += [ "ANGLE_WITH_LSAN" ] } + + if (angle_has_astc_encoder) { + defines += [ "ANGLE_HAS_ASTCENC" ] + } } config("constructor_and_destructor_warnings") { @@ -453,6 +457,11 @@ angle_static_library("angle_image_util") { sources = libangle_image_util_sources public_configs += [ ":angle_image_util_config" ] public_deps = [ ":angle_image_util_headers" ] + + if (angle_has_astc_encoder) { + public_deps += [ "third_party/astc-encoder:astcenc" ] + include_dirs = [ "third_party/astc-encoder/src/Source/" ] + } } config("angle_gl_visibility_config") { diff --git a/DEPS b/DEPS index e5e69cf70..242d313ea 100644 --- a/DEPS +++ b/DEPS @@ -329,6 +329,10 @@ deps = { 'dep_type': 'cipd', }, + 'third_party/astc-encoder/src': { + 'url': '{chromium_git}/external/github.com/ARM-software/astc-encoder@573c475389bf51d16a5c3fc8348092e094e50e8f', + }, + 'third_party/bazel': { 'packages': [ { diff --git a/gni/angle.gni b/gni/angle.gni index e9a8f8561..04261f7b6 100644 --- a/gni/angle.gni +++ b/gni/angle.gni @@ -172,6 +172,11 @@ declare_args() { angle_use_spirv_gen_through_glslang = false } +declare_args() { + # ASTC emulation is only built on standalone non-android builds + angle_has_astc_encoder = angle_has_build && angle_standalone && !is_android +} + # OpenCL is not supported on Windows UWP, because the CL headers include DX9, which is not # supported by UWP. A workaround might be possible if CL support on UWP is required. assert(!angle_is_winuwp || !angle_enable_cl, diff --git a/scripts/code_generation_hashes/ANGLE_load_functions_table.json b/scripts/code_generation_hashes/ANGLE_load_functions_table.json index b955e2ace..7d0b5a688 100644 --- a/scripts/code_generation_hashes/ANGLE_load_functions_table.json +++ b/scripts/code_generation_hashes/ANGLE_load_functions_table.json @@ -4,7 +4,7 @@ "src/libANGLE/renderer/gen_load_functions_table.py": "c131c494e7e0b35b65a8a097b4b8e5ce", "src/libANGLE/renderer/load_functions_data.json": - "1a100e50618ced033cc5f1089835bbb5", + "343f229371f6f3256f9b438357207df8", "src/libANGLE/renderer/load_functions_table_autogen.cpp": - "aabdd7134aafe9ea4ee51a900c89e7bc" + "323a44e243f877f47340d9579bda4075" } \ No newline at end of file diff --git a/scripts/code_generation_hashes/Vulkan_format.json b/scripts/code_generation_hashes/Vulkan_format.json index c8a417f32..b17e7dd72 100644 --- a/scripts/code_generation_hashes/Vulkan_format.json +++ b/scripts/code_generation_hashes/Vulkan_format.json @@ -6,7 +6,7 @@ "src/libANGLE/renderer/vulkan/gen_vk_format_table.py": "6e4c403c145549c0baa69d65b5e73152", "src/libANGLE/renderer/vulkan/vk_format_map.json": - "39f2bdd9574a0f1b6666862ef104297f", + "8134339a250dae3095ff1dbcb00540e6", "src/libANGLE/renderer/vulkan/vk_format_table_autogen.cpp": - "f012e32acb32d14edf565aedddcbd47b" + "4dced0d669b07b70bc90f7ee8364befc" } \ No newline at end of file diff --git a/scripts/code_generation_hashes/Vulkan_mandatory_format_support_table.json b/scripts/code_generation_hashes/Vulkan_mandatory_format_support_table.json index 8630e89ef..4aa40a0b8 100644 --- a/scripts/code_generation_hashes/Vulkan_mandatory_format_support_table.json +++ b/scripts/code_generation_hashes/Vulkan_mandatory_format_support_table.json @@ -4,7 +4,7 @@ "src/libANGLE/renderer/vulkan/gen_vk_mandatory_format_support_table.py": "ffb3d44c853669c2c260b96b3808fcf3", "src/libANGLE/renderer/vulkan/vk_format_map.json": - "39f2bdd9574a0f1b6666862ef104297f", + "8134339a250dae3095ff1dbcb00540e6", "src/libANGLE/renderer/vulkan/vk_mandatory_format_support_data.json": "fa2bd54c1bb0ab2cf1d386061a4bc5c5", "src/libANGLE/renderer/vulkan/vk_mandatory_format_support_table_autogen.cpp": diff --git a/src/image_util/loadimage.h b/src/image_util/loadimage.h index 2e42526d7..0b6ae7fcc 100644 --- a/src/image_util/loadimage.h +++ b/src/image_util/loadimage.h @@ -681,6 +681,29 @@ void LoadETC1RGB8ToRGBA8(size_t width, size_t outputRowPitch, size_t outputDepthPitch); +void LoadASTCToRGBA8Inner(size_t width, + size_t height, + size_t depth, + uint32_t blockWidth, + uint32_t blockHeight, + const uint8_t *input, + size_t inputRowPitch, + size_t inputDepthPitch, + uint8_t *output, + size_t outputRowPitch, + size_t outputDepthPitch); + +template +inline void LoadASTCToRGBA8(size_t width, + size_t height, + size_t depth, + const uint8_t *input, + size_t inputRowPitch, + size_t inputDepthPitch, + uint8_t *output, + size_t outputRowPitch, + size_t outputDepthPitch); + void LoadETC1RGB8ToBC1(size_t width, size_t height, size_t depth, diff --git a/src/image_util/loadimage.inc b/src/image_util/loadimage.inc index 8d44b2bc3..6ebf138fd 100644 --- a/src/image_util/loadimage.inc +++ b/src/image_util/loadimage.inc @@ -159,4 +159,19 @@ inline void Initialize4ComponentData(size_t width, size_t height, size_t depth, } } +template +inline void LoadASTCToRGBA8(size_t width, + size_t height, + size_t depth, + const uint8_t *input, + size_t inputRowPitch, + size_t inputDepthPitch, + uint8_t *output, + size_t outputRowPitch, + size_t outputDepthPitch) +{ + LoadASTCToRGBA8Inner(width, height, depth, blockWidth, blockHeight, input, inputRowPitch, + inputDepthPitch, output, outputRowPitch, outputDepthPitch); +} + } // namespace angle diff --git a/src/image_util/loadimage_astc.cpp b/src/image_util/loadimage_astc.cpp new file mode 100644 index 000000000..34fd16432 --- /dev/null +++ b/src/image_util/loadimage_astc.cpp @@ -0,0 +1,84 @@ +// +// Copyright 2022 The ANGLE Project Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// + +// loadimage_astc.cpp: Decodes ASTC encoded textures. + +#ifdef ANGLE_HAS_ASTCENC +# include +#endif + +#include "image_util/loadimage.h" + +namespace angle +{ + +void LoadASTCToRGBA8Inner(size_t width, + size_t height, + size_t depth, + uint32_t blockWidth, + uint32_t blockHeight, + const uint8_t *input, + size_t inputRowPitch, + size_t inputDepthPitch, + uint8_t *output, + size_t outputRowPitch, + size_t outputDepthPitch) +{ +#ifdef ANGLE_HAS_ASTCENC + astcenc_config config; + + constexpr unsigned int kBlockZ = 1; + + const float kQuality = ASTCENC_PRE_MEDIUM; + constexpr astcenc_profile kProfile = ASTCENC_PRF_LDR; + + astcenc_error status; + status = astcenc_config_init(kProfile, blockWidth, blockHeight, kBlockZ, kQuality, + ASTCENC_FLG_DECOMPRESS_ONLY, &config); + if (status != ASTCENC_SUCCESS) + { + WARN() << "astcenc config init failed: " << astcenc_get_error_string(status); + return; + } + + constexpr unsigned int kThreadCount = 1; + + astcenc_context *context; + status = astcenc_context_alloc(&config, kThreadCount, &context); + if (status != ASTCENC_SUCCESS) + { + WARN() << "Could not allocate astcenc context: " << astcenc_get_error_string(status); + return; + } + + // Compute the number of ASTC blocks in each dimension + uint32_t blockCountX = (static_cast(width) + config.block_x - 1) / config.block_x; + uint32_t blockCountY = (static_cast(height) + config.block_y - 1) / config.block_y; + + // Space needed for 16 bytes of output per compressed block + size_t blockSize = blockCountX * blockCountY * 16; + + astcenc_image image; + image.dim_x = static_cast(width); + image.dim_y = static_cast(height); + image.dim_z = 1; + image.data_type = ASTCENC_TYPE_U8; + image.data = reinterpret_cast(&output); + + constexpr astcenc_swizzle swizzle{ASTCENC_SWZ_R, ASTCENC_SWZ_G, ASTCENC_SWZ_B, ASTCENC_SWZ_A}; + + status = astcenc_decompress_image(context, input, blockSize, &image, &swizzle, 0); + if (status != ASTCENC_SUCCESS) + { + WARN() << "astcenc decompress failed: " << astcenc_get_error_string(status); + } + + astcenc_context_free(context); +#else + ERR() << "Trying to decode ASTC without having ASTC support built."; +#endif +} +} // namespace angle diff --git a/src/libANGLE/Caps.h b/src/libANGLE/Caps.h index 4e5ec34cd..d970888bb 100644 --- a/src/libANGLE/Caps.h +++ b/src/libANGLE/Caps.h @@ -152,6 +152,9 @@ struct Limitations // ETC1 texture support is emulated. bool emulatedEtc1 = false; + // ASTC texture support is emulated. + bool emulatedAstc = false; + // No compressed TEXTURE_3D support. bool noCompressedTexture3D = false; diff --git a/src/libANGLE/Context.cpp b/src/libANGLE/Context.cpp index 716feef7c..20541be0e 100644 --- a/src/libANGLE/Context.cpp +++ b/src/libANGLE/Context.cpp @@ -4030,6 +4030,19 @@ void Context::initCaps() mSupportedExtensions.compressedETC1RGB8TextureOES = false; } + if (getLimitations().emulatedAstc) + { + // Hide emulated ASTC extension from WebGL contexts. + if (mWebGLContext) + { + mSupportedExtensions.textureCompressionAstcLdrKHR = false; + } +#ifndef ANGLE_HAS_ASTCENC + // Don't expose emulated ASTC when it's not built. + mSupportedExtensions.textureCompressionAstcLdrKHR = false; +#endif + } + // If we're capturing application calls for replay, apply some feature limits to increase // portability of the trace. if (getShareGroup()->getFrameCaptureShared()->enabled() || diff --git a/src/libANGLE/renderer/load_functions_data.json b/src/libANGLE/renderer/load_functions_data.json index 4ce0851ea..25a7e6b5f 100644 --- a/src/libANGLE/renderer/load_functions_data.json +++ b/src/libANGLE/renderer/load_functions_data.json @@ -957,141 +957,225 @@ "GL_COMPRESSED_RGBA_ASTC_4x4_KHR": { "NONE": { "GL_UNSIGNED_BYTE": "LoadCompressedToNative<4, 4, 1, 16>" + }, + "R8G8B8A8_UNORM": { + "GL_UNSIGNED_BYTE": "LoadASTCToRGBA8<4, 4>" } }, "GL_COMPRESSED_RGBA_ASTC_5x4_KHR": { "NONE": { "GL_UNSIGNED_BYTE": "LoadCompressedToNative<5, 4, 1, 16>" + }, + "R8G8B8A8_UNORM": { + "GL_UNSIGNED_BYTE": "LoadASTCToRGBA8<5, 4>" } }, "GL_COMPRESSED_RGBA_ASTC_5x5_KHR": { "NONE": { "GL_UNSIGNED_BYTE": "LoadCompressedToNative<5, 5, 1, 16>" + }, + "R8G8B8A8_UNORM": { + "GL_UNSIGNED_BYTE": "LoadASTCToRGBA8<5, 5>" } }, "GL_COMPRESSED_RGBA_ASTC_6x5_KHR": { "NONE": { "GL_UNSIGNED_BYTE": "LoadCompressedToNative<6, 5, 1, 16>" + }, + "R8G8B8A8_UNORM": { + "GL_UNSIGNED_BYTE": "LoadASTCToRGBA8<6, 5>" } }, "GL_COMPRESSED_RGBA_ASTC_6x6_KHR": { "NONE": { "GL_UNSIGNED_BYTE": "LoadCompressedToNative<6, 6, 1, 16>" + }, + "R8G8B8A8_UNORM": { + "GL_UNSIGNED_BYTE": "LoadASTCToRGBA8<6, 6>" } }, "GL_COMPRESSED_RGBA_ASTC_8x5_KHR": { "NONE": { "GL_UNSIGNED_BYTE": "LoadCompressedToNative<8, 5, 1, 16>" + }, + "R8G8B8A8_UNORM": { + "GL_UNSIGNED_BYTE": "LoadASTCToRGBA8<8, 5>" } }, "GL_COMPRESSED_RGBA_ASTC_8x6_KHR": { "NONE": { "GL_UNSIGNED_BYTE": "LoadCompressedToNative<8, 6, 1, 16>" + }, + "R8G8B8A8_UNORM": { + "GL_UNSIGNED_BYTE": "LoadASTCToRGBA8<8, 6>" } }, "GL_COMPRESSED_RGBA_ASTC_8x8_KHR": { "NONE": { "GL_UNSIGNED_BYTE": "LoadCompressedToNative<8, 8, 1, 16>" + }, + "R8G8B8A8_UNORM": { + "GL_UNSIGNED_BYTE": "LoadASTCToRGBA8<8, 8>" } }, "GL_COMPRESSED_RGBA_ASTC_10x5_KHR": { "NONE": { "GL_UNSIGNED_BYTE": "LoadCompressedToNative<10, 5, 1, 16>" + }, + "R8G8B8A8_UNORM": { + "GL_UNSIGNED_BYTE": "LoadASTCToRGBA8<10, 5>" } }, "GL_COMPRESSED_RGBA_ASTC_10x6_KHR": { "NONE": { "GL_UNSIGNED_BYTE": "LoadCompressedToNative<10, 6, 1, 16>" + }, + "R8G8B8A8_UNORM": { + "GL_UNSIGNED_BYTE": "LoadASTCToRGBA8<10, 6>" } }, "GL_COMPRESSED_RGBA_ASTC_10x8_KHR": { "NONE": { "GL_UNSIGNED_BYTE": "LoadCompressedToNative<10, 8, 1, 16>" + }, + "R8G8B8A8_UNORM": { + "GL_UNSIGNED_BYTE": "LoadASTCToRGBA8<10, 8>" } }, "GL_COMPRESSED_RGBA_ASTC_10x10_KHR": { "NONE": { "GL_UNSIGNED_BYTE": "LoadCompressedToNative<10, 10, 1, 16>" + }, + "R8G8B8A8_UNORM": { + "GL_UNSIGNED_BYTE": "LoadASTCToRGBA8<10, 10>" } }, "GL_COMPRESSED_RGBA_ASTC_12x10_KHR": { "NONE": { "GL_UNSIGNED_BYTE": "LoadCompressedToNative<12, 10, 1, 16>" + }, + "R8G8B8A8_UNORM": { + "GL_UNSIGNED_BYTE": "LoadASTCToRGBA8<12, 10>" } }, "GL_COMPRESSED_RGBA_ASTC_12x12_KHR": { "NONE": { "GL_UNSIGNED_BYTE": "LoadCompressedToNative<12, 12, 1, 16>" + }, + "R8G8B8A8_UNORM": { + "GL_UNSIGNED_BYTE": "LoadASTCToRGBA8<12, 12>" } }, "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR": { "NONE": { "GL_UNSIGNED_BYTE": "LoadCompressedToNative<4, 4, 1, 16>" + }, + "R8G8B8A8_UNORM_SRGB": { + "GL_UNSIGNED_BYTE": "LoadASTCToRGBA8<4, 4>" } }, "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR": { "NONE": { "GL_UNSIGNED_BYTE": "LoadCompressedToNative<5, 4, 1, 16>" + }, + "R8G8B8A8_UNORM_SRGB": { + "GL_UNSIGNED_BYTE": "LoadASTCToRGBA8<5, 4>" } }, "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR": { "NONE": { "GL_UNSIGNED_BYTE": "LoadCompressedToNative<5, 5, 1, 16>" + }, + "R8G8B8A8_UNORM_SRGB": { + "GL_UNSIGNED_BYTE": "LoadASTCToRGBA8<5, 5>" } }, "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR": { "NONE": { "GL_UNSIGNED_BYTE": "LoadCompressedToNative<6, 5, 1, 16>" + }, + "R8G8B8A8_UNORM_SRGB": { + "GL_UNSIGNED_BYTE": "LoadASTCToRGBA8<6, 5>" } }, "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR": { "NONE": { "GL_UNSIGNED_BYTE": "LoadCompressedToNative<6, 6, 1, 16>" + }, + "R8G8B8A8_UNORM_SRGB": { + "GL_UNSIGNED_BYTE": "LoadASTCToRGBA8<6, 6>" } }, "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR": { "NONE": { "GL_UNSIGNED_BYTE": "LoadCompressedToNative<8, 5, 1, 16>" + }, + "R8G8B8A8_UNORM_SRGB": { + "GL_UNSIGNED_BYTE": "LoadASTCToRGBA8<8, 5>" } }, "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR": { "NONE": { "GL_UNSIGNED_BYTE": "LoadCompressedToNative<8, 6, 1, 16>" + }, + "R8G8B8A8_UNORM_SRGB": { + "GL_UNSIGNED_BYTE": "LoadASTCToRGBA8<8, 6>" } }, "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR": { "NONE": { "GL_UNSIGNED_BYTE": "LoadCompressedToNative<8, 8, 1, 16>" + }, + "R8G8B8A8_UNORM_SRGB": { + "GL_UNSIGNED_BYTE": "LoadASTCToRGBA8<8, 8>" } }, "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR": { "NONE": { "GL_UNSIGNED_BYTE": "LoadCompressedToNative<10, 5, 1, 16>" + }, + "R8G8B8A8_UNORM_SRGB": { + "GL_UNSIGNED_BYTE": "LoadASTCToRGBA8<10, 5>" } }, "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR": { "NONE": { "GL_UNSIGNED_BYTE": "LoadCompressedToNative<10, 6, 1, 16>" + }, + "R8G8B8A8_UNORM_SRGB": { + "GL_UNSIGNED_BYTE": "LoadASTCToRGBA8<10, 6>" } }, "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR": { "NONE": { "GL_UNSIGNED_BYTE": "LoadCompressedToNative<10, 8, 1, 16>" + }, + "R8G8B8A8_UNORM_SRGB": { + "GL_UNSIGNED_BYTE": "LoadASTCToRGBA8<10, 8>" } }, "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR": { "NONE": { "GL_UNSIGNED_BYTE": "LoadCompressedToNative<10, 10, 1, 16>" + }, + "R8G8B8A8_UNORM_SRGB": { + "GL_UNSIGNED_BYTE": "LoadASTCToRGBA8<10, 10>" } }, "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR": { "NONE": { "GL_UNSIGNED_BYTE": "LoadCompressedToNative<12, 10, 1, 16>" + }, + "R8G8B8A8_UNORM_SRGB": { + "GL_UNSIGNED_BYTE": "LoadASTCToRGBA8<12, 10>" } }, "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR": { "NONE": { "GL_UNSIGNED_BYTE": "LoadCompressedToNative<12, 12, 1, 16>" + }, + "R8G8B8A8_UNORM_SRGB": { + "GL_UNSIGNED_BYTE": "LoadASTCToRGBA8<12, 12>" } }, "GL_COMPRESSED_RGBA_ASTC_3x3x3_OES": { diff --git a/src/libANGLE/renderer/load_functions_table_autogen.cpp b/src/libANGLE/renderer/load_functions_table_autogen.cpp index 7a5b22f74..094d3a357 100644 --- a/src/libANGLE/renderer/load_functions_table_autogen.cpp +++ b/src/libANGLE/renderer/load_functions_table_autogen.cpp @@ -508,6 +508,18 @@ LoadImageFunctionInfo COMPRESSED_RGBA8_ETC2_EAC_to_R8G8B8A8_UNORM(GLenum type) } } +LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_10x10_KHR_to_R8G8B8A8_UNORM(GLenum type) +{ + switch (type) + { + case GL_UNSIGNED_BYTE: + return LoadImageFunctionInfo(LoadASTCToRGBA8<10, 10>, true); + default: + UNREACHABLE(); + return LoadImageFunctionInfo(UnreachableLoadFunction, true); + } +} + LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_10x10_KHR_to_default(GLenum type) { switch (type) @@ -520,6 +532,18 @@ LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_10x10_KHR_to_default(GLenum type) } } +LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_10x5_KHR_to_R8G8B8A8_UNORM(GLenum type) +{ + switch (type) + { + case GL_UNSIGNED_BYTE: + return LoadImageFunctionInfo(LoadASTCToRGBA8<10, 5>, true); + default: + UNREACHABLE(); + return LoadImageFunctionInfo(UnreachableLoadFunction, true); + } +} + LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_10x5_KHR_to_default(GLenum type) { switch (type) @@ -532,6 +556,18 @@ LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_10x5_KHR_to_default(GLenum type) } } +LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_10x6_KHR_to_R8G8B8A8_UNORM(GLenum type) +{ + switch (type) + { + case GL_UNSIGNED_BYTE: + return LoadImageFunctionInfo(LoadASTCToRGBA8<10, 6>, true); + default: + UNREACHABLE(); + return LoadImageFunctionInfo(UnreachableLoadFunction, true); + } +} + LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_10x6_KHR_to_default(GLenum type) { switch (type) @@ -544,6 +580,18 @@ LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_10x6_KHR_to_default(GLenum type) } } +LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_10x8_KHR_to_R8G8B8A8_UNORM(GLenum type) +{ + switch (type) + { + case GL_UNSIGNED_BYTE: + return LoadImageFunctionInfo(LoadASTCToRGBA8<10, 8>, true); + default: + UNREACHABLE(); + return LoadImageFunctionInfo(UnreachableLoadFunction, true); + } +} + LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_10x8_KHR_to_default(GLenum type) { switch (type) @@ -556,6 +604,18 @@ LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_10x8_KHR_to_default(GLenum type) } } +LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_12x10_KHR_to_R8G8B8A8_UNORM(GLenum type) +{ + switch (type) + { + case GL_UNSIGNED_BYTE: + return LoadImageFunctionInfo(LoadASTCToRGBA8<12, 10>, true); + default: + UNREACHABLE(); + return LoadImageFunctionInfo(UnreachableLoadFunction, true); + } +} + LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_12x10_KHR_to_default(GLenum type) { switch (type) @@ -568,6 +628,18 @@ LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_12x10_KHR_to_default(GLenum type) } } +LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_12x12_KHR_to_R8G8B8A8_UNORM(GLenum type) +{ + switch (type) + { + case GL_UNSIGNED_BYTE: + return LoadImageFunctionInfo(LoadASTCToRGBA8<12, 12>, true); + default: + UNREACHABLE(); + return LoadImageFunctionInfo(UnreachableLoadFunction, true); + } +} + LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_12x12_KHR_to_default(GLenum type) { switch (type) @@ -604,6 +676,18 @@ LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_4x3x3_OES_to_default(GLenum type) } } +LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_4x4_KHR_to_R8G8B8A8_UNORM(GLenum type) +{ + switch (type) + { + case GL_UNSIGNED_BYTE: + return LoadImageFunctionInfo(LoadASTCToRGBA8<4, 4>, true); + default: + UNREACHABLE(); + return LoadImageFunctionInfo(UnreachableLoadFunction, true); + } +} + LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_4x4_KHR_to_default(GLenum type) { switch (type) @@ -640,6 +724,18 @@ LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_4x4x4_OES_to_default(GLenum type) } } +LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_5x4_KHR_to_R8G8B8A8_UNORM(GLenum type) +{ + switch (type) + { + case GL_UNSIGNED_BYTE: + return LoadImageFunctionInfo(LoadASTCToRGBA8<5, 4>, true); + default: + UNREACHABLE(); + return LoadImageFunctionInfo(UnreachableLoadFunction, true); + } +} + LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_5x4_KHR_to_default(GLenum type) { switch (type) @@ -664,6 +760,18 @@ LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_5x4x4_OES_to_default(GLenum type) } } +LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_5x5_KHR_to_R8G8B8A8_UNORM(GLenum type) +{ + switch (type) + { + case GL_UNSIGNED_BYTE: + return LoadImageFunctionInfo(LoadASTCToRGBA8<5, 5>, true); + default: + UNREACHABLE(); + return LoadImageFunctionInfo(UnreachableLoadFunction, true); + } +} + LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_5x5_KHR_to_default(GLenum type) { switch (type) @@ -700,6 +808,18 @@ LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_5x5x5_OES_to_default(GLenum type) } } +LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_6x5_KHR_to_R8G8B8A8_UNORM(GLenum type) +{ + switch (type) + { + case GL_UNSIGNED_BYTE: + return LoadImageFunctionInfo(LoadASTCToRGBA8<6, 5>, true); + default: + UNREACHABLE(); + return LoadImageFunctionInfo(UnreachableLoadFunction, true); + } +} + LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_6x5_KHR_to_default(GLenum type) { switch (type) @@ -724,6 +844,18 @@ LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_6x5x5_OES_to_default(GLenum type) } } +LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_6x6_KHR_to_R8G8B8A8_UNORM(GLenum type) +{ + switch (type) + { + case GL_UNSIGNED_BYTE: + return LoadImageFunctionInfo(LoadASTCToRGBA8<6, 6>, true); + default: + UNREACHABLE(); + return LoadImageFunctionInfo(UnreachableLoadFunction, true); + } +} + LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_6x6_KHR_to_default(GLenum type) { switch (type) @@ -760,6 +892,18 @@ LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_6x6x6_OES_to_default(GLenum type) } } +LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_8x5_KHR_to_R8G8B8A8_UNORM(GLenum type) +{ + switch (type) + { + case GL_UNSIGNED_BYTE: + return LoadImageFunctionInfo(LoadASTCToRGBA8<8, 5>, true); + default: + UNREACHABLE(); + return LoadImageFunctionInfo(UnreachableLoadFunction, true); + } +} + LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_8x5_KHR_to_default(GLenum type) { switch (type) @@ -772,6 +916,18 @@ LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_8x5_KHR_to_default(GLenum type) } } +LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_8x6_KHR_to_R8G8B8A8_UNORM(GLenum type) +{ + switch (type) + { + case GL_UNSIGNED_BYTE: + return LoadImageFunctionInfo(LoadASTCToRGBA8<8, 6>, true); + default: + UNREACHABLE(); + return LoadImageFunctionInfo(UnreachableLoadFunction, true); + } +} + LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_8x6_KHR_to_default(GLenum type) { switch (type) @@ -784,6 +940,18 @@ LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_8x6_KHR_to_default(GLenum type) } } +LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_8x8_KHR_to_R8G8B8A8_UNORM(GLenum type) +{ + switch (type) + { + case GL_UNSIGNED_BYTE: + return LoadImageFunctionInfo(LoadASTCToRGBA8<8, 8>, true); + default: + UNREACHABLE(); + return LoadImageFunctionInfo(UnreachableLoadFunction, true); + } +} + LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_8x8_KHR_to_default(GLenum type) { switch (type) @@ -976,6 +1144,18 @@ LoadImageFunctionInfo COMPRESSED_SIGNED_RG11_EAC_to_R16G16_SNORM(GLenum type) } } +LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR_to_R8G8B8A8_UNORM_SRGB(GLenum type) +{ + switch (type) + { + case GL_UNSIGNED_BYTE: + return LoadImageFunctionInfo(LoadASTCToRGBA8<10, 10>, true); + default: + UNREACHABLE(); + return LoadImageFunctionInfo(UnreachableLoadFunction, true); + } +} + LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR_to_default(GLenum type) { switch (type) @@ -988,6 +1168,18 @@ LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR_to_default(GLenum t } } +LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR_to_R8G8B8A8_UNORM_SRGB(GLenum type) +{ + switch (type) + { + case GL_UNSIGNED_BYTE: + return LoadImageFunctionInfo(LoadASTCToRGBA8<10, 5>, true); + default: + UNREACHABLE(); + return LoadImageFunctionInfo(UnreachableLoadFunction, true); + } +} + LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR_to_default(GLenum type) { switch (type) @@ -1000,6 +1192,18 @@ LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR_to_default(GLenum ty } } +LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR_to_R8G8B8A8_UNORM_SRGB(GLenum type) +{ + switch (type) + { + case GL_UNSIGNED_BYTE: + return LoadImageFunctionInfo(LoadASTCToRGBA8<10, 6>, true); + default: + UNREACHABLE(); + return LoadImageFunctionInfo(UnreachableLoadFunction, true); + } +} + LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR_to_default(GLenum type) { switch (type) @@ -1012,6 +1216,18 @@ LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR_to_default(GLenum ty } } +LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR_to_R8G8B8A8_UNORM_SRGB(GLenum type) +{ + switch (type) + { + case GL_UNSIGNED_BYTE: + return LoadImageFunctionInfo(LoadASTCToRGBA8<10, 8>, true); + default: + UNREACHABLE(); + return LoadImageFunctionInfo(UnreachableLoadFunction, true); + } +} + LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR_to_default(GLenum type) { switch (type) @@ -1024,6 +1240,18 @@ LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR_to_default(GLenum ty } } +LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR_to_R8G8B8A8_UNORM_SRGB(GLenum type) +{ + switch (type) + { + case GL_UNSIGNED_BYTE: + return LoadImageFunctionInfo(LoadASTCToRGBA8<12, 10>, true); + default: + UNREACHABLE(); + return LoadImageFunctionInfo(UnreachableLoadFunction, true); + } +} + LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR_to_default(GLenum type) { switch (type) @@ -1036,6 +1264,18 @@ LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR_to_default(GLenum t } } +LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR_to_R8G8B8A8_UNORM_SRGB(GLenum type) +{ + switch (type) + { + case GL_UNSIGNED_BYTE: + return LoadImageFunctionInfo(LoadASTCToRGBA8<12, 12>, true); + default: + UNREACHABLE(); + return LoadImageFunctionInfo(UnreachableLoadFunction, true); + } +} + LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR_to_default(GLenum type) { switch (type) @@ -1072,6 +1312,18 @@ LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_4x3x3_OES_to_default(GLenum t } } +LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR_to_R8G8B8A8_UNORM_SRGB(GLenum type) +{ + switch (type) + { + case GL_UNSIGNED_BYTE: + return LoadImageFunctionInfo(LoadASTCToRGBA8<4, 4>, true); + default: + UNREACHABLE(); + return LoadImageFunctionInfo(UnreachableLoadFunction, true); + } +} + LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR_to_default(GLenum type) { switch (type) @@ -1108,6 +1360,18 @@ LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x4_OES_to_default(GLenum t } } +LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR_to_R8G8B8A8_UNORM_SRGB(GLenum type) +{ + switch (type) + { + case GL_UNSIGNED_BYTE: + return LoadImageFunctionInfo(LoadASTCToRGBA8<5, 4>, true); + default: + UNREACHABLE(); + return LoadImageFunctionInfo(UnreachableLoadFunction, true); + } +} + LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR_to_default(GLenum type) { switch (type) @@ -1132,6 +1396,18 @@ LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_5x4x4_OES_to_default(GLenum t } } +LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR_to_R8G8B8A8_UNORM_SRGB(GLenum type) +{ + switch (type) + { + case GL_UNSIGNED_BYTE: + return LoadImageFunctionInfo(LoadASTCToRGBA8<5, 5>, true); + default: + UNREACHABLE(); + return LoadImageFunctionInfo(UnreachableLoadFunction, true); + } +} + LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR_to_default(GLenum type) { switch (type) @@ -1168,6 +1444,18 @@ LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x5_OES_to_default(GLenum t } } +LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR_to_R8G8B8A8_UNORM_SRGB(GLenum type) +{ + switch (type) + { + case GL_UNSIGNED_BYTE: + return LoadImageFunctionInfo(LoadASTCToRGBA8<6, 5>, true); + default: + UNREACHABLE(); + return LoadImageFunctionInfo(UnreachableLoadFunction, true); + } +} + LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR_to_default(GLenum type) { switch (type) @@ -1192,6 +1480,18 @@ LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_6x5x5_OES_to_default(GLenum t } } +LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR_to_R8G8B8A8_UNORM_SRGB(GLenum type) +{ + switch (type) + { + case GL_UNSIGNED_BYTE: + return LoadImageFunctionInfo(LoadASTCToRGBA8<6, 6>, true); + default: + UNREACHABLE(); + return LoadImageFunctionInfo(UnreachableLoadFunction, true); + } +} + LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR_to_default(GLenum type) { switch (type) @@ -1228,6 +1528,18 @@ LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x6_OES_to_default(GLenum t } } +LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR_to_R8G8B8A8_UNORM_SRGB(GLenum type) +{ + switch (type) + { + case GL_UNSIGNED_BYTE: + return LoadImageFunctionInfo(LoadASTCToRGBA8<8, 5>, true); + default: + UNREACHABLE(); + return LoadImageFunctionInfo(UnreachableLoadFunction, true); + } +} + LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR_to_default(GLenum type) { switch (type) @@ -1240,6 +1552,18 @@ LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR_to_default(GLenum typ } } +LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR_to_R8G8B8A8_UNORM_SRGB(GLenum type) +{ + switch (type) + { + case GL_UNSIGNED_BYTE: + return LoadImageFunctionInfo(LoadASTCToRGBA8<8, 6>, true); + default: + UNREACHABLE(); + return LoadImageFunctionInfo(UnreachableLoadFunction, true); + } +} + LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR_to_default(GLenum type) { switch (type) @@ -1252,6 +1576,18 @@ LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR_to_default(GLenum typ } } +LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR_to_R8G8B8A8_UNORM_SRGB(GLenum type) +{ + switch (type) + { + case GL_UNSIGNED_BYTE: + return LoadImageFunctionInfo(LoadASTCToRGBA8<8, 8>, true); + default: + UNREACHABLE(); + return LoadImageFunctionInfo(UnreachableLoadFunction, true); + } +} + LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR_to_default(GLenum type) { switch (type) @@ -3463,53 +3799,165 @@ LoadFunctionMap GetLoadFunctionsMap(GLenum internalFormat, FormatID angleFormat) break; } case GL_COMPRESSED_RGBA_ASTC_10x10_KHR: - return COMPRESSED_RGBA_ASTC_10x10_KHR_to_default; + { + switch (angleFormat) + { + case FormatID::R8G8B8A8_UNORM: + return COMPRESSED_RGBA_ASTC_10x10_KHR_to_R8G8B8A8_UNORM; + default: + return COMPRESSED_RGBA_ASTC_10x10_KHR_to_default; + } + } case GL_COMPRESSED_RGBA_ASTC_10x5_KHR: - return COMPRESSED_RGBA_ASTC_10x5_KHR_to_default; + { + switch (angleFormat) + { + case FormatID::R8G8B8A8_UNORM: + return COMPRESSED_RGBA_ASTC_10x5_KHR_to_R8G8B8A8_UNORM; + default: + return COMPRESSED_RGBA_ASTC_10x5_KHR_to_default; + } + } case GL_COMPRESSED_RGBA_ASTC_10x6_KHR: - return COMPRESSED_RGBA_ASTC_10x6_KHR_to_default; + { + switch (angleFormat) + { + case FormatID::R8G8B8A8_UNORM: + return COMPRESSED_RGBA_ASTC_10x6_KHR_to_R8G8B8A8_UNORM; + default: + return COMPRESSED_RGBA_ASTC_10x6_KHR_to_default; + } + } case GL_COMPRESSED_RGBA_ASTC_10x8_KHR: - return COMPRESSED_RGBA_ASTC_10x8_KHR_to_default; + { + switch (angleFormat) + { + case FormatID::R8G8B8A8_UNORM: + return COMPRESSED_RGBA_ASTC_10x8_KHR_to_R8G8B8A8_UNORM; + default: + return COMPRESSED_RGBA_ASTC_10x8_KHR_to_default; + } + } case GL_COMPRESSED_RGBA_ASTC_12x10_KHR: - return COMPRESSED_RGBA_ASTC_12x10_KHR_to_default; + { + switch (angleFormat) + { + case FormatID::R8G8B8A8_UNORM: + return COMPRESSED_RGBA_ASTC_12x10_KHR_to_R8G8B8A8_UNORM; + default: + return COMPRESSED_RGBA_ASTC_12x10_KHR_to_default; + } + } case GL_COMPRESSED_RGBA_ASTC_12x12_KHR: - return COMPRESSED_RGBA_ASTC_12x12_KHR_to_default; + { + switch (angleFormat) + { + case FormatID::R8G8B8A8_UNORM: + return COMPRESSED_RGBA_ASTC_12x12_KHR_to_R8G8B8A8_UNORM; + default: + return COMPRESSED_RGBA_ASTC_12x12_KHR_to_default; + } + } case GL_COMPRESSED_RGBA_ASTC_3x3x3_OES: return COMPRESSED_RGBA_ASTC_3x3x3_OES_to_default; case GL_COMPRESSED_RGBA_ASTC_4x3x3_OES: return COMPRESSED_RGBA_ASTC_4x3x3_OES_to_default; case GL_COMPRESSED_RGBA_ASTC_4x4_KHR: - return COMPRESSED_RGBA_ASTC_4x4_KHR_to_default; + { + switch (angleFormat) + { + case FormatID::R8G8B8A8_UNORM: + return COMPRESSED_RGBA_ASTC_4x4_KHR_to_R8G8B8A8_UNORM; + default: + return COMPRESSED_RGBA_ASTC_4x4_KHR_to_default; + } + } case GL_COMPRESSED_RGBA_ASTC_4x4x3_OES: return COMPRESSED_RGBA_ASTC_4x4x3_OES_to_default; case GL_COMPRESSED_RGBA_ASTC_4x4x4_OES: return COMPRESSED_RGBA_ASTC_4x4x4_OES_to_default; case GL_COMPRESSED_RGBA_ASTC_5x4_KHR: - return COMPRESSED_RGBA_ASTC_5x4_KHR_to_default; + { + switch (angleFormat) + { + case FormatID::R8G8B8A8_UNORM: + return COMPRESSED_RGBA_ASTC_5x4_KHR_to_R8G8B8A8_UNORM; + default: + return COMPRESSED_RGBA_ASTC_5x4_KHR_to_default; + } + } case GL_COMPRESSED_RGBA_ASTC_5x4x4_OES: return COMPRESSED_RGBA_ASTC_5x4x4_OES_to_default; case GL_COMPRESSED_RGBA_ASTC_5x5_KHR: - return COMPRESSED_RGBA_ASTC_5x5_KHR_to_default; + { + switch (angleFormat) + { + case FormatID::R8G8B8A8_UNORM: + return COMPRESSED_RGBA_ASTC_5x5_KHR_to_R8G8B8A8_UNORM; + default: + return COMPRESSED_RGBA_ASTC_5x5_KHR_to_default; + } + } case GL_COMPRESSED_RGBA_ASTC_5x5x4_OES: return COMPRESSED_RGBA_ASTC_5x5x4_OES_to_default; case GL_COMPRESSED_RGBA_ASTC_5x5x5_OES: return COMPRESSED_RGBA_ASTC_5x5x5_OES_to_default; case GL_COMPRESSED_RGBA_ASTC_6x5_KHR: - return COMPRESSED_RGBA_ASTC_6x5_KHR_to_default; + { + switch (angleFormat) + { + case FormatID::R8G8B8A8_UNORM: + return COMPRESSED_RGBA_ASTC_6x5_KHR_to_R8G8B8A8_UNORM; + default: + return COMPRESSED_RGBA_ASTC_6x5_KHR_to_default; + } + } case GL_COMPRESSED_RGBA_ASTC_6x5x5_OES: return COMPRESSED_RGBA_ASTC_6x5x5_OES_to_default; case GL_COMPRESSED_RGBA_ASTC_6x6_KHR: - return COMPRESSED_RGBA_ASTC_6x6_KHR_to_default; + { + switch (angleFormat) + { + case FormatID::R8G8B8A8_UNORM: + return COMPRESSED_RGBA_ASTC_6x6_KHR_to_R8G8B8A8_UNORM; + default: + return COMPRESSED_RGBA_ASTC_6x6_KHR_to_default; + } + } case GL_COMPRESSED_RGBA_ASTC_6x6x5_OES: return COMPRESSED_RGBA_ASTC_6x6x5_OES_to_default; case GL_COMPRESSED_RGBA_ASTC_6x6x6_OES: return COMPRESSED_RGBA_ASTC_6x6x6_OES_to_default; case GL_COMPRESSED_RGBA_ASTC_8x5_KHR: - return COMPRESSED_RGBA_ASTC_8x5_KHR_to_default; + { + switch (angleFormat) + { + case FormatID::R8G8B8A8_UNORM: + return COMPRESSED_RGBA_ASTC_8x5_KHR_to_R8G8B8A8_UNORM; + default: + return COMPRESSED_RGBA_ASTC_8x5_KHR_to_default; + } + } case GL_COMPRESSED_RGBA_ASTC_8x6_KHR: - return COMPRESSED_RGBA_ASTC_8x6_KHR_to_default; + { + switch (angleFormat) + { + case FormatID::R8G8B8A8_UNORM: + return COMPRESSED_RGBA_ASTC_8x6_KHR_to_R8G8B8A8_UNORM; + default: + return COMPRESSED_RGBA_ASTC_8x6_KHR_to_default; + } + } case GL_COMPRESSED_RGBA_ASTC_8x8_KHR: - return COMPRESSED_RGBA_ASTC_8x8_KHR_to_default; + { + switch (angleFormat) + { + case FormatID::R8G8B8A8_UNORM: + return COMPRESSED_RGBA_ASTC_8x8_KHR_to_R8G8B8A8_UNORM; + default: + return COMPRESSED_RGBA_ASTC_8x8_KHR_to_default; + } + } case GL_COMPRESSED_RGBA_BPTC_UNORM_EXT: return COMPRESSED_RGBA_BPTC_UNORM_EXT_to_default; case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: @@ -3559,53 +4007,165 @@ LoadFunctionMap GetLoadFunctionsMap(GLenum internalFormat, FormatID angleFormat) break; } case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR: - return COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR_to_default; + { + switch (angleFormat) + { + case FormatID::R8G8B8A8_UNORM_SRGB: + return COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR_to_R8G8B8A8_UNORM_SRGB; + default: + return COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR_to_default; + } + } case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR: - return COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR_to_default; + { + switch (angleFormat) + { + case FormatID::R8G8B8A8_UNORM_SRGB: + return COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR_to_R8G8B8A8_UNORM_SRGB; + default: + return COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR_to_default; + } + } case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR: - return COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR_to_default; + { + switch (angleFormat) + { + case FormatID::R8G8B8A8_UNORM_SRGB: + return COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR_to_R8G8B8A8_UNORM_SRGB; + default: + return COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR_to_default; + } + } case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR: - return COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR_to_default; + { + switch (angleFormat) + { + case FormatID::R8G8B8A8_UNORM_SRGB: + return COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR_to_R8G8B8A8_UNORM_SRGB; + default: + return COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR_to_default; + } + } case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR: - return COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR_to_default; + { + switch (angleFormat) + { + case FormatID::R8G8B8A8_UNORM_SRGB: + return COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR_to_R8G8B8A8_UNORM_SRGB; + default: + return COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR_to_default; + } + } case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR: - return COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR_to_default; + { + switch (angleFormat) + { + case FormatID::R8G8B8A8_UNORM_SRGB: + return COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR_to_R8G8B8A8_UNORM_SRGB; + default: + return COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR_to_default; + } + } case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_3x3x3_OES: return COMPRESSED_SRGB8_ALPHA8_ASTC_3x3x3_OES_to_default; case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x3x3_OES: return COMPRESSED_SRGB8_ALPHA8_ASTC_4x3x3_OES_to_default; case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR: - return COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR_to_default; + { + switch (angleFormat) + { + case FormatID::R8G8B8A8_UNORM_SRGB: + return COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR_to_R8G8B8A8_UNORM_SRGB; + default: + return COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR_to_default; + } + } case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x3_OES: return COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x3_OES_to_default; case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x4_OES: return COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x4_OES_to_default; case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR: - return COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR_to_default; + { + switch (angleFormat) + { + case FormatID::R8G8B8A8_UNORM_SRGB: + return COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR_to_R8G8B8A8_UNORM_SRGB; + default: + return COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR_to_default; + } + } case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4x4_OES: return COMPRESSED_SRGB8_ALPHA8_ASTC_5x4x4_OES_to_default; case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR: - return COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR_to_default; + { + switch (angleFormat) + { + case FormatID::R8G8B8A8_UNORM_SRGB: + return COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR_to_R8G8B8A8_UNORM_SRGB; + default: + return COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR_to_default; + } + } case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x4_OES: return COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x4_OES_to_default; case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x5_OES: return COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x5_OES_to_default; case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR: - return COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR_to_default; + { + switch (angleFormat) + { + case FormatID::R8G8B8A8_UNORM_SRGB: + return COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR_to_R8G8B8A8_UNORM_SRGB; + default: + return COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR_to_default; + } + } case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5x5_OES: return COMPRESSED_SRGB8_ALPHA8_ASTC_6x5x5_OES_to_default; case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR: - return COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR_to_default; + { + switch (angleFormat) + { + case FormatID::R8G8B8A8_UNORM_SRGB: + return COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR_to_R8G8B8A8_UNORM_SRGB; + default: + return COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR_to_default; + } + } case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x5_OES: return COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x5_OES_to_default; case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x6_OES: return COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x6_OES_to_default; case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR: - return COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR_to_default; + { + switch (angleFormat) + { + case FormatID::R8G8B8A8_UNORM_SRGB: + return COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR_to_R8G8B8A8_UNORM_SRGB; + default: + return COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR_to_default; + } + } case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR: - return COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR_to_default; + { + switch (angleFormat) + { + case FormatID::R8G8B8A8_UNORM_SRGB: + return COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR_to_R8G8B8A8_UNORM_SRGB; + default: + return COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR_to_default; + } + } case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR: - return COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR_to_default; + { + switch (angleFormat) + { + case FormatID::R8G8B8A8_UNORM_SRGB: + return COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR_to_R8G8B8A8_UNORM_SRGB; + default: + return COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR_to_default; + } + } case GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: { switch (angleFormat) diff --git a/src/libANGLE/renderer/vulkan/vk_caps_utils.cpp b/src/libANGLE/renderer/vulkan/vk_caps_utils.cpp index 92007f96d..742a5bff9 100644 --- a/src/libANGLE/renderer/vulkan/vk_caps_utils.cpp +++ b/src/libANGLE/renderer/vulkan/vk_caps_utils.cpp @@ -310,6 +310,13 @@ void RendererVk::ensureCapsInitialized() const mNativeLimitations.emulatedEtc1 = true; } + // When ASTC formats are not natively supported + // mark potentially-available ASTC extension as emulated. + if (mPhysicalDeviceFeatures.textureCompressionASTC_LDR == VK_FALSE) + { + mNativeLimitations.emulatedAstc = true; + } + // Vulkan doesn't support ASTC 3D block textures, which are required by // GL_OES_texture_compression_astc. mNativeExtensions.textureCompressionAstcOES = false; diff --git a/src/libANGLE/renderer/vulkan/vk_format_map.json b/src/libANGLE/renderer/vulkan/vk_format_map.json index 374de96b8..0fe112289 100644 --- a/src/libANGLE/renderer/vulkan/vk_format_map.json +++ b/src/libANGLE/renderer/vulkan/vk_format_map.json @@ -504,6 +504,91 @@ }, "R10G10B10A2_SINT": { "buffer": "R16G16B16A16_SINT" + }, + "ASTC_4x4_UNORM_BLOCK": { + "image": "R8G8B8A8_UNORM" + }, + "ASTC_5x4_UNORM_BLOCK": { + "image": "R8G8B8A8_UNORM" + }, + "ASTC_5x5_UNORM_BLOCK": { + "image": "R8G8B8A8_UNORM" + }, + "ASTC_6x5_UNORM_BLOCK": { + "image": "R8G8B8A8_UNORM" + }, + "ASTC_6x6_UNORM_BLOCK": { + "image": "R8G8B8A8_UNORM" + }, + "ASTC_8x5_UNORM_BLOCK": { + "image": "R8G8B8A8_UNORM" + }, + "ASTC_8x6_UNORM_BLOCK": { + "image": "R8G8B8A8_UNORM" + }, + "ASTC_8x8_UNORM_BLOCK": { + "image": "R8G8B8A8_UNORM" + }, + "ASTC_10x5_UNORM_BLOCK": { + "image": "R8G8B8A8_UNORM" + }, + "ASTC_10x6_UNORM_BLOCK": { + "image": "R8G8B8A8_UNORM" + }, + "ASTC_10x8_UNORM_BLOCK": { + "image": "R8G8B8A8_UNORM" + }, + "ASTC_10x10_UNORM_BLOCK": { + "image": "R8G8B8A8_UNORM" + }, + "ASTC_12x10_UNORM_BLOCK": { + "image": "R8G8B8A8_UNORM" + }, + "ASTC_12x12_UNORM_BLOCK": { + "image": "R8G8B8A8_UNORM" + }, + + "ASTC_4x4_SRGB_BLOCK": { + "image": "R8G8B8A8_UNORM_SRGB" + }, + "ASTC_5x4_SRGB_BLOCK": { + "image": "R8G8B8A8_UNORM_SRGB" + }, + "ASTC_5x5_SRGB_BLOCK": { + "image": "R8G8B8A8_UNORM_SRGB" + }, + "ASTC_6x5_SRGB_BLOCK": { + "image": "R8G8B8A8_UNORM_SRGB" + }, + "ASTC_6x6_SRGB_BLOCK": { + "image": "R8G8B8A8_UNORM_SRGB" + }, + "ASTC_8x5_SRGB_BLOCK": { + "image": "R8G8B8A8_UNORM_SRGB" + }, + "ASTC_8x6_SRGB_BLOCK": { + "image": "R8G8B8A8_UNORM_SRGB" + }, + "ASTC_8x8_SRGB_BLOCK": { + "image": "R8G8B8A8_UNORM_SRGB" + }, + "ASTC_10x5_SRGB_BLOCK": { + "image": "R8G8B8A8_UNORM_SRGB" + }, + "ASTC_10x6_SRGB_BLOCK": { + "image": "R8G8B8A8_UNORM_SRGB" + }, + "ASTC_10x8_SRGB_BLOCK": { + "image": "R8G8B8A8_UNORM_SRGB" + }, + "ASTC_10x10_SRGB_BLOCK": { + "image": "R8G8B8A8_UNORM_SRGB" + }, + "ASTC_12x10_SRGB_BLOCK": { + "image": "R8G8B8A8_UNORM_SRGB" + }, + "ASTC_12x12_SRGB_BLOCK": { + "image": "R8G8B8A8_UNORM_SRGB" } } } diff --git a/src/libANGLE/renderer/vulkan/vk_format_table_autogen.cpp b/src/libANGLE/renderer/vulkan/vk_format_table_autogen.cpp index a0dc294ec..43dba3467 100644 --- a/src/libANGLE/renderer/vulkan/vk_format_table_autogen.cpp +++ b/src/libANGLE/renderer/vulkan/vk_format_table_autogen.cpp @@ -115,123 +115,171 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) break; case angle::FormatID::ASTC_10x10_SRGB_BLOCK: - mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR; - mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_10x10_SRGB_BLOCK; - mImageInitializerFunction = nullptr; - mActualBufferFormatID = angle::FormatID::ASTC_10x10_SRGB_BLOCK; - mVkBufferFormatIsPacked = false; - mVertexLoadFunction = nullptr; - mVertexLoadRequiresConversion = false; + mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR; + { + static constexpr ImageFormatInitInfo kInfo[] = { + {angle::FormatID::ASTC_10x10_SRGB_BLOCK, nullptr}, + {angle::FormatID::R8G8B8A8_UNORM_SRGB, nullptr}}; + initImageFallback(renderer, kInfo, ArraySize(kInfo)); + } + mActualBufferFormatID = angle::FormatID::ASTC_10x10_SRGB_BLOCK; + mVkBufferFormatIsPacked = false; + mVertexLoadFunction = nullptr; + mVertexLoadRequiresConversion = false; break; case angle::FormatID::ASTC_10x10_UNORM_BLOCK: - mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_10x10_KHR; - mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_10x10_UNORM_BLOCK; - mImageInitializerFunction = nullptr; - mActualBufferFormatID = angle::FormatID::ASTC_10x10_UNORM_BLOCK; - mVkBufferFormatIsPacked = false; - mVertexLoadFunction = nullptr; - mVertexLoadRequiresConversion = false; + mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_10x10_KHR; + { + static constexpr ImageFormatInitInfo kInfo[] = { + {angle::FormatID::ASTC_10x10_UNORM_BLOCK, nullptr}, + {angle::FormatID::R8G8B8A8_UNORM, nullptr}}; + initImageFallback(renderer, kInfo, ArraySize(kInfo)); + } + mActualBufferFormatID = angle::FormatID::ASTC_10x10_UNORM_BLOCK; + mVkBufferFormatIsPacked = false; + mVertexLoadFunction = nullptr; + mVertexLoadRequiresConversion = false; break; case angle::FormatID::ASTC_10x5_SRGB_BLOCK: - mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR; - mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_10x5_SRGB_BLOCK; - mImageInitializerFunction = nullptr; - mActualBufferFormatID = angle::FormatID::ASTC_10x5_SRGB_BLOCK; - mVkBufferFormatIsPacked = false; - mVertexLoadFunction = nullptr; - mVertexLoadRequiresConversion = false; + mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR; + { + static constexpr ImageFormatInitInfo kInfo[] = { + {angle::FormatID::ASTC_10x5_SRGB_BLOCK, nullptr}, + {angle::FormatID::R8G8B8A8_UNORM_SRGB, nullptr}}; + initImageFallback(renderer, kInfo, ArraySize(kInfo)); + } + mActualBufferFormatID = angle::FormatID::ASTC_10x5_SRGB_BLOCK; + mVkBufferFormatIsPacked = false; + mVertexLoadFunction = nullptr; + mVertexLoadRequiresConversion = false; break; case angle::FormatID::ASTC_10x5_UNORM_BLOCK: - mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_10x5_KHR; - mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_10x5_UNORM_BLOCK; - mImageInitializerFunction = nullptr; - mActualBufferFormatID = angle::FormatID::ASTC_10x5_UNORM_BLOCK; - mVkBufferFormatIsPacked = false; - mVertexLoadFunction = nullptr; - mVertexLoadRequiresConversion = false; + mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_10x5_KHR; + { + static constexpr ImageFormatInitInfo kInfo[] = { + {angle::FormatID::ASTC_10x5_UNORM_BLOCK, nullptr}, + {angle::FormatID::R8G8B8A8_UNORM, nullptr}}; + initImageFallback(renderer, kInfo, ArraySize(kInfo)); + } + mActualBufferFormatID = angle::FormatID::ASTC_10x5_UNORM_BLOCK; + mVkBufferFormatIsPacked = false; + mVertexLoadFunction = nullptr; + mVertexLoadRequiresConversion = false; break; case angle::FormatID::ASTC_10x6_SRGB_BLOCK: - mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR; - mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_10x6_SRGB_BLOCK; - mImageInitializerFunction = nullptr; - mActualBufferFormatID = angle::FormatID::ASTC_10x6_SRGB_BLOCK; - mVkBufferFormatIsPacked = false; - mVertexLoadFunction = nullptr; - mVertexLoadRequiresConversion = false; + mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR; + { + static constexpr ImageFormatInitInfo kInfo[] = { + {angle::FormatID::ASTC_10x6_SRGB_BLOCK, nullptr}, + {angle::FormatID::R8G8B8A8_UNORM_SRGB, nullptr}}; + initImageFallback(renderer, kInfo, ArraySize(kInfo)); + } + mActualBufferFormatID = angle::FormatID::ASTC_10x6_SRGB_BLOCK; + mVkBufferFormatIsPacked = false; + mVertexLoadFunction = nullptr; + mVertexLoadRequiresConversion = false; break; case angle::FormatID::ASTC_10x6_UNORM_BLOCK: - mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_10x6_KHR; - mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_10x6_UNORM_BLOCK; - mImageInitializerFunction = nullptr; - mActualBufferFormatID = angle::FormatID::ASTC_10x6_UNORM_BLOCK; - mVkBufferFormatIsPacked = false; - mVertexLoadFunction = nullptr; - mVertexLoadRequiresConversion = false; + mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_10x6_KHR; + { + static constexpr ImageFormatInitInfo kInfo[] = { + {angle::FormatID::ASTC_10x6_UNORM_BLOCK, nullptr}, + {angle::FormatID::R8G8B8A8_UNORM, nullptr}}; + initImageFallback(renderer, kInfo, ArraySize(kInfo)); + } + mActualBufferFormatID = angle::FormatID::ASTC_10x6_UNORM_BLOCK; + mVkBufferFormatIsPacked = false; + mVertexLoadFunction = nullptr; + mVertexLoadRequiresConversion = false; break; case angle::FormatID::ASTC_10x8_SRGB_BLOCK: - mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR; - mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_10x8_SRGB_BLOCK; - mImageInitializerFunction = nullptr; - mActualBufferFormatID = angle::FormatID::ASTC_10x8_SRGB_BLOCK; - mVkBufferFormatIsPacked = false; - mVertexLoadFunction = nullptr; - mVertexLoadRequiresConversion = false; + mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR; + { + static constexpr ImageFormatInitInfo kInfo[] = { + {angle::FormatID::ASTC_10x8_SRGB_BLOCK, nullptr}, + {angle::FormatID::R8G8B8A8_UNORM_SRGB, nullptr}}; + initImageFallback(renderer, kInfo, ArraySize(kInfo)); + } + mActualBufferFormatID = angle::FormatID::ASTC_10x8_SRGB_BLOCK; + mVkBufferFormatIsPacked = false; + mVertexLoadFunction = nullptr; + mVertexLoadRequiresConversion = false; break; case angle::FormatID::ASTC_10x8_UNORM_BLOCK: - mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_10x8_KHR; - mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_10x8_UNORM_BLOCK; - mImageInitializerFunction = nullptr; - mActualBufferFormatID = angle::FormatID::ASTC_10x8_UNORM_BLOCK; - mVkBufferFormatIsPacked = false; - mVertexLoadFunction = nullptr; - mVertexLoadRequiresConversion = false; + mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_10x8_KHR; + { + static constexpr ImageFormatInitInfo kInfo[] = { + {angle::FormatID::ASTC_10x8_UNORM_BLOCK, nullptr}, + {angle::FormatID::R8G8B8A8_UNORM, nullptr}}; + initImageFallback(renderer, kInfo, ArraySize(kInfo)); + } + mActualBufferFormatID = angle::FormatID::ASTC_10x8_UNORM_BLOCK; + mVkBufferFormatIsPacked = false; + mVertexLoadFunction = nullptr; + mVertexLoadRequiresConversion = false; break; case angle::FormatID::ASTC_12x10_SRGB_BLOCK: - mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR; - mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_12x10_SRGB_BLOCK; - mImageInitializerFunction = nullptr; - mActualBufferFormatID = angle::FormatID::ASTC_12x10_SRGB_BLOCK; - mVkBufferFormatIsPacked = false; - mVertexLoadFunction = nullptr; - mVertexLoadRequiresConversion = false; + mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR; + { + static constexpr ImageFormatInitInfo kInfo[] = { + {angle::FormatID::ASTC_12x10_SRGB_BLOCK, nullptr}, + {angle::FormatID::R8G8B8A8_UNORM_SRGB, nullptr}}; + initImageFallback(renderer, kInfo, ArraySize(kInfo)); + } + mActualBufferFormatID = angle::FormatID::ASTC_12x10_SRGB_BLOCK; + mVkBufferFormatIsPacked = false; + mVertexLoadFunction = nullptr; + mVertexLoadRequiresConversion = false; break; case angle::FormatID::ASTC_12x10_UNORM_BLOCK: - mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_12x10_KHR; - mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_12x10_UNORM_BLOCK; - mImageInitializerFunction = nullptr; - mActualBufferFormatID = angle::FormatID::ASTC_12x10_UNORM_BLOCK; - mVkBufferFormatIsPacked = false; - mVertexLoadFunction = nullptr; - mVertexLoadRequiresConversion = false; + mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_12x10_KHR; + { + static constexpr ImageFormatInitInfo kInfo[] = { + {angle::FormatID::ASTC_12x10_UNORM_BLOCK, nullptr}, + {angle::FormatID::R8G8B8A8_UNORM, nullptr}}; + initImageFallback(renderer, kInfo, ArraySize(kInfo)); + } + mActualBufferFormatID = angle::FormatID::ASTC_12x10_UNORM_BLOCK; + mVkBufferFormatIsPacked = false; + mVertexLoadFunction = nullptr; + mVertexLoadRequiresConversion = false; break; case angle::FormatID::ASTC_12x12_SRGB_BLOCK: - mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR; - mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_12x12_SRGB_BLOCK; - mImageInitializerFunction = nullptr; - mActualBufferFormatID = angle::FormatID::ASTC_12x12_SRGB_BLOCK; - mVkBufferFormatIsPacked = false; - mVertexLoadFunction = nullptr; - mVertexLoadRequiresConversion = false; + mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR; + { + static constexpr ImageFormatInitInfo kInfo[] = { + {angle::FormatID::ASTC_12x12_SRGB_BLOCK, nullptr}, + {angle::FormatID::R8G8B8A8_UNORM_SRGB, nullptr}}; + initImageFallback(renderer, kInfo, ArraySize(kInfo)); + } + mActualBufferFormatID = angle::FormatID::ASTC_12x12_SRGB_BLOCK; + mVkBufferFormatIsPacked = false; + mVertexLoadFunction = nullptr; + mVertexLoadRequiresConversion = false; break; case angle::FormatID::ASTC_12x12_UNORM_BLOCK: - mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_12x12_KHR; - mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_12x12_UNORM_BLOCK; - mImageInitializerFunction = nullptr; - mActualBufferFormatID = angle::FormatID::ASTC_12x12_UNORM_BLOCK; - mVkBufferFormatIsPacked = false; - mVertexLoadFunction = nullptr; - mVertexLoadRequiresConversion = false; + mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_12x12_KHR; + { + static constexpr ImageFormatInitInfo kInfo[] = { + {angle::FormatID::ASTC_12x12_UNORM_BLOCK, nullptr}, + {angle::FormatID::R8G8B8A8_UNORM, nullptr}}; + initImageFallback(renderer, kInfo, ArraySize(kInfo)); + } + mActualBufferFormatID = angle::FormatID::ASTC_12x12_UNORM_BLOCK; + mVkBufferFormatIsPacked = false; + mVertexLoadFunction = nullptr; + mVertexLoadRequiresConversion = false; break; case angle::FormatID::ASTC_3x3x3_UNORM_BLOCK: @@ -251,23 +299,31 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) break; case angle::FormatID::ASTC_4x4_SRGB_BLOCK: - mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR; - mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_4x4_SRGB_BLOCK; - mImageInitializerFunction = nullptr; - mActualBufferFormatID = angle::FormatID::ASTC_4x4_SRGB_BLOCK; - mVkBufferFormatIsPacked = false; - mVertexLoadFunction = nullptr; - mVertexLoadRequiresConversion = false; + mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR; + { + static constexpr ImageFormatInitInfo kInfo[] = { + {angle::FormatID::ASTC_4x4_SRGB_BLOCK, nullptr}, + {angle::FormatID::R8G8B8A8_UNORM_SRGB, nullptr}}; + initImageFallback(renderer, kInfo, ArraySize(kInfo)); + } + mActualBufferFormatID = angle::FormatID::ASTC_4x4_SRGB_BLOCK; + mVkBufferFormatIsPacked = false; + mVertexLoadFunction = nullptr; + mVertexLoadRequiresConversion = false; break; case angle::FormatID::ASTC_4x4_UNORM_BLOCK: - mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_4x4_KHR; - mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_4x4_UNORM_BLOCK; - mImageInitializerFunction = nullptr; - mActualBufferFormatID = angle::FormatID::ASTC_4x4_UNORM_BLOCK; - mVkBufferFormatIsPacked = false; - mVertexLoadFunction = nullptr; - mVertexLoadRequiresConversion = false; + mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_4x4_KHR; + { + static constexpr ImageFormatInitInfo kInfo[] = { + {angle::FormatID::ASTC_4x4_UNORM_BLOCK, nullptr}, + {angle::FormatID::R8G8B8A8_UNORM, nullptr}}; + initImageFallback(renderer, kInfo, ArraySize(kInfo)); + } + mActualBufferFormatID = angle::FormatID::ASTC_4x4_UNORM_BLOCK; + mVkBufferFormatIsPacked = false; + mVertexLoadFunction = nullptr; + mVertexLoadRequiresConversion = false; break; case angle::FormatID::ASTC_4x4x3_UNORM_BLOCK: @@ -287,23 +343,31 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) break; case angle::FormatID::ASTC_5x4_SRGB_BLOCK: - mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR; - mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_5x4_SRGB_BLOCK; - mImageInitializerFunction = nullptr; - mActualBufferFormatID = angle::FormatID::ASTC_5x4_SRGB_BLOCK; - mVkBufferFormatIsPacked = false; - mVertexLoadFunction = nullptr; - mVertexLoadRequiresConversion = false; + mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR; + { + static constexpr ImageFormatInitInfo kInfo[] = { + {angle::FormatID::ASTC_5x4_SRGB_BLOCK, nullptr}, + {angle::FormatID::R8G8B8A8_UNORM_SRGB, nullptr}}; + initImageFallback(renderer, kInfo, ArraySize(kInfo)); + } + mActualBufferFormatID = angle::FormatID::ASTC_5x4_SRGB_BLOCK; + mVkBufferFormatIsPacked = false; + mVertexLoadFunction = nullptr; + mVertexLoadRequiresConversion = false; break; case angle::FormatID::ASTC_5x4_UNORM_BLOCK: - mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_5x4_KHR; - mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_5x4_UNORM_BLOCK; - mImageInitializerFunction = nullptr; - mActualBufferFormatID = angle::FormatID::ASTC_5x4_UNORM_BLOCK; - mVkBufferFormatIsPacked = false; - mVertexLoadFunction = nullptr; - mVertexLoadRequiresConversion = false; + mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_5x4_KHR; + { + static constexpr ImageFormatInitInfo kInfo[] = { + {angle::FormatID::ASTC_5x4_UNORM_BLOCK, nullptr}, + {angle::FormatID::R8G8B8A8_UNORM, nullptr}}; + initImageFallback(renderer, kInfo, ArraySize(kInfo)); + } + mActualBufferFormatID = angle::FormatID::ASTC_5x4_UNORM_BLOCK; + mVkBufferFormatIsPacked = false; + mVertexLoadFunction = nullptr; + mVertexLoadRequiresConversion = false; break; case angle::FormatID::ASTC_5x4x4_UNORM_BLOCK: @@ -315,23 +379,31 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) break; case angle::FormatID::ASTC_5x5_SRGB_BLOCK: - mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR; - mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_5x5_SRGB_BLOCK; - mImageInitializerFunction = nullptr; - mActualBufferFormatID = angle::FormatID::ASTC_5x5_SRGB_BLOCK; - mVkBufferFormatIsPacked = false; - mVertexLoadFunction = nullptr; - mVertexLoadRequiresConversion = false; + mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR; + { + static constexpr ImageFormatInitInfo kInfo[] = { + {angle::FormatID::ASTC_5x5_SRGB_BLOCK, nullptr}, + {angle::FormatID::R8G8B8A8_UNORM_SRGB, nullptr}}; + initImageFallback(renderer, kInfo, ArraySize(kInfo)); + } + mActualBufferFormatID = angle::FormatID::ASTC_5x5_SRGB_BLOCK; + mVkBufferFormatIsPacked = false; + mVertexLoadFunction = nullptr; + mVertexLoadRequiresConversion = false; break; case angle::FormatID::ASTC_5x5_UNORM_BLOCK: - mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_5x5_KHR; - mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_5x5_UNORM_BLOCK; - mImageInitializerFunction = nullptr; - mActualBufferFormatID = angle::FormatID::ASTC_5x5_UNORM_BLOCK; - mVkBufferFormatIsPacked = false; - mVertexLoadFunction = nullptr; - mVertexLoadRequiresConversion = false; + mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_5x5_KHR; + { + static constexpr ImageFormatInitInfo kInfo[] = { + {angle::FormatID::ASTC_5x5_UNORM_BLOCK, nullptr}, + {angle::FormatID::R8G8B8A8_UNORM, nullptr}}; + initImageFallback(renderer, kInfo, ArraySize(kInfo)); + } + mActualBufferFormatID = angle::FormatID::ASTC_5x5_UNORM_BLOCK; + mVkBufferFormatIsPacked = false; + mVertexLoadFunction = nullptr; + mVertexLoadRequiresConversion = false; break; case angle::FormatID::ASTC_5x5x4_UNORM_BLOCK: @@ -351,23 +423,31 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) break; case angle::FormatID::ASTC_6x5_SRGB_BLOCK: - mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR; - mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_6x5_SRGB_BLOCK; - mImageInitializerFunction = nullptr; - mActualBufferFormatID = angle::FormatID::ASTC_6x5_SRGB_BLOCK; - mVkBufferFormatIsPacked = false; - mVertexLoadFunction = nullptr; - mVertexLoadRequiresConversion = false; + mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR; + { + static constexpr ImageFormatInitInfo kInfo[] = { + {angle::FormatID::ASTC_6x5_SRGB_BLOCK, nullptr}, + {angle::FormatID::R8G8B8A8_UNORM_SRGB, nullptr}}; + initImageFallback(renderer, kInfo, ArraySize(kInfo)); + } + mActualBufferFormatID = angle::FormatID::ASTC_6x5_SRGB_BLOCK; + mVkBufferFormatIsPacked = false; + mVertexLoadFunction = nullptr; + mVertexLoadRequiresConversion = false; break; case angle::FormatID::ASTC_6x5_UNORM_BLOCK: - mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_6x5_KHR; - mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_6x5_UNORM_BLOCK; - mImageInitializerFunction = nullptr; - mActualBufferFormatID = angle::FormatID::ASTC_6x5_UNORM_BLOCK; - mVkBufferFormatIsPacked = false; - mVertexLoadFunction = nullptr; - mVertexLoadRequiresConversion = false; + mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_6x5_KHR; + { + static constexpr ImageFormatInitInfo kInfo[] = { + {angle::FormatID::ASTC_6x5_UNORM_BLOCK, nullptr}, + {angle::FormatID::R8G8B8A8_UNORM, nullptr}}; + initImageFallback(renderer, kInfo, ArraySize(kInfo)); + } + mActualBufferFormatID = angle::FormatID::ASTC_6x5_UNORM_BLOCK; + mVkBufferFormatIsPacked = false; + mVertexLoadFunction = nullptr; + mVertexLoadRequiresConversion = false; break; case angle::FormatID::ASTC_6x5x5_UNORM_BLOCK: @@ -379,23 +459,31 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) break; case angle::FormatID::ASTC_6x6_SRGB_BLOCK: - mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR; - mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_6x6_SRGB_BLOCK; - mImageInitializerFunction = nullptr; - mActualBufferFormatID = angle::FormatID::ASTC_6x6_SRGB_BLOCK; - mVkBufferFormatIsPacked = false; - mVertexLoadFunction = nullptr; - mVertexLoadRequiresConversion = false; + mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR; + { + static constexpr ImageFormatInitInfo kInfo[] = { + {angle::FormatID::ASTC_6x6_SRGB_BLOCK, nullptr}, + {angle::FormatID::R8G8B8A8_UNORM_SRGB, nullptr}}; + initImageFallback(renderer, kInfo, ArraySize(kInfo)); + } + mActualBufferFormatID = angle::FormatID::ASTC_6x6_SRGB_BLOCK; + mVkBufferFormatIsPacked = false; + mVertexLoadFunction = nullptr; + mVertexLoadRequiresConversion = false; break; case angle::FormatID::ASTC_6x6_UNORM_BLOCK: - mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_6x6_KHR; - mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_6x6_UNORM_BLOCK; - mImageInitializerFunction = nullptr; - mActualBufferFormatID = angle::FormatID::ASTC_6x6_UNORM_BLOCK; - mVkBufferFormatIsPacked = false; - mVertexLoadFunction = nullptr; - mVertexLoadRequiresConversion = false; + mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_6x6_KHR; + { + static constexpr ImageFormatInitInfo kInfo[] = { + {angle::FormatID::ASTC_6x6_UNORM_BLOCK, nullptr}, + {angle::FormatID::R8G8B8A8_UNORM, nullptr}}; + initImageFallback(renderer, kInfo, ArraySize(kInfo)); + } + mActualBufferFormatID = angle::FormatID::ASTC_6x6_UNORM_BLOCK; + mVkBufferFormatIsPacked = false; + mVertexLoadFunction = nullptr; + mVertexLoadRequiresConversion = false; break; case angle::FormatID::ASTC_6x6x5_UNORM_BLOCK: @@ -415,63 +503,87 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) break; case angle::FormatID::ASTC_8x5_SRGB_BLOCK: - mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR; - mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_8x5_SRGB_BLOCK; - mImageInitializerFunction = nullptr; - mActualBufferFormatID = angle::FormatID::ASTC_8x5_SRGB_BLOCK; - mVkBufferFormatIsPacked = false; - mVertexLoadFunction = nullptr; - mVertexLoadRequiresConversion = false; + mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR; + { + static constexpr ImageFormatInitInfo kInfo[] = { + {angle::FormatID::ASTC_8x5_SRGB_BLOCK, nullptr}, + {angle::FormatID::R8G8B8A8_UNORM_SRGB, nullptr}}; + initImageFallback(renderer, kInfo, ArraySize(kInfo)); + } + mActualBufferFormatID = angle::FormatID::ASTC_8x5_SRGB_BLOCK; + mVkBufferFormatIsPacked = false; + mVertexLoadFunction = nullptr; + mVertexLoadRequiresConversion = false; break; case angle::FormatID::ASTC_8x5_UNORM_BLOCK: - mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_8x5_KHR; - mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_8x5_UNORM_BLOCK; - mImageInitializerFunction = nullptr; - mActualBufferFormatID = angle::FormatID::ASTC_8x5_UNORM_BLOCK; - mVkBufferFormatIsPacked = false; - mVertexLoadFunction = nullptr; - mVertexLoadRequiresConversion = false; + mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_8x5_KHR; + { + static constexpr ImageFormatInitInfo kInfo[] = { + {angle::FormatID::ASTC_8x5_UNORM_BLOCK, nullptr}, + {angle::FormatID::R8G8B8A8_UNORM, nullptr}}; + initImageFallback(renderer, kInfo, ArraySize(kInfo)); + } + mActualBufferFormatID = angle::FormatID::ASTC_8x5_UNORM_BLOCK; + mVkBufferFormatIsPacked = false; + mVertexLoadFunction = nullptr; + mVertexLoadRequiresConversion = false; break; case angle::FormatID::ASTC_8x6_SRGB_BLOCK: - mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR; - mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_8x6_SRGB_BLOCK; - mImageInitializerFunction = nullptr; - mActualBufferFormatID = angle::FormatID::ASTC_8x6_SRGB_BLOCK; - mVkBufferFormatIsPacked = false; - mVertexLoadFunction = nullptr; - mVertexLoadRequiresConversion = false; + mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR; + { + static constexpr ImageFormatInitInfo kInfo[] = { + {angle::FormatID::ASTC_8x6_SRGB_BLOCK, nullptr}, + {angle::FormatID::R8G8B8A8_UNORM_SRGB, nullptr}}; + initImageFallback(renderer, kInfo, ArraySize(kInfo)); + } + mActualBufferFormatID = angle::FormatID::ASTC_8x6_SRGB_BLOCK; + mVkBufferFormatIsPacked = false; + mVertexLoadFunction = nullptr; + mVertexLoadRequiresConversion = false; break; case angle::FormatID::ASTC_8x6_UNORM_BLOCK: - mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_8x6_KHR; - mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_8x6_UNORM_BLOCK; - mImageInitializerFunction = nullptr; - mActualBufferFormatID = angle::FormatID::ASTC_8x6_UNORM_BLOCK; - mVkBufferFormatIsPacked = false; - mVertexLoadFunction = nullptr; - mVertexLoadRequiresConversion = false; + mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_8x6_KHR; + { + static constexpr ImageFormatInitInfo kInfo[] = { + {angle::FormatID::ASTC_8x6_UNORM_BLOCK, nullptr}, + {angle::FormatID::R8G8B8A8_UNORM, nullptr}}; + initImageFallback(renderer, kInfo, ArraySize(kInfo)); + } + mActualBufferFormatID = angle::FormatID::ASTC_8x6_UNORM_BLOCK; + mVkBufferFormatIsPacked = false; + mVertexLoadFunction = nullptr; + mVertexLoadRequiresConversion = false; break; case angle::FormatID::ASTC_8x8_SRGB_BLOCK: - mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR; - mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_8x8_SRGB_BLOCK; - mImageInitializerFunction = nullptr; - mActualBufferFormatID = angle::FormatID::ASTC_8x8_SRGB_BLOCK; - mVkBufferFormatIsPacked = false; - mVertexLoadFunction = nullptr; - mVertexLoadRequiresConversion = false; + mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR; + { + static constexpr ImageFormatInitInfo kInfo[] = { + {angle::FormatID::ASTC_8x8_SRGB_BLOCK, nullptr}, + {angle::FormatID::R8G8B8A8_UNORM_SRGB, nullptr}}; + initImageFallback(renderer, kInfo, ArraySize(kInfo)); + } + mActualBufferFormatID = angle::FormatID::ASTC_8x8_SRGB_BLOCK; + mVkBufferFormatIsPacked = false; + mVertexLoadFunction = nullptr; + mVertexLoadRequiresConversion = false; break; case angle::FormatID::ASTC_8x8_UNORM_BLOCK: - mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_8x8_KHR; - mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_8x8_UNORM_BLOCK; - mImageInitializerFunction = nullptr; - mActualBufferFormatID = angle::FormatID::ASTC_8x8_UNORM_BLOCK; - mVkBufferFormatIsPacked = false; - mVertexLoadFunction = nullptr; - mVertexLoadRequiresConversion = false; + mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_8x8_KHR; + { + static constexpr ImageFormatInitInfo kInfo[] = { + {angle::FormatID::ASTC_8x8_UNORM_BLOCK, nullptr}, + {angle::FormatID::R8G8B8A8_UNORM, nullptr}}; + initImageFallback(renderer, kInfo, ArraySize(kInfo)); + } + mActualBufferFormatID = angle::FormatID::ASTC_8x8_UNORM_BLOCK; + mVkBufferFormatIsPacked = false; + mVertexLoadFunction = nullptr; + mVertexLoadRequiresConversion = false; break; case angle::FormatID::B10G10R10A2_UNORM: diff --git a/src/libANGLE/renderer/vulkan/vk_helpers.cpp b/src/libANGLE/renderer/vulkan/vk_helpers.cpp index 25d134d68..e20f6a288 100644 --- a/src/libANGLE/renderer/vulkan/vk_helpers.cpp +++ b/src/libANGLE/renderer/vulkan/vk_helpers.cpp @@ -7633,6 +7633,13 @@ void ImageHelper::stageClearIfEmulatedFormat(bool isRobustResourceInitEnabled, b // For external images, we cannot clear the image entirely, as it may contain data in the // non-emulated channels. For depth/stencil images, clear is already per aspect, but for color // images we would need to take a special path where we only clear the emulated channels. + + // Block images are not cleared, since no emulated channels are present if decoded. + if (isExternalImage && getIntendedFormat().isBlock) + { + return; + } + const bool clearOnlyEmulatedChannels = isExternalImage && !getIntendedFormat().hasDepthOrStencilBits(); const VkColorComponentFlags colorMaskFlags = @@ -9329,6 +9336,12 @@ bool ImageHelper::hasEmulatedImageChannels() const const angle::Format &angleFmt = getIntendedFormat(); const angle::Format &textureFmt = getActualFormat(); + // Block formats may be decoded and emulated with a non-block format. + if (angleFmt.isBlock && !textureFmt.isBlock) + { + return true; + } + // The red channel is never emulated. ASSERT((angleFmt.redBits != 0 || angleFmt.luminanceBits != 0 || angleFmt.alphaBits != 0) == (textureFmt.redBits != 0)); diff --git a/src/libGLESv2.gni b/src/libGLESv2.gni index 739b55e36..3c37efcf0 100644 --- a/src/libGLESv2.gni +++ b/src/libGLESv2.gni @@ -134,6 +134,7 @@ libangle_image_util_sources = [ "src/image_util/copyimage.cpp", "src/image_util/imageformats.cpp", "src/image_util/loadimage.cpp", + "src/image_util/loadimage_astc.cpp", "src/image_util/loadimage_etc.cpp", ] diff --git a/src/tests/deqp_support/deqp_gles31_test_expectations.txt b/src/tests/deqp_support/deqp_gles31_test_expectations.txt index 1a42c7d3c..fcfa8eb82 100644 --- a/src/tests/deqp_support/deqp_gles31_test_expectations.txt +++ b/src/tests/deqp_support/deqp_gles31_test_expectations.txt @@ -204,6 +204,12 @@ 5276 NVIDIA VULKAN : dEQP-GLES31.functional.copy_image.compressed.viewclass_etc* = FAIL 5276 NVIDIA VULKAN : dEQP-GLES31.functional.copy_image.mixed.*eac* = FAIL +// Copy image tests fail on desktop cards where ASTC is emulated +7415 AMD VULKAN : dEQP-GLES31.functional.copy_image.mixed.*astc* = FAIL +7415 AMD VULKAN : dEQP-GLES31.functional.copy_image.compressed.viewclass_astc* = FAIL +7415 NVIDIA VULKAN : dEQP-GLES31.functional.copy_image.mixed.*astc* = FAIL +7415 NVIDIA VULKAN : dEQP-GLES31.functional.copy_image.compressed.viewclass_astc* = FAIL + // Vulkan Android failures with these formats 5277 VULKAN ANDROID : dEQP-GLES31.functional.copy_image.non_compressed.viewclass_32_bits.rgba8_snorm_rgb10_a2* = FAIL 5277 VULKAN ANDROID : dEQP-GLES31.functional.copy_image.non_compressed.viewclass_32_bits.rgba8_snorm_rgb9_e5* = FAIL @@ -377,7 +383,7 @@ 6910 PIXEL6 VULKAN : dEQP-GLES31.functional.shaders.linkage.es31.tessellation_geometry.varying.rules.different_precision = FAIL // This test fails on pre-release Android T drivers as of 3/25/22: 6910 PIXEL6 VULKAN : dEQP-GLES31.functional.geometry_shading.layered.layer_provoking_vertex_* = FAIL - + // Geometry shader support: // This fails on pre-release Android T drivers as of 3/25/22: 5430 PIXEL6 VULKAN : dEQP-GLES31.functional.geometry_shading.query.primitives_generated_* = FAIL diff --git a/src/tests/perf_tests/TracePerfTest.cpp b/src/tests/perf_tests/TracePerfTest.cpp index 963591736..cac95eb08 100644 --- a/src/tests/perf_tests/TracePerfTest.cpp +++ b/src/tests/perf_tests/TracePerfTest.cpp @@ -1043,6 +1043,11 @@ TracePerfTest::TracePerfTest(std::unique_ptr params) { addExtensionPrerequisite("GL_KHR_texture_compression_astc_ldr"); + if (IsNVIDIA() && mParams->isVulkan()) + { + skipTest("http://anglebug.com/7496 Nondeterministic noise between runs"); + } + if ((IsLinux() && IsIntel()) && mParams->isVulkan()) { skipTest("TODO: http://anglebug.com/6029 Crashes on Linux Intel Vulkan"); @@ -1208,6 +1213,11 @@ TracePerfTest::TracePerfTest(std::unique_ptr params) skipTest("http://anglebug.com/7173 Fails on Intel HD 630 Mobile"); } + if (IsNVIDIA() && mParams->isVulkan()) + { + skipTest("http://anglebug.com/7125 Renders incorrectly on NVIDIA"); + } + addExtensionPrerequisite("GL_EXT_geometry_shader"); addExtensionPrerequisite("GL_EXT_primitive_bounding_box"); addExtensionPrerequisite("GL_EXT_tessellation_shader"); diff --git a/third_party/astc-encoder/BUILD.gn b/third_party/astc-encoder/BUILD.gn new file mode 100644 index 000000000..a421acce7 --- /dev/null +++ b/third_party/astc-encoder/BUILD.gn @@ -0,0 +1,49 @@ +# Copyright 2022 The ANGLE Project Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +# +# Build integration for astc-encoder. + +source_set("astcenc") { + sources = [ + "src/Source/astcenc.h", + "src/Source/astcenc_averages_and_directions.cpp", + "src/Source/astcenc_block_sizes.cpp", + "src/Source/astcenc_color_quantize.cpp", + "src/Source/astcenc_color_unquantize.cpp", + "src/Source/astcenc_compress_symbolic.cpp", + "src/Source/astcenc_compute_variance.cpp", + "src/Source/astcenc_decompress_symbolic.cpp", + "src/Source/astcenc_diagnostic_trace.cpp", + "src/Source/astcenc_diagnostic_trace.h", + "src/Source/astcenc_entry.cpp", + "src/Source/astcenc_find_best_partitioning.cpp", + "src/Source/astcenc_ideal_endpoints_and_weights.cpp", + "src/Source/astcenc_image.cpp", + "src/Source/astcenc_integer_sequence.cpp", + "src/Source/astcenc_internal.h", + "src/Source/astcenc_mathlib.cpp", + "src/Source/astcenc_mathlib.h", + "src/Source/astcenc_mathlib_softfloat.cpp", + "src/Source/astcenc_partition_tables.cpp", + "src/Source/astcenc_percentile_tables.cpp", + "src/Source/astcenc_pick_best_endpoint_format.cpp", + "src/Source/astcenc_platform_isa_detection.cpp", + "src/Source/astcenc_quantization.cpp", + "src/Source/astcenc_symbolic_physical.cpp", + "src/Source/astcenc_vecmathlib.h", + "src/Source/astcenc_weight_align.cpp", + "src/Source/astcenc_weight_quant_xfer_tables.cpp", + ] + + defines = [ "ASTCENC_DECOMPRESS_ONLY=1" ] + + # To improve performance on debug builds, enable optimization for them. + if (is_debug) { + configs += [ "//build/config/compiler:optimize" ] + } + + if (is_clang) { + cflags_cc = [ "-Wno-unused-but-set-variable" ] + } +} diff --git a/third_party/astc-encoder/README.angle b/third_party/astc-encoder/README.angle new file mode 100644 index 000000000..300c020a1 --- /dev/null +++ b/third_party/astc-encoder/README.angle @@ -0,0 +1,10 @@ +Name: astc-encoder +Short Name: astc-encoder +URL: https://github.com/ARM-software/astc-encoder +Version: 573c475389bf51d16a5c3fc8348092e094e50e8f +Security Critical: no +License: Apache-2.0 +License File: NOT_SHIPPED + +Description: +This is the official repository for the Arm ASTC Encoder, a texture compressor for the Adaptive Scalable Texture Compression data format.