diff options
| author | 2020-07-01 02:28:53 -0300 | |
|---|---|---|
| committer | 2020-07-13 01:44:23 -0300 | |
| commit | fbc232426d8ff739b0028fb5b41fb5124f7e1792 (patch) | |
| tree | f3e99246a2b398151b409a1d331f27780a9a28ef /src | |
| parent | video_core: Fix DXT4 and RGB565 (diff) | |
| download | yuzu-fbc232426d8ff739b0028fb5b41fb5124f7e1792.tar.gz yuzu-fbc232426d8ff739b0028fb5b41fb5124f7e1792.tar.xz yuzu-fbc232426d8ff739b0028fb5b41fb5124f7e1792.zip | |
video_core: Rearrange pixel format names
Normalizes pixel format names to match Vulkan names. Previous to this
commit pixel formats had no convention, leading to confusion and
potential bugs.
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/compatible_formats.cpp | 87 | ||||
| -rw-r--r-- | src/video_core/gpu.h | 86 | ||||
| -rw-r--r-- | src/video_core/morton.cpp | 298 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_texture_cache.cpp | 173 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/renderer_opengl.cpp | 4 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/maxwell_to_vk.cpp | 184 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_blit_screen.cpp | 4 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_texture_cache.cpp | 10 | ||||
| -rw-r--r-- | src/video_core/shader/decode/image.cpp | 54 | ||||
| -rw-r--r-- | src/video_core/surface.cpp | 228 | ||||
| -rw-r--r-- | src/video_core/surface.h | 800 | ||||
| -rw-r--r-- | src/video_core/texture_cache/format_lookup_table.cpp | 152 | ||||
| -rw-r--r-- | src/video_core/texture_cache/surface_base.cpp | 2 | ||||
| -rw-r--r-- | src/video_core/texture_cache/surface_params.cpp | 18 | ||||
| -rw-r--r-- | src/video_core/texture_cache/texture_cache.h | 8 | ||||
| -rw-r--r-- | src/video_core/textures/convert.cpp | 6 | ||||
| -rw-r--r-- | src/video_core/textures/decoders.cpp | 89 | ||||
| -rw-r--r-- | src/video_core/textures/decoders.h | 4 | ||||
| -rw-r--r-- | src/video_core/textures/texture.h | 49 |
19 files changed, 1077 insertions, 1179 deletions
diff --git a/src/video_core/compatible_formats.cpp b/src/video_core/compatible_formats.cpp index 6c426b035..b06c32c84 100644 --- a/src/video_core/compatible_formats.cpp +++ b/src/video_core/compatible_formats.cpp | |||
| @@ -17,101 +17,94 @@ namespace { | |||
| 17 | // https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_texture_view.txt | 17 | // https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_texture_view.txt |
| 18 | 18 | ||
| 19 | constexpr std::array VIEW_CLASS_128_BITS = { | 19 | constexpr std::array VIEW_CLASS_128_BITS = { |
| 20 | PixelFormat::RGBA32F, | 20 | PixelFormat::R32G32B32A32_FLOAT, |
| 21 | PixelFormat::RGBA32UI, | 21 | PixelFormat::R32G32B32A32_UINT, |
| 22 | PixelFormat::R32G32B32A32_SINT, | ||
| 22 | }; | 23 | }; |
| 23 | // Missing formats: | ||
| 24 | // PixelFormat::RGBA32I | ||
| 25 | 24 | ||
| 26 | constexpr std::array VIEW_CLASS_96_BITS = { | 25 | constexpr std::array VIEW_CLASS_96_BITS = { |
| 27 | PixelFormat::RGB32F, | 26 | PixelFormat::R32G32B32_FLOAT, |
| 28 | }; | 27 | }; |
| 29 | // Missing formats: | 28 | // Missing formats: |
| 30 | // PixelFormat::RGB32UI, | 29 | // PixelFormat::RGB32UI, |
| 31 | // PixelFormat::RGB32I, | 30 | // PixelFormat::RGB32I, |
| 32 | 31 | ||
| 33 | constexpr std::array VIEW_CLASS_64_BITS = { | 32 | constexpr std::array VIEW_CLASS_64_BITS = { |
| 34 | PixelFormat::RGBA16F, PixelFormat::RG32F, PixelFormat::RGBA16UI, PixelFormat::RG32UI, | 33 | PixelFormat::R32G32_FLOAT, PixelFormat::R32G32_UINT, |
| 35 | PixelFormat::RGBA16U, PixelFormat::RGBA16F, PixelFormat::RGBA16S, | 34 | PixelFormat::R32G32_SINT, PixelFormat::R16G16B16A16_FLOAT, |
| 35 | PixelFormat::R16G16B16A16_UNORM, PixelFormat::R16G16B16A16_SNORM, | ||
| 36 | PixelFormat::R16G16B16A16_UINT, PixelFormat::R16G16B16A16_SINT, | ||
| 36 | }; | 37 | }; |
| 37 | // Missing formats: | ||
| 38 | // PixelFormat::RGBA16I | ||
| 39 | // PixelFormat::RG32I | ||
| 40 | 38 | ||
| 41 | // TODO: How should we handle 48 bits? | 39 | // TODO: How should we handle 48 bits? |
| 42 | 40 | ||
| 43 | constexpr std::array VIEW_CLASS_32_BITS = { | 41 | constexpr std::array VIEW_CLASS_32_BITS = { |
| 44 | PixelFormat::RG16F, PixelFormat::R11FG11FB10F, PixelFormat::R32F, | 42 | PixelFormat::R16G16_FLOAT, PixelFormat::B10G11R11_FLOAT, PixelFormat::R32_FLOAT, |
| 45 | PixelFormat::A2B10G10R10U, PixelFormat::RG16UI, PixelFormat::R32UI, | 43 | PixelFormat::A2B10G10R10_UNORM, PixelFormat::R16G16_UINT, PixelFormat::R32_UINT, |
| 46 | PixelFormat::RG16I, PixelFormat::R32I, PixelFormat::ABGR8U, | 44 | PixelFormat::R16G16_SINT, PixelFormat::R32_SINT, PixelFormat::A8B8G8R8_UNORM, |
| 47 | PixelFormat::RG16, PixelFormat::ABGR8S, PixelFormat::RG16S, | 45 | PixelFormat::R16G16_UNORM, PixelFormat::A8B8G8R8_SNORM, PixelFormat::R16G16_SNORM, |
| 48 | PixelFormat::RGBA8_SRGB, PixelFormat::E5B9G9R9F, PixelFormat::BGRA8, | 46 | PixelFormat::A8B8G8R8_SRGB, PixelFormat::E5B9G9R9_FLOAT, PixelFormat::B8G8R8A8_UNORM, |
| 49 | PixelFormat::BGRA8_SRGB, | 47 | PixelFormat::B8G8R8A8_SRGB, PixelFormat::A8B8G8R8_UINT, PixelFormat::A8B8G8R8_SINT, |
| 48 | PixelFormat::A2B10G10R10_UINT, | ||
| 50 | }; | 49 | }; |
| 51 | // Missing formats: | ||
| 52 | // PixelFormat::RGBA8UI | ||
| 53 | // PixelFormat::RGBA8I | ||
| 54 | // PixelFormat::RGB10_A2_UI | ||
| 55 | 50 | ||
| 56 | // TODO: How should we handle 24 bits? | 51 | // TODO: How should we handle 24 bits? |
| 57 | 52 | ||
| 58 | constexpr std::array VIEW_CLASS_16_BITS = { | 53 | constexpr std::array VIEW_CLASS_16_BITS = { |
| 59 | PixelFormat::R16F, PixelFormat::RG8UI, PixelFormat::R16UI, PixelFormat::R16I, | 54 | PixelFormat::R16_FLOAT, PixelFormat::R8G8_UINT, PixelFormat::R16_UINT, |
| 60 | PixelFormat::RG8U, PixelFormat::R16U, PixelFormat::RG8S, PixelFormat::R16S, | 55 | PixelFormat::R16_SINT, PixelFormat::R8G8_UNORM, PixelFormat::R16_UNORM, |
| 56 | PixelFormat::R8G8_SNORM, PixelFormat::R16_SNORM, PixelFormat::R8G8_SINT, | ||
| 61 | }; | 57 | }; |
| 62 | // Missing formats: | ||
| 63 | // PixelFormat::RG8I | ||
| 64 | 58 | ||
| 65 | constexpr std::array VIEW_CLASS_8_BITS = { | 59 | constexpr std::array VIEW_CLASS_8_BITS = { |
| 66 | PixelFormat::R8UI, | 60 | PixelFormat::R8_UINT, |
| 67 | PixelFormat::R8U, | 61 | PixelFormat::R8_UNORM, |
| 62 | PixelFormat::R8_SINT, | ||
| 63 | PixelFormat::R8_SNORM, | ||
| 68 | }; | 64 | }; |
| 69 | // Missing formats: | ||
| 70 | // PixelFormat::R8I | ||
| 71 | // PixelFormat::R8S | ||
| 72 | 65 | ||
| 73 | constexpr std::array VIEW_CLASS_RGTC1_RED = { | 66 | constexpr std::array VIEW_CLASS_RGTC1_RED = { |
| 74 | PixelFormat::DXN1, | 67 | PixelFormat::BC4_UNORM, |
| 68 | PixelFormat::BC4_SNORM, | ||
| 75 | }; | 69 | }; |
| 76 | // Missing formats: | ||
| 77 | // COMPRESSED_SIGNED_RED_RGTC1 | ||
| 78 | 70 | ||
| 79 | constexpr std::array VIEW_CLASS_RGTC2_RG = { | 71 | constexpr std::array VIEW_CLASS_RGTC2_RG = { |
| 80 | PixelFormat::DXN2UNORM, | 72 | PixelFormat::BC5_UNORM, |
| 81 | PixelFormat::DXN2SNORM, | 73 | PixelFormat::BC5_SNORM, |
| 82 | }; | 74 | }; |
| 83 | 75 | ||
| 84 | constexpr std::array VIEW_CLASS_BPTC_UNORM = { | 76 | constexpr std::array VIEW_CLASS_BPTC_UNORM = { |
| 85 | PixelFormat::BC7U, | 77 | PixelFormat::BC7_UNORM, |
| 86 | PixelFormat::BC7U_SRGB, | 78 | PixelFormat::BC7_SRGB, |
| 87 | }; | 79 | }; |
| 88 | 80 | ||
| 89 | constexpr std::array VIEW_CLASS_BPTC_FLOAT = { | 81 | constexpr std::array VIEW_CLASS_BPTC_FLOAT = { |
| 90 | PixelFormat::BC6H_SF16, | 82 | PixelFormat::BC6H_SFLOAT, |
| 91 | PixelFormat::BC6H_UF16, | 83 | PixelFormat::BC6H_UFLOAT, |
| 92 | }; | 84 | }; |
| 93 | 85 | ||
| 94 | // Compatibility table taken from Table 4.X.1 in: | 86 | // Compatibility table taken from Table 4.X.1 in: |
| 95 | // https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_copy_image.txt | 87 | // https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_copy_image.txt |
| 96 | 88 | ||
| 97 | constexpr std::array COPY_CLASS_128_BITS = { | 89 | constexpr std::array COPY_CLASS_128_BITS = { |
| 98 | PixelFormat::RGBA32UI, PixelFormat::RGBA32F, PixelFormat::DXT23, | 90 | PixelFormat::R32G32B32A32_UINT, PixelFormat::R32G32B32A32_FLOAT, PixelFormat::R32G32B32A32_SINT, |
| 99 | PixelFormat::DXT23_SRGB, PixelFormat::DXT45, PixelFormat::DXT45_SRGB, | 91 | PixelFormat::BC2_UNORM, PixelFormat::BC2_SRGB, PixelFormat::BC3_UNORM, |
| 100 | PixelFormat::DXN2SNORM, PixelFormat::BC7U, PixelFormat::BC7U_SRGB, | 92 | PixelFormat::BC3_SRGB, PixelFormat::BC5_UNORM, PixelFormat::BC5_SNORM, |
| 101 | PixelFormat::BC6H_SF16, PixelFormat::BC6H_UF16, | 93 | PixelFormat::BC7_UNORM, PixelFormat::BC7_SRGB, PixelFormat::BC6H_SFLOAT, |
| 94 | PixelFormat::BC6H_UFLOAT, | ||
| 102 | }; | 95 | }; |
| 103 | // Missing formats: | 96 | // Missing formats: |
| 104 | // PixelFormat::RGBA32I | 97 | // PixelFormat::RGBA32I |
| 105 | // COMPRESSED_RG_RGTC2 | 98 | // COMPRESSED_RG_RGTC2 |
| 106 | 99 | ||
| 107 | constexpr std::array COPY_CLASS_64_BITS = { | 100 | constexpr std::array COPY_CLASS_64_BITS = { |
| 108 | PixelFormat::RGBA16F, PixelFormat::RG32F, PixelFormat::RGBA16UI, PixelFormat::RG32UI, | 101 | PixelFormat::R16G16B16A16_FLOAT, PixelFormat::R16G16B16A16_UINT, |
| 109 | PixelFormat::RGBA16U, PixelFormat::RGBA16S, PixelFormat::DXT1_SRGB, PixelFormat::DXT1, | 102 | PixelFormat::R16G16B16A16_UNORM, PixelFormat::R16G16B16A16_SNORM, |
| 110 | 103 | PixelFormat::R16G16B16A16_SINT, PixelFormat::R32G32_UINT, | |
| 104 | PixelFormat::R32G32_FLOAT, PixelFormat::R32G32_SINT, | ||
| 105 | PixelFormat::BC1_RGBA_UNORM, PixelFormat::BC1_RGBA_SRGB, | ||
| 111 | }; | 106 | }; |
| 112 | // Missing formats: | 107 | // Missing formats: |
| 113 | // PixelFormat::RGBA16I | ||
| 114 | // PixelFormat::RG32I, | ||
| 115 | // COMPRESSED_RGB_S3TC_DXT1_EXT | 108 | // COMPRESSED_RGB_S3TC_DXT1_EXT |
| 116 | // COMPRESSED_SRGB_S3TC_DXT1_EXT | 109 | // COMPRESSED_SRGB_S3TC_DXT1_EXT |
| 117 | // COMPRESSED_RGBA_S3TC_DXT1_EXT | 110 | // COMPRESSED_RGBA_S3TC_DXT1_EXT |
diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h index 464f5c7d6..d646c441c 100644 --- a/src/video_core/gpu.h +++ b/src/video_core/gpu.h | |||
| @@ -39,42 +39,42 @@ namespace Tegra { | |||
| 39 | 39 | ||
| 40 | enum class RenderTargetFormat : u32 { | 40 | enum class RenderTargetFormat : u32 { |
| 41 | NONE = 0x0, | 41 | NONE = 0x0, |
| 42 | RGBA32_FLOAT = 0xC0, | 42 | R32B32G32A32_FLOAT = 0xC0, |
| 43 | RGBA32_SINT = 0xC1, | 43 | R32G32B32A32_SINT = 0xC1, |
| 44 | RGBA32_UINT = 0xC2, | 44 | R32G32B32A32_UINT = 0xC2, |
| 45 | RGBA16_UNORM = 0xC6, | 45 | R16G16B16A16_UNORM = 0xC6, |
| 46 | RGBA16_SNORM = 0xC7, | 46 | R16G16B16A16_SNORM = 0xC7, |
| 47 | RGBA16_SINT = 0xC8, | 47 | R16G16B16A16_SINT = 0xC8, |
| 48 | RGBA16_UINT = 0xC9, | 48 | R16G16B16A16_UINT = 0xC9, |
| 49 | RGBA16_FLOAT = 0xCA, | 49 | R16G16B16A16_FLOAT = 0xCA, |
| 50 | RG32_FLOAT = 0xCB, | 50 | R32G32_FLOAT = 0xCB, |
| 51 | RG32_SINT = 0xCC, | 51 | R32G32_SINT = 0xCC, |
| 52 | RG32_UINT = 0xCD, | 52 | R32G32_UINT = 0xCD, |
| 53 | RGBX16_FLOAT = 0xCE, | 53 | R16G16B16X16_FLOAT = 0xCE, |
| 54 | BGRA8_UNORM = 0xCF, | 54 | B8G8R8A8_UNORM = 0xCF, |
| 55 | BGRA8_SRGB = 0xD0, | 55 | B8G8R8A8_SRGB = 0xD0, |
| 56 | RGB10_A2_UNORM = 0xD1, | 56 | A2B10G10R10_UNORM = 0xD1, |
| 57 | RGB10_A2_UINT = 0xD2, | 57 | A2B10G10R10_UINT = 0xD2, |
| 58 | RGBA8_UNORM = 0xD5, | 58 | A8B8G8R8_UNORM = 0xD5, |
| 59 | RGBA8_SRGB = 0xD6, | 59 | A8B8G8R8_SRGB = 0xD6, |
| 60 | RGBA8_SNORM = 0xD7, | 60 | A8B8G8R8_SNORM = 0xD7, |
| 61 | RGBA8_SINT = 0xD8, | 61 | A8B8G8R8_SINT = 0xD8, |
| 62 | RGBA8_UINT = 0xD9, | 62 | A8B8G8R8_UINT = 0xD9, |
| 63 | RG16_UNORM = 0xDA, | 63 | R16G16_UNORM = 0xDA, |
| 64 | RG16_SNORM = 0xDB, | 64 | R16G16_SNORM = 0xDB, |
| 65 | RG16_SINT = 0xDC, | 65 | R16G16_SINT = 0xDC, |
| 66 | RG16_UINT = 0xDD, | 66 | R16G16_UINT = 0xDD, |
| 67 | RG16_FLOAT = 0xDE, | 67 | R16G16_FLOAT = 0xDE, |
| 68 | R11G11B10_FLOAT = 0xE0, | 68 | B10G11R11_FLOAT = 0xE0, |
| 69 | R32_SINT = 0xE3, | 69 | R32_SINT = 0xE3, |
| 70 | R32_UINT = 0xE4, | 70 | R32_UINT = 0xE4, |
| 71 | R32_FLOAT = 0xE5, | 71 | R32_FLOAT = 0xE5, |
| 72 | B5G6R5_UNORM = 0xE8, | 72 | R5G6B5_UNORM = 0xE8, |
| 73 | BGR5A1_UNORM = 0xE9, | 73 | A1R5G5B5_UNORM = 0xE9, |
| 74 | RG8_UNORM = 0xEA, | 74 | R8G8_UNORM = 0xEA, |
| 75 | RG8_SNORM = 0xEB, | 75 | R8G8_SNORM = 0xEB, |
| 76 | RG8_SINT = 0xEC, | 76 | R8G8_SINT = 0xEC, |
| 77 | RG8_UINT = 0xED, | 77 | R8G8_UINT = 0xED, |
| 78 | R16_UNORM = 0xEE, | 78 | R16_UNORM = 0xEE, |
| 79 | R16_SNORM = 0xEF, | 79 | R16_SNORM = 0xEF, |
| 80 | R16_SINT = 0xF0, | 80 | R16_SINT = 0xF0, |
| @@ -87,13 +87,13 @@ enum class RenderTargetFormat : u32 { | |||
| 87 | }; | 87 | }; |
| 88 | 88 | ||
| 89 | enum class DepthFormat : u32 { | 89 | enum class DepthFormat : u32 { |
| 90 | Z32_FLOAT = 0xA, | 90 | D32_FLOAT = 0xA, |
| 91 | Z16_UNORM = 0x13, | 91 | D16_UNORM = 0x13, |
| 92 | S8_Z24_UNORM = 0x14, | 92 | S8_UINT_Z24_UNORM = 0x14, |
| 93 | Z24_X8_UNORM = 0x15, | 93 | D24X8_UNORM = 0x15, |
| 94 | Z24_S8_UNORM = 0x16, | 94 | D24S8_UNORM = 0x16, |
| 95 | Z24_C8_UNORM = 0x18, | 95 | D24C8_UNORM = 0x18, |
| 96 | Z32_S8_X24_FLOAT = 0x19, | 96 | D32_FLOAT_S8X24_UINT = 0x19, |
| 97 | }; | 97 | }; |
| 98 | 98 | ||
| 99 | struct CommandListHeader; | 99 | struct CommandListHeader; |
| @@ -104,9 +104,9 @@ class DebugContext; | |||
| 104 | */ | 104 | */ |
| 105 | struct FramebufferConfig { | 105 | struct FramebufferConfig { |
| 106 | enum class PixelFormat : u32 { | 106 | enum class PixelFormat : u32 { |
| 107 | ABGR8 = 1, | 107 | A8B8G8R8_UNORM = 1, |
| 108 | RGB565 = 4, | 108 | RGB565_UNORM = 4, |
| 109 | BGRA8 = 5, | 109 | B8G8R8A8_UNORM = 5, |
| 110 | }; | 110 | }; |
| 111 | 111 | ||
| 112 | VAddr address; | 112 | VAddr address; |
diff --git a/src/video_core/morton.cpp b/src/video_core/morton.cpp index 0c3c9f12d..9da9fb4ff 100644 --- a/src/video_core/morton.cpp +++ b/src/video_core/morton.cpp | |||
| @@ -41,168 +41,168 @@ static void MortonCopy(u32 stride, u32 block_height, u32 height, u32 block_depth | |||
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | static constexpr ConversionArray morton_to_linear_fns = { | 43 | static constexpr ConversionArray morton_to_linear_fns = { |
| 44 | MortonCopy<true, PixelFormat::ABGR8U>, | 44 | MortonCopy<true, PixelFormat::A8B8G8R8_UNORM>, |
| 45 | MortonCopy<true, PixelFormat::ABGR8S>, | 45 | MortonCopy<true, PixelFormat::A8B8G8R8_SNORM>, |
| 46 | MortonCopy<true, PixelFormat::ABGR8I>, | 46 | MortonCopy<true, PixelFormat::A8B8G8R8_SINT>, |
| 47 | MortonCopy<true, PixelFormat::ABGR8UI>, | 47 | MortonCopy<true, PixelFormat::A8B8G8R8_UINT>, |
| 48 | MortonCopy<true, PixelFormat::B5G6R5U>, | 48 | MortonCopy<true, PixelFormat::R5G6B5_UNORM>, |
| 49 | MortonCopy<true, PixelFormat::R5G6B5U>, | 49 | MortonCopy<true, PixelFormat::B5G6R5_UNORM>, |
| 50 | MortonCopy<true, PixelFormat::B5G5R5A1U>, | 50 | MortonCopy<true, PixelFormat::A1R5G5B5_UNORM>, |
| 51 | MortonCopy<true, PixelFormat::A2B10G10R10U>, | 51 | MortonCopy<true, PixelFormat::A2B10G10R10_UNORM>, |
| 52 | MortonCopy<true, PixelFormat::A2B10G10R10UI>, | 52 | MortonCopy<true, PixelFormat::A2B10G10R10_UINT>, |
| 53 | MortonCopy<true, PixelFormat::A1B5G5R5U>, | 53 | MortonCopy<true, PixelFormat::A1B5G5R5_UNORM>, |
| 54 | MortonCopy<true, PixelFormat::R8U>, | 54 | MortonCopy<true, PixelFormat::R8_UNORM>, |
| 55 | MortonCopy<true, PixelFormat::R8S>, | 55 | MortonCopy<true, PixelFormat::R8_SNORM>, |
| 56 | MortonCopy<true, PixelFormat::R8I>, | 56 | MortonCopy<true, PixelFormat::R8_SINT>, |
| 57 | MortonCopy<true, PixelFormat::R8UI>, | 57 | MortonCopy<true, PixelFormat::R8_UINT>, |
| 58 | MortonCopy<true, PixelFormat::RGBA16F>, | 58 | MortonCopy<true, PixelFormat::R16G16B16A16_FLOAT>, |
| 59 | MortonCopy<true, PixelFormat::RGBA16U>, | 59 | MortonCopy<true, PixelFormat::R16G16B16A16_UNORM>, |
| 60 | MortonCopy<true, PixelFormat::RGBA16S>, | 60 | MortonCopy<true, PixelFormat::R16G16B16A16_SNORM>, |
| 61 | MortonCopy<true, PixelFormat::RGBA16I>, | 61 | MortonCopy<true, PixelFormat::R16G16B16A16_SINT>, |
| 62 | MortonCopy<true, PixelFormat::RGBA16UI>, | 62 | MortonCopy<true, PixelFormat::R16G16B16A16_UINT>, |
| 63 | MortonCopy<true, PixelFormat::R11FG11FB10F>, | 63 | MortonCopy<true, PixelFormat::B10G11R11_FLOAT>, |
| 64 | MortonCopy<true, PixelFormat::RGBA32UI>, | 64 | MortonCopy<true, PixelFormat::R32G32B32A32_UINT>, |
| 65 | MortonCopy<true, PixelFormat::DXT1>, | 65 | MortonCopy<true, PixelFormat::BC1_RGBA_UNORM>, |
| 66 | MortonCopy<true, PixelFormat::DXT23>, | 66 | MortonCopy<true, PixelFormat::BC2_UNORM>, |
| 67 | MortonCopy<true, PixelFormat::DXT45>, | 67 | MortonCopy<true, PixelFormat::BC3_UNORM>, |
| 68 | MortonCopy<true, PixelFormat::DXN1UNORM>, | 68 | MortonCopy<true, PixelFormat::BC4_UNORM>, |
| 69 | MortonCopy<true, PixelFormat::DXN1SNORM>, | 69 | MortonCopy<true, PixelFormat::BC4_SNORM>, |
| 70 | MortonCopy<true, PixelFormat::DXN2UNORM>, | 70 | MortonCopy<true, PixelFormat::BC5_UNORM>, |
| 71 | MortonCopy<true, PixelFormat::DXN2SNORM>, | 71 | MortonCopy<true, PixelFormat::BC5_SNORM>, |
| 72 | MortonCopy<true, PixelFormat::BC7U>, | 72 | MortonCopy<true, PixelFormat::BC7_UNORM>, |
| 73 | MortonCopy<true, PixelFormat::BC6H_UF16>, | 73 | MortonCopy<true, PixelFormat::BC6H_UFLOAT>, |
| 74 | MortonCopy<true, PixelFormat::BC6H_SF16>, | 74 | MortonCopy<true, PixelFormat::BC6H_SFLOAT>, |
| 75 | MortonCopy<true, PixelFormat::ASTC_2D_4X4>, | 75 | MortonCopy<true, PixelFormat::ASTC_2D_4X4_UNORM>, |
| 76 | MortonCopy<true, PixelFormat::BGRA8>, | 76 | MortonCopy<true, PixelFormat::B8G8R8A8_UNORM>, |
| 77 | MortonCopy<true, PixelFormat::RGBA32F>, | 77 | MortonCopy<true, PixelFormat::R32G32B32A32_FLOAT>, |
| 78 | MortonCopy<true, PixelFormat::RGBA32I>, | 78 | MortonCopy<true, PixelFormat::R32G32B32A32_SINT>, |
| 79 | MortonCopy<true, PixelFormat::RG32F>, | 79 | MortonCopy<true, PixelFormat::R32G32_FLOAT>, |
| 80 | MortonCopy<true, PixelFormat::RG32I>, | 80 | MortonCopy<true, PixelFormat::R32G32_SINT>, |
| 81 | MortonCopy<true, PixelFormat::R32F>, | 81 | MortonCopy<true, PixelFormat::R32_FLOAT>, |
| 82 | MortonCopy<true, PixelFormat::R16F>, | 82 | MortonCopy<true, PixelFormat::R16_FLOAT>, |
| 83 | MortonCopy<true, PixelFormat::R16U>, | 83 | MortonCopy<true, PixelFormat::R16_UNORM>, |
| 84 | MortonCopy<true, PixelFormat::R16S>, | 84 | MortonCopy<true, PixelFormat::R16_SNORM>, |
| 85 | MortonCopy<true, PixelFormat::R16UI>, | 85 | MortonCopy<true, PixelFormat::R16_UINT>, |
| 86 | MortonCopy<true, PixelFormat::R16I>, | 86 | MortonCopy<true, PixelFormat::R16_SINT>, |
| 87 | MortonCopy<true, PixelFormat::RG16>, | 87 | MortonCopy<true, PixelFormat::R16G16_UNORM>, |
| 88 | MortonCopy<true, PixelFormat::RG16F>, | 88 | MortonCopy<true, PixelFormat::R16G16_FLOAT>, |
| 89 | MortonCopy<true, PixelFormat::RG16UI>, | 89 | MortonCopy<true, PixelFormat::R16G16_UINT>, |
| 90 | MortonCopy<true, PixelFormat::RG16I>, | 90 | MortonCopy<true, PixelFormat::R16G16_SINT>, |
| 91 | MortonCopy<true, PixelFormat::RG16S>, | 91 | MortonCopy<true, PixelFormat::R16G16_SNORM>, |
| 92 | MortonCopy<true, PixelFormat::RGB32F>, | 92 | MortonCopy<true, PixelFormat::R32G32B32_FLOAT>, |
| 93 | MortonCopy<true, PixelFormat::RGBA8_SRGB>, | 93 | MortonCopy<true, PixelFormat::A8B8G8R8_SRGB>, |
| 94 | MortonCopy<true, PixelFormat::RG8U>, | 94 | MortonCopy<true, PixelFormat::R8G8_UNORM>, |
| 95 | MortonCopy<true, PixelFormat::RG8S>, | 95 | MortonCopy<true, PixelFormat::R8G8_SNORM>, |
| 96 | MortonCopy<true, PixelFormat::RG8I>, | 96 | MortonCopy<true, PixelFormat::R8G8_SINT>, |
| 97 | MortonCopy<true, PixelFormat::RG8UI>, | 97 | MortonCopy<true, PixelFormat::R8G8_UINT>, |
| 98 | MortonCopy<true, PixelFormat::RG32UI>, | 98 | MortonCopy<true, PixelFormat::R32G32_UINT>, |
| 99 | MortonCopy<true, PixelFormat::RGBX16F>, | 99 | MortonCopy<true, PixelFormat::R16G16B16X16_FLOAT>, |
| 100 | MortonCopy<true, PixelFormat::R32UI>, | 100 | MortonCopy<true, PixelFormat::R32_UINT>, |
| 101 | MortonCopy<true, PixelFormat::R32I>, | 101 | MortonCopy<true, PixelFormat::R32_SINT>, |
| 102 | MortonCopy<true, PixelFormat::ASTC_2D_8X8>, | 102 | MortonCopy<true, PixelFormat::ASTC_2D_8X8_UNORM>, |
| 103 | MortonCopy<true, PixelFormat::ASTC_2D_8X5>, | 103 | MortonCopy<true, PixelFormat::ASTC_2D_8X5_UNORM>, |
| 104 | MortonCopy<true, PixelFormat::ASTC_2D_5X4>, | 104 | MortonCopy<true, PixelFormat::ASTC_2D_5X4_UNORM>, |
| 105 | MortonCopy<true, PixelFormat::BGRA8_SRGB>, | 105 | MortonCopy<true, PixelFormat::B8G8R8A8_SRGB>, |
| 106 | MortonCopy<true, PixelFormat::DXT1_SRGB>, | 106 | MortonCopy<true, PixelFormat::BC1_RGBA_SRGB>, |
| 107 | MortonCopy<true, PixelFormat::DXT23_SRGB>, | 107 | MortonCopy<true, PixelFormat::BC2_SRGB>, |
| 108 | MortonCopy<true, PixelFormat::DXT45_SRGB>, | 108 | MortonCopy<true, PixelFormat::BC3_SRGB>, |
| 109 | MortonCopy<true, PixelFormat::BC7U_SRGB>, | 109 | MortonCopy<true, PixelFormat::BC7_SRGB>, |
| 110 | MortonCopy<true, PixelFormat::R4G4B4A4U>, | 110 | MortonCopy<true, PixelFormat::A4B4G4R4_UNORM>, |
| 111 | MortonCopy<true, PixelFormat::ASTC_2D_4X4_SRGB>, | 111 | MortonCopy<true, PixelFormat::ASTC_2D_4X4_SRGB>, |
| 112 | MortonCopy<true, PixelFormat::ASTC_2D_8X8_SRGB>, | 112 | MortonCopy<true, PixelFormat::ASTC_2D_8X8_SRGB>, |
| 113 | MortonCopy<true, PixelFormat::ASTC_2D_8X5_SRGB>, | 113 | MortonCopy<true, PixelFormat::ASTC_2D_8X5_SRGB>, |
| 114 | MortonCopy<true, PixelFormat::ASTC_2D_5X4_SRGB>, | 114 | MortonCopy<true, PixelFormat::ASTC_2D_5X4_SRGB>, |
| 115 | MortonCopy<true, PixelFormat::ASTC_2D_5X5>, | 115 | MortonCopy<true, PixelFormat::ASTC_2D_5X5_UNORM>, |
| 116 | MortonCopy<true, PixelFormat::ASTC_2D_5X5_SRGB>, | 116 | MortonCopy<true, PixelFormat::ASTC_2D_5X5_SRGB>, |
| 117 | MortonCopy<true, PixelFormat::ASTC_2D_10X8>, | 117 | MortonCopy<true, PixelFormat::ASTC_2D_10X8_UNORM>, |
| 118 | MortonCopy<true, PixelFormat::ASTC_2D_10X8_SRGB>, | 118 | MortonCopy<true, PixelFormat::ASTC_2D_10X8_SRGB>, |
| 119 | MortonCopy<true, PixelFormat::ASTC_2D_6X6>, | 119 | MortonCopy<true, PixelFormat::ASTC_2D_6X6_UNORM>, |
| 120 | MortonCopy<true, PixelFormat::ASTC_2D_6X6_SRGB>, | 120 | MortonCopy<true, PixelFormat::ASTC_2D_6X6_SRGB>, |
| 121 | MortonCopy<true, PixelFormat::ASTC_2D_10X10>, | 121 | MortonCopy<true, PixelFormat::ASTC_2D_10X10_UNORM>, |
| 122 | MortonCopy<true, PixelFormat::ASTC_2D_10X10_SRGB>, | 122 | MortonCopy<true, PixelFormat::ASTC_2D_10X10_SRGB>, |
| 123 | MortonCopy<true, PixelFormat::ASTC_2D_12X12>, | 123 | MortonCopy<true, PixelFormat::ASTC_2D_12X12_UNORM>, |
| 124 | MortonCopy<true, PixelFormat::ASTC_2D_12X12_SRGB>, | 124 | MortonCopy<true, PixelFormat::ASTC_2D_12X12_SRGB>, |
| 125 | MortonCopy<true, PixelFormat::ASTC_2D_8X6>, | 125 | MortonCopy<true, PixelFormat::ASTC_2D_8X6_UNORM>, |
| 126 | MortonCopy<true, PixelFormat::ASTC_2D_8X6_SRGB>, | 126 | MortonCopy<true, PixelFormat::ASTC_2D_8X6_SRGB>, |
| 127 | MortonCopy<true, PixelFormat::ASTC_2D_6X5>, | 127 | MortonCopy<true, PixelFormat::ASTC_2D_6X5_UNORM>, |
| 128 | MortonCopy<true, PixelFormat::ASTC_2D_6X5_SRGB>, | 128 | MortonCopy<true, PixelFormat::ASTC_2D_6X5_SRGB>, |
| 129 | MortonCopy<true, PixelFormat::E5B9G9R9F>, | 129 | MortonCopy<true, PixelFormat::E5B9G9R9_FLOAT>, |
| 130 | MortonCopy<true, PixelFormat::Z32F>, | 130 | MortonCopy<true, PixelFormat::D32_FLOAT>, |
| 131 | MortonCopy<true, PixelFormat::Z16>, | 131 | MortonCopy<true, PixelFormat::D16_UNORM>, |
| 132 | MortonCopy<true, PixelFormat::Z24S8>, | 132 | MortonCopy<true, PixelFormat::D24_UNORM_S8_UINT>, |
| 133 | MortonCopy<true, PixelFormat::S8Z24>, | 133 | MortonCopy<true, PixelFormat::S8_UINT_D24_UNORM>, |
| 134 | MortonCopy<true, PixelFormat::Z32FS8>, | 134 | MortonCopy<true, PixelFormat::D32_FLOAT_S8_UINT>, |
| 135 | }; | 135 | }; |
| 136 | 136 | ||
| 137 | static constexpr ConversionArray linear_to_morton_fns = { | 137 | static constexpr ConversionArray linear_to_morton_fns = { |
| 138 | MortonCopy<false, PixelFormat::ABGR8U>, | 138 | MortonCopy<false, PixelFormat::A8B8G8R8_UNORM>, |
| 139 | MortonCopy<false, PixelFormat::ABGR8S>, | 139 | MortonCopy<false, PixelFormat::A8B8G8R8_SNORM>, |
| 140 | MortonCopy<false, PixelFormat::ABGR8I>, | 140 | MortonCopy<false, PixelFormat::A8B8G8R8_SINT>, |
| 141 | MortonCopy<false, PixelFormat::ABGR8UI>, | 141 | MortonCopy<false, PixelFormat::A8B8G8R8_UINT>, |
| 142 | MortonCopy<false, PixelFormat::B5G6R5U>, | 142 | MortonCopy<false, PixelFormat::R5G6B5_UNORM>, |
| 143 | MortonCopy<false, PixelFormat::R5G6B5U>, | 143 | MortonCopy<false, PixelFormat::B5G6R5_UNORM>, |
| 144 | MortonCopy<false, PixelFormat::B5G5R5A1U>, | 144 | MortonCopy<false, PixelFormat::A1R5G5B5_UNORM>, |
| 145 | MortonCopy<false, PixelFormat::A2B10G10R10U>, | 145 | MortonCopy<false, PixelFormat::A2B10G10R10_UNORM>, |
| 146 | MortonCopy<false, PixelFormat::A2B10G10R10UI>, | 146 | MortonCopy<false, PixelFormat::A2B10G10R10_UINT>, |
| 147 | MortonCopy<false, PixelFormat::A1B5G5R5U>, | 147 | MortonCopy<false, PixelFormat::A1B5G5R5_UNORM>, |
| 148 | MortonCopy<false, PixelFormat::R8U>, | 148 | MortonCopy<false, PixelFormat::R8_UNORM>, |
| 149 | MortonCopy<false, PixelFormat::R8S>, | 149 | MortonCopy<false, PixelFormat::R8_SNORM>, |
| 150 | MortonCopy<false, PixelFormat::R8I>, | 150 | MortonCopy<false, PixelFormat::R8_SINT>, |
| 151 | MortonCopy<false, PixelFormat::R8UI>, | 151 | MortonCopy<false, PixelFormat::R8_UINT>, |
| 152 | MortonCopy<false, PixelFormat::RGBA16F>, | 152 | MortonCopy<false, PixelFormat::R16G16B16A16_FLOAT>, |
| 153 | MortonCopy<false, PixelFormat::RGBA16S>, | 153 | MortonCopy<false, PixelFormat::R16G16B16A16_SNORM>, |
| 154 | MortonCopy<false, PixelFormat::RGBA16I>, | 154 | MortonCopy<false, PixelFormat::R16G16B16A16_SINT>, |
| 155 | MortonCopy<false, PixelFormat::RGBA16U>, | 155 | MortonCopy<false, PixelFormat::R16G16B16A16_UNORM>, |
| 156 | MortonCopy<false, PixelFormat::RGBA16UI>, | 156 | MortonCopy<false, PixelFormat::R16G16B16A16_UINT>, |
| 157 | MortonCopy<false, PixelFormat::R11FG11FB10F>, | 157 | MortonCopy<false, PixelFormat::B10G11R11_FLOAT>, |
| 158 | MortonCopy<false, PixelFormat::RGBA32UI>, | 158 | MortonCopy<false, PixelFormat::R32G32B32A32_UINT>, |
| 159 | MortonCopy<false, PixelFormat::DXT1>, | 159 | MortonCopy<false, PixelFormat::BC1_RGBA_UNORM>, |
| 160 | MortonCopy<false, PixelFormat::DXT23>, | 160 | MortonCopy<false, PixelFormat::BC2_UNORM>, |
| 161 | MortonCopy<false, PixelFormat::DXT45>, | 161 | MortonCopy<false, PixelFormat::BC3_UNORM>, |
| 162 | MortonCopy<false, PixelFormat::DXN1UNORM>, | 162 | MortonCopy<false, PixelFormat::BC4_UNORM>, |
| 163 | MortonCopy<false, PixelFormat::DXN1SNORM>, | 163 | MortonCopy<false, PixelFormat::BC4_SNORM>, |
| 164 | MortonCopy<false, PixelFormat::DXN2UNORM>, | 164 | MortonCopy<false, PixelFormat::BC5_UNORM>, |
| 165 | MortonCopy<false, PixelFormat::DXN2SNORM>, | 165 | MortonCopy<false, PixelFormat::BC5_SNORM>, |
| 166 | MortonCopy<false, PixelFormat::BC7U>, | 166 | MortonCopy<false, PixelFormat::BC7_UNORM>, |
| 167 | MortonCopy<false, PixelFormat::BC6H_UF16>, | 167 | MortonCopy<false, PixelFormat::BC6H_UFLOAT>, |
| 168 | MortonCopy<false, PixelFormat::BC6H_SF16>, | 168 | MortonCopy<false, PixelFormat::BC6H_SFLOAT>, |
| 169 | // TODO(Subv): Swizzling ASTC formats are not supported | 169 | // TODO(Subv): Swizzling ASTC formats are not supported |
| 170 | nullptr, | 170 | nullptr, |
| 171 | MortonCopy<false, PixelFormat::BGRA8>, | 171 | MortonCopy<false, PixelFormat::B8G8R8A8_UNORM>, |
| 172 | MortonCopy<false, PixelFormat::RGBA32F>, | 172 | MortonCopy<false, PixelFormat::R32G32B32A32_FLOAT>, |
| 173 | MortonCopy<false, PixelFormat::RGBA32I>, | 173 | MortonCopy<false, PixelFormat::R32G32B32A32_SINT>, |
| 174 | MortonCopy<false, PixelFormat::RG32F>, | 174 | MortonCopy<false, PixelFormat::R32G32_FLOAT>, |
| 175 | MortonCopy<false, PixelFormat::RG32I>, | 175 | MortonCopy<false, PixelFormat::R32G32_SINT>, |
| 176 | MortonCopy<false, PixelFormat::R32F>, | 176 | MortonCopy<false, PixelFormat::R32_FLOAT>, |
| 177 | MortonCopy<false, PixelFormat::R16F>, | 177 | MortonCopy<false, PixelFormat::R16_FLOAT>, |
| 178 | MortonCopy<false, PixelFormat::R16U>, | 178 | MortonCopy<false, PixelFormat::R16_UNORM>, |
| 179 | MortonCopy<false, PixelFormat::R16S>, | 179 | MortonCopy<false, PixelFormat::R16_SNORM>, |
| 180 | MortonCopy<false, PixelFormat::R16UI>, | 180 | MortonCopy<false, PixelFormat::R16_UINT>, |
| 181 | MortonCopy<false, PixelFormat::R16I>, | 181 | MortonCopy<false, PixelFormat::R16_SINT>, |
| 182 | MortonCopy<false, PixelFormat::RG16>, | 182 | MortonCopy<false, PixelFormat::R16G16_UNORM>, |
| 183 | MortonCopy<false, PixelFormat::RG16F>, | 183 | MortonCopy<false, PixelFormat::R16G16_FLOAT>, |
| 184 | MortonCopy<false, PixelFormat::RG16UI>, | 184 | MortonCopy<false, PixelFormat::R16G16_UINT>, |
| 185 | MortonCopy<false, PixelFormat::RG16I>, | 185 | MortonCopy<false, PixelFormat::R16G16_SINT>, |
| 186 | MortonCopy<false, PixelFormat::RG16S>, | 186 | MortonCopy<false, PixelFormat::R16G16_SNORM>, |
| 187 | MortonCopy<false, PixelFormat::RGB32F>, | 187 | MortonCopy<false, PixelFormat::R32G32B32_FLOAT>, |
| 188 | MortonCopy<false, PixelFormat::RGBA8_SRGB>, | 188 | MortonCopy<false, PixelFormat::A8B8G8R8_SRGB>, |
| 189 | MortonCopy<false, PixelFormat::RG8U>, | 189 | MortonCopy<false, PixelFormat::R8G8_UNORM>, |
| 190 | MortonCopy<false, PixelFormat::RG8S>, | 190 | MortonCopy<false, PixelFormat::R8G8_SNORM>, |
| 191 | MortonCopy<false, PixelFormat::RG8I>, | 191 | MortonCopy<false, PixelFormat::R8G8_SINT>, |
| 192 | MortonCopy<false, PixelFormat::RG8UI>, | 192 | MortonCopy<false, PixelFormat::R8G8_UINT>, |
| 193 | MortonCopy<false, PixelFormat::RG32UI>, | 193 | MortonCopy<false, PixelFormat::R32G32_UINT>, |
| 194 | MortonCopy<false, PixelFormat::RGBX16F>, | 194 | MortonCopy<false, PixelFormat::R16G16B16X16_FLOAT>, |
| 195 | MortonCopy<false, PixelFormat::R32UI>, | 195 | MortonCopy<false, PixelFormat::R32_UINT>, |
| 196 | MortonCopy<false, PixelFormat::R32I>, | 196 | MortonCopy<false, PixelFormat::R32_SINT>, |
| 197 | nullptr, | 197 | nullptr, |
| 198 | nullptr, | 198 | nullptr, |
| 199 | nullptr, | 199 | nullptr, |
| 200 | MortonCopy<false, PixelFormat::BGRA8_SRGB>, | 200 | MortonCopy<false, PixelFormat::B8G8R8A8_SRGB>, |
| 201 | MortonCopy<false, PixelFormat::DXT1_SRGB>, | 201 | MortonCopy<false, PixelFormat::BC1_RGBA_SRGB>, |
| 202 | MortonCopy<false, PixelFormat::DXT23_SRGB>, | 202 | MortonCopy<false, PixelFormat::BC2_SRGB>, |
| 203 | MortonCopy<false, PixelFormat::DXT45_SRGB>, | 203 | MortonCopy<false, PixelFormat::BC3_SRGB>, |
| 204 | MortonCopy<false, PixelFormat::BC7U_SRGB>, | 204 | MortonCopy<false, PixelFormat::BC7_SRGB>, |
| 205 | MortonCopy<false, PixelFormat::R4G4B4A4U>, | 205 | MortonCopy<false, PixelFormat::A4B4G4R4_UNORM>, |
| 206 | nullptr, | 206 | nullptr, |
| 207 | nullptr, | 207 | nullptr, |
| 208 | nullptr, | 208 | nullptr, |
| @@ -221,12 +221,12 @@ static constexpr ConversionArray linear_to_morton_fns = { | |||
| 221 | nullptr, | 221 | nullptr, |
| 222 | nullptr, | 222 | nullptr, |
| 223 | nullptr, | 223 | nullptr, |
| 224 | MortonCopy<false, PixelFormat::E5B9G9R9F>, | 224 | MortonCopy<false, PixelFormat::E5B9G9R9_FLOAT>, |
| 225 | MortonCopy<false, PixelFormat::Z32F>, | 225 | MortonCopy<false, PixelFormat::D32_FLOAT>, |
| 226 | MortonCopy<false, PixelFormat::Z16>, | 226 | MortonCopy<false, PixelFormat::D16_UNORM>, |
| 227 | MortonCopy<false, PixelFormat::Z24S8>, | 227 | MortonCopy<false, PixelFormat::D24_UNORM_S8_UINT>, |
| 228 | MortonCopy<false, PixelFormat::S8Z24>, | 228 | MortonCopy<false, PixelFormat::S8_UINT_D24_UNORM>, |
| 229 | MortonCopy<false, PixelFormat::Z32FS8>, | 229 | MortonCopy<false, PixelFormat::D32_FLOAT_S8_UINT>, |
| 230 | }; | 230 | }; |
| 231 | 231 | ||
| 232 | static MortonCopyFn GetSwizzleFunction(MortonSwizzleMode mode, Surface::PixelFormat format) { | 232 | static MortonCopyFn GetSwizzleFunction(MortonSwizzleMode mode, Surface::PixelFormat format) { |
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cpp index 12f54c050..0a7bc9e2b 100644 --- a/src/video_core/renderer_opengl/gl_texture_cache.cpp +++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp | |||
| @@ -41,102 +41,103 @@ struct FormatTuple { | |||
| 41 | }; | 41 | }; |
| 42 | 42 | ||
| 43 | constexpr std::array<FormatTuple, VideoCore::Surface::MaxPixelFormat> tex_format_tuples = {{ | 43 | constexpr std::array<FormatTuple, VideoCore::Surface::MaxPixelFormat> tex_format_tuples = {{ |
| 44 | {GL_RGBA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV}, // ABGR8U | 44 | {GL_RGBA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV}, // A8B8G8R8_UNORM |
| 45 | {GL_RGBA8_SNORM, GL_RGBA, GL_BYTE}, // ABGR8S | 45 | {GL_RGBA8_SNORM, GL_RGBA, GL_BYTE}, // A8B8G8R8_SNORM |
| 46 | {GL_RGBA8I, GL_RGBA_INTEGER, GL_BYTE}, // ABGR8I | 46 | {GL_RGBA8I, GL_RGBA_INTEGER, GL_BYTE}, // A8B8G8R8_SINT |
| 47 | {GL_RGBA8UI, GL_RGBA_INTEGER, GL_UNSIGNED_BYTE}, // ABGR8UI | 47 | {GL_RGBA8UI, GL_RGBA_INTEGER, GL_UNSIGNED_BYTE}, // A8B8G8R8_UINT |
| 48 | {GL_RGB565, GL_RGB, GL_UNSIGNED_SHORT_5_6_5}, // B5G6R5U | 48 | {GL_RGB565, GL_RGB, GL_UNSIGNED_SHORT_5_6_5}, // R5G6B5_UNORM |
| 49 | {GL_RGB565, GL_RGB, GL_UNSIGNED_SHORT_5_6_5_REV}, // R5G6B5U | 49 | {GL_RGB565, GL_RGB, GL_UNSIGNED_SHORT_5_6_5_REV}, // B5G6R5_UNORM |
| 50 | {GL_RGB5_A1, GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV}, // B5G5R5A1U | 50 | {GL_RGB5_A1, GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV}, // A1R5G5B5_UNORM |
| 51 | {GL_RGB10_A2, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV}, // A2B10G10R10U | 51 | {GL_RGB10_A2, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV}, // A2B10G10R10_UNORM |
| 52 | {GL_RGB10_A2UI, GL_RGBA_INTEGER, GL_UNSIGNED_INT_2_10_10_10_REV}, // A2B10G10R10UI | 52 | {GL_RGB10_A2UI, GL_RGBA_INTEGER, GL_UNSIGNED_INT_2_10_10_10_REV}, // A2B10G10R10_UINT |
| 53 | {GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV}, // A1B5G5R5U | 53 | {GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV}, // A1B5G5R5_UNORM |
| 54 | {GL_R8, GL_RED, GL_UNSIGNED_BYTE}, // R8U | 54 | {GL_R8, GL_RED, GL_UNSIGNED_BYTE}, // R8_UNORM |
| 55 | {GL_R8_SNORM, GL_RED, GL_BYTE}, // R8S | 55 | {GL_R8_SNORM, GL_RED, GL_BYTE}, // R8_SNORM |
| 56 | {GL_R8I, GL_RED_INTEGER, GL_BYTE}, // R8I | 56 | {GL_R8I, GL_RED_INTEGER, GL_BYTE}, // R8_SINT |
| 57 | {GL_R8UI, GL_RED_INTEGER, GL_UNSIGNED_BYTE}, // R8UI | 57 | {GL_R8UI, GL_RED_INTEGER, GL_UNSIGNED_BYTE}, // R8_UINT |
| 58 | {GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT}, // RGBA16F | 58 | {GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT}, // R16G16B16A16_FLOAT |
| 59 | {GL_RGBA16, GL_RGBA, GL_UNSIGNED_SHORT}, // RGBA16U | 59 | {GL_RGBA16, GL_RGBA, GL_UNSIGNED_SHORT}, // R16G16B16A16_UNORM |
| 60 | {GL_RGBA16_SNORM, GL_RGBA, GL_SHORT}, // RGBA16S | 60 | {GL_RGBA16_SNORM, GL_RGBA, GL_SHORT}, // R16G16B16A16_SNORM |
| 61 | {GL_RGBA16I, GL_RGBA_INTEGER, GL_SHORT}, // RGBA16I | 61 | {GL_RGBA16I, GL_RGBA_INTEGER, GL_SHORT}, // R16G16B16A16_SINT |
| 62 | {GL_RGBA16UI, GL_RGBA_INTEGER, GL_UNSIGNED_SHORT}, // RGBA16UI | 62 | {GL_RGBA16UI, GL_RGBA_INTEGER, GL_UNSIGNED_SHORT}, // R16G16B16A16_UINT |
| 63 | {GL_R11F_G11F_B10F, GL_RGB, GL_UNSIGNED_INT_10F_11F_11F_REV}, // R11FG11FB10F | 63 | {GL_R11F_G11F_B10F, GL_RGB, GL_UNSIGNED_INT_10F_11F_11F_REV}, // B10G11R11_FLOAT |
| 64 | {GL_RGBA32UI, GL_RGBA_INTEGER, GL_UNSIGNED_INT}, // RGBA32UI | 64 | {GL_RGBA32UI, GL_RGBA_INTEGER, GL_UNSIGNED_INT}, // R32G32B32A32_UINT |
| 65 | {GL_COMPRESSED_RGBA_S3TC_DXT1_EXT}, // DXT1 | 65 | {GL_COMPRESSED_RGBA_S3TC_DXT1_EXT}, // BC1_RGBA_UNORM |
| 66 | {GL_COMPRESSED_RGBA_S3TC_DXT3_EXT}, // DXT23 | 66 | {GL_COMPRESSED_RGBA_S3TC_DXT3_EXT}, // BC2_UNORM |
| 67 | {GL_COMPRESSED_RGBA_S3TC_DXT5_EXT}, // DXT45 | 67 | {GL_COMPRESSED_RGBA_S3TC_DXT5_EXT}, // BC3_UNORM |
| 68 | {GL_COMPRESSED_RED_RGTC1}, // DXN1UNORM | 68 | {GL_COMPRESSED_RED_RGTC1}, // BC4_UNORM |
| 69 | {GL_COMPRESSED_SIGNED_RED_RGTC1}, // DXN1SNORM | 69 | {GL_COMPRESSED_SIGNED_RED_RGTC1}, // BC4_SNORM |
| 70 | {GL_COMPRESSED_RG_RGTC2}, // DXN2UNORM | 70 | {GL_COMPRESSED_RG_RGTC2}, // BC5_UNORM |
| 71 | {GL_COMPRESSED_SIGNED_RG_RGTC2}, // DXN2SNORM | 71 | {GL_COMPRESSED_SIGNED_RG_RGTC2}, // BC5_SNORM |
| 72 | {GL_COMPRESSED_RGBA_BPTC_UNORM}, // BC7U | 72 | {GL_COMPRESSED_RGBA_BPTC_UNORM}, // BC7_UNORM |
| 73 | {GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT}, // BC6H_UF16 | 73 | {GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT}, // BC6H_UFLOAT |
| 74 | {GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT}, // BC6H_SF16 | 74 | {GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT}, // BC6H_SFLOAT |
| 75 | {GL_COMPRESSED_RGBA_ASTC_4x4_KHR}, // ASTC_2D_4X4 | 75 | {GL_COMPRESSED_RGBA_ASTC_4x4_KHR}, // ASTC_2D_4X4_UNORM |
| 76 | {GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE}, // BGRA8 | 76 | {GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE}, // B8G8R8A8_UNORM |
| 77 | {GL_RGBA32F, GL_RGBA, GL_FLOAT}, // RGBA32F | 77 | {GL_RGBA32F, GL_RGBA, GL_FLOAT}, // R32G32B32A32_FLOAT |
| 78 | {GL_RGBA32I, GL_RGBA_INTEGER, GL_INT}, // RGBA32I | 78 | {GL_RGBA32I, GL_RGBA_INTEGER, GL_INT}, // R32G32B32A32_SINT |
| 79 | {GL_RG32F, GL_RG, GL_FLOAT}, // RG32F | 79 | {GL_RG32F, GL_RG, GL_FLOAT}, // R32G32_FLOAT |
| 80 | {GL_RG32I, GL_RG_INTEGER, GL_INT}, // RG32I | 80 | {GL_RG32I, GL_RG_INTEGER, GL_INT}, // R32G32_SINT |
| 81 | {GL_R32F, GL_RED, GL_FLOAT}, // R32F | 81 | {GL_R32F, GL_RED, GL_FLOAT}, // R32_FLOAT |
| 82 | {GL_R16F, GL_RED, GL_HALF_FLOAT}, // R16F | 82 | {GL_R16F, GL_RED, GL_HALF_FLOAT}, // R16_FLOAT |
| 83 | {GL_R16, GL_RED, GL_UNSIGNED_SHORT}, // R16U | 83 | {GL_R16, GL_RED, GL_UNSIGNED_SHORT}, // R16_UNORM |
| 84 | {GL_R16_SNORM, GL_RED, GL_SHORT}, // R16S | 84 | {GL_R16_SNORM, GL_RED, GL_SHORT}, // R16_SNORM |
| 85 | {GL_R16UI, GL_RED_INTEGER, GL_UNSIGNED_SHORT}, // R16UI | 85 | {GL_R16UI, GL_RED_INTEGER, GL_UNSIGNED_SHORT}, // R16_UINT |
| 86 | {GL_R16I, GL_RED_INTEGER, GL_SHORT}, // R16I | 86 | {GL_R16I, GL_RED_INTEGER, GL_SHORT}, // R16_SINT |
| 87 | {GL_RG16, GL_RG, GL_UNSIGNED_SHORT}, // RG16 | 87 | {GL_RG16, GL_RG, GL_UNSIGNED_SHORT}, // R16G16_UNORM |
| 88 | {GL_RG16F, GL_RG, GL_HALF_FLOAT}, // RG16F | 88 | {GL_RG16F, GL_RG, GL_HALF_FLOAT}, // R16G16_FLOAT |
| 89 | {GL_RG16UI, GL_RG_INTEGER, GL_UNSIGNED_SHORT}, // RG16UI | 89 | {GL_RG16UI, GL_RG_INTEGER, GL_UNSIGNED_SHORT}, // R16G16_UINT |
| 90 | {GL_RG16I, GL_RG_INTEGER, GL_SHORT}, // RG16I | 90 | {GL_RG16I, GL_RG_INTEGER, GL_SHORT}, // R16G16_SINT |
| 91 | {GL_RG16_SNORM, GL_RG, GL_SHORT}, // RG16S | 91 | {GL_RG16_SNORM, GL_RG, GL_SHORT}, // R16G16_SNORM |
| 92 | {GL_RGB32F, GL_RGB, GL_FLOAT}, // RGB32F | 92 | {GL_RGB32F, GL_RGB, GL_FLOAT}, // R32G32B32_FLOAT |
| 93 | {GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV}, // RGBA8_SRGB | 93 | {GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV}, // A8B8G8R8_SRGB |
| 94 | {GL_RG8, GL_RG, GL_UNSIGNED_BYTE}, // RG8U | 94 | {GL_RG8, GL_RG, GL_UNSIGNED_BYTE}, // R8G8_UNORM |
| 95 | {GL_RG8_SNORM, GL_RG, GL_BYTE}, // RG8S | 95 | {GL_RG8_SNORM, GL_RG, GL_BYTE}, // R8G8_SNORM |
| 96 | {GL_RG8I, GL_RG_INTEGER, GL_BYTE}, // RG8I | 96 | {GL_RG8I, GL_RG_INTEGER, GL_BYTE}, // R8G8_SINT |
| 97 | {GL_RG8UI, GL_RG_INTEGER, GL_UNSIGNED_BYTE}, // RG8UI | 97 | {GL_RG8UI, GL_RG_INTEGER, GL_UNSIGNED_BYTE}, // R8G8_UINT |
| 98 | {GL_RG32UI, GL_RG_INTEGER, GL_UNSIGNED_INT}, // RG32UI | 98 | {GL_RG32UI, GL_RG_INTEGER, GL_UNSIGNED_INT}, // R32G32_UINT |
| 99 | {GL_RGB16F, GL_RGBA, GL_HALF_FLOAT}, // RGBX16F | 99 | {GL_RGB16F, GL_RGBA, GL_HALF_FLOAT}, // R16G16B16X16_FLOAT |
| 100 | {GL_R32UI, GL_RED_INTEGER, GL_UNSIGNED_INT}, // R32UI | 100 | {GL_R32UI, GL_RED_INTEGER, GL_UNSIGNED_INT}, // R32_UINT |
| 101 | {GL_R32I, GL_RED_INTEGER, GL_INT}, // R32I | 101 | {GL_R32I, GL_RED_INTEGER, GL_INT}, // R32_SINT |
| 102 | {GL_COMPRESSED_RGBA_ASTC_8x8_KHR}, // ASTC_2D_8X8 | 102 | {GL_COMPRESSED_RGBA_ASTC_8x8_KHR}, // ASTC_2D_8X8_UNORM |
| 103 | {GL_COMPRESSED_RGBA_ASTC_8x5_KHR}, // ASTC_2D_8X5 | 103 | {GL_COMPRESSED_RGBA_ASTC_8x5_KHR}, // ASTC_2D_8X5_UNORM |
| 104 | {GL_COMPRESSED_RGBA_ASTC_5x4_KHR}, // ASTC_2D_5X4 | 104 | {GL_COMPRESSED_RGBA_ASTC_5x4_KHR}, // ASTC_2D_5X4_UNORM |
| 105 | {GL_SRGB8_ALPHA8, GL_BGRA, GL_UNSIGNED_BYTE}, // BGRA8 | 105 | {GL_SRGB8_ALPHA8, GL_BGRA, GL_UNSIGNED_BYTE}, // B8G8R8A8_UNORM |
| 106 | // Compressed sRGB formats | 106 | // Compressed sRGB formats |
| 107 | {GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT}, // DXT1_SRGB | 107 | {GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT}, // BC1_RGBA_SRGB |
| 108 | {GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT}, // DXT23_SRGB | 108 | {GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT}, // BC2_SRGB |
| 109 | {GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}, // DXT45_SRGB | 109 | {GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}, // BC3_SRGB |
| 110 | {GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM}, // BC7U_SRGB | 110 | {GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM}, // BC7_SRGB |
| 111 | {GL_RGBA4, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4_REV}, // R4G4B4A4U | 111 | {GL_RGBA4, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4_REV}, // A4B4G4R4_UNORM |
| 112 | {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR}, // ASTC_2D_4X4_SRGB | 112 | {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR}, // ASTC_2D_4X4_SRGB |
| 113 | {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR}, // ASTC_2D_8X8_SRGB | 113 | {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR}, // ASTC_2D_8X8_SRGB |
| 114 | {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR}, // ASTC_2D_8X5_SRGB | 114 | {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR}, // ASTC_2D_8X5_SRGB |
| 115 | {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR}, // ASTC_2D_5X4_SRGB | 115 | {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR}, // ASTC_2D_5X4_SRGB |
| 116 | {GL_COMPRESSED_RGBA_ASTC_5x5_KHR}, // ASTC_2D_5X5 | 116 | {GL_COMPRESSED_RGBA_ASTC_5x5_KHR}, // ASTC_2D_5X5_UNORM |
| 117 | {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR}, // ASTC_2D_5X5_SRGB | 117 | {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR}, // ASTC_2D_5X5_SRGB |
| 118 | {GL_COMPRESSED_RGBA_ASTC_10x8_KHR}, // ASTC_2D_10X8 | 118 | {GL_COMPRESSED_RGBA_ASTC_10x8_KHR}, // ASTC_2D_10X8_UNORM |
| 119 | {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR}, // ASTC_2D_10X8_SRGB | 119 | {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR}, // ASTC_2D_10X8_SRGB |
| 120 | {GL_COMPRESSED_RGBA_ASTC_6x6_KHR}, // ASTC_2D_6X6 | 120 | {GL_COMPRESSED_RGBA_ASTC_6x6_KHR}, // ASTC_2D_6X6_UNORM |
| 121 | {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR}, // ASTC_2D_6X6_SRGB | 121 | {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR}, // ASTC_2D_6X6_SRGB |
| 122 | {GL_COMPRESSED_RGBA_ASTC_10x10_KHR}, // ASTC_2D_10X10 | 122 | {GL_COMPRESSED_RGBA_ASTC_10x10_KHR}, // ASTC_2D_10X10_UNORM |
| 123 | {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR}, // ASTC_2D_10X10_SRGB | 123 | {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR}, // ASTC_2D_10X10_SRGB |
| 124 | {GL_COMPRESSED_RGBA_ASTC_12x12_KHR}, // ASTC_2D_12X12 | 124 | {GL_COMPRESSED_RGBA_ASTC_12x12_KHR}, // ASTC_2D_12X12_UNORM |
| 125 | {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}, // ASTC_2D_12X12_SRGB | 125 | {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}, // ASTC_2D_12X12_SRGB |
| 126 | {GL_COMPRESSED_RGBA_ASTC_8x6_KHR}, // ASTC_2D_8X6 | 126 | {GL_COMPRESSED_RGBA_ASTC_8x6_KHR}, // ASTC_2D_8X6_UNORM |
| 127 | {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR}, // ASTC_2D_8X6_SRGB | 127 | {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR}, // ASTC_2D_8X6_SRGB |
| 128 | {GL_COMPRESSED_RGBA_ASTC_6x5_KHR}, // ASTC_2D_6X5 | 128 | {GL_COMPRESSED_RGBA_ASTC_6x5_KHR}, // ASTC_2D_6X5_UNORM |
| 129 | {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR}, // ASTC_2D_6X5_SRGB | 129 | {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR}, // ASTC_2D_6X5_SRGB |
| 130 | {GL_RGB9_E5, GL_RGB, GL_UNSIGNED_INT_5_9_9_9_REV}, // E5B9G9R9F | 130 | {GL_RGB9_E5, GL_RGB, GL_UNSIGNED_INT_5_9_9_9_REV}, // E5B9G9R9_FLOAT |
| 131 | 131 | ||
| 132 | // Depth formats | 132 | // Depth formats |
| 133 | {GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT}, // Z32F | 133 | {GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT}, // D32_FLOAT |
| 134 | {GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT}, // Z16 | 134 | {GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT}, // D16_UNORM |
| 135 | 135 | ||
| 136 | // DepthStencil formats | 136 | // DepthStencil formats |
| 137 | {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8}, // Z24S8 | 137 | {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8}, // D24_UNORM_S8_UINT |
| 138 | {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8}, // S8Z24 | 138 | {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8}, // S8_UINT_D24_UNORM |
| 139 | {GL_DEPTH32F_STENCIL8, GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV}, // Z32FS8 | 139 | {GL_DEPTH32F_STENCIL8, GL_DEPTH_STENCIL, |
| 140 | GL_FLOAT_32_UNSIGNED_INT_24_8_REV}, // D32_FLOAT_S8_UINT | ||
| 140 | }}; | 141 | }}; |
| 141 | 142 | ||
| 142 | const FormatTuple& GetFormatTuple(PixelFormat pixel_format) { | 143 | const FormatTuple& GetFormatTuple(PixelFormat pixel_format) { |
| @@ -189,10 +190,10 @@ GLint GetSwizzleSource(SwizzleSource source) { | |||
| 189 | 190 | ||
| 190 | GLenum GetComponent(PixelFormat format, bool is_first) { | 191 | GLenum GetComponent(PixelFormat format, bool is_first) { |
| 191 | switch (format) { | 192 | switch (format) { |
| 192 | case PixelFormat::Z24S8: | 193 | case PixelFormat::D24_UNORM_S8_UINT: |
| 193 | case PixelFormat::Z32FS8: | 194 | case PixelFormat::D32_FLOAT_S8_UINT: |
| 194 | return is_first ? GL_DEPTH_COMPONENT : GL_STENCIL_INDEX; | 195 | return is_first ? GL_DEPTH_COMPONENT : GL_STENCIL_INDEX; |
| 195 | case PixelFormat::S8Z24: | 196 | case PixelFormat::S8_UINT_D24_UNORM: |
| 196 | return is_first ? GL_STENCIL_INDEX : GL_DEPTH_COMPONENT; | 197 | return is_first ? GL_STENCIL_INDEX : GL_DEPTH_COMPONENT; |
| 197 | default: | 198 | default: |
| 198 | UNREACHABLE(); | 199 | UNREACHABLE(); |
| @@ -493,9 +494,9 @@ GLuint CachedSurfaceView::GetTexture(SwizzleSource x_source, SwizzleSource y_sou | |||
| 493 | std::array swizzle{x_source, y_source, z_source, w_source}; | 494 | std::array swizzle{x_source, y_source, z_source, w_source}; |
| 494 | 495 | ||
| 495 | switch (const PixelFormat format = GetSurfaceParams().pixel_format) { | 496 | switch (const PixelFormat format = GetSurfaceParams().pixel_format) { |
| 496 | case PixelFormat::Z24S8: | 497 | case PixelFormat::D24_UNORM_S8_UINT: |
| 497 | case PixelFormat::Z32FS8: | 498 | case PixelFormat::D32_FLOAT_S8_UINT: |
| 498 | case PixelFormat::S8Z24: | 499 | case PixelFormat::S8_UINT_D24_UNORM: |
| 499 | UNIMPLEMENTED_IF(x_source != SwizzleSource::R && x_source != SwizzleSource::G); | 500 | UNIMPLEMENTED_IF(x_source != SwizzleSource::R && x_source != SwizzleSource::G); |
| 500 | glTextureParameteri(view.handle, GL_DEPTH_STENCIL_TEXTURE_MODE, | 501 | glTextureParameteri(view.handle, GL_DEPTH_STENCIL_TEXTURE_MODE, |
| 501 | GetComponent(format, x_source == SwizzleSource::R)); | 502 | GetComponent(format, x_source == SwizzleSource::R)); |
diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index e66cdc083..52e9e8250 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/src/video_core/renderer_opengl/renderer_opengl.cpp | |||
| @@ -535,12 +535,12 @@ void RendererOpenGL::ConfigureFramebufferTexture(TextureInfo& texture, | |||
| 535 | 535 | ||
| 536 | GLint internal_format; | 536 | GLint internal_format; |
| 537 | switch (framebuffer.pixel_format) { | 537 | switch (framebuffer.pixel_format) { |
| 538 | case Tegra::FramebufferConfig::PixelFormat::ABGR8: | 538 | case Tegra::FramebufferConfig::PixelFormat::A8B8G8R8_UNORM: |
| 539 | internal_format = GL_RGBA8; | 539 | internal_format = GL_RGBA8; |
| 540 | texture.gl_format = GL_RGBA; | 540 | texture.gl_format = GL_RGBA; |
| 541 | texture.gl_type = GL_UNSIGNED_INT_8_8_8_8_REV; | 541 | texture.gl_type = GL_UNSIGNED_INT_8_8_8_8_REV; |
| 542 | break; | 542 | break; |
| 543 | case Tegra::FramebufferConfig::PixelFormat::RGB565: | 543 | case Tegra::FramebufferConfig::PixelFormat::RGB565_UNORM: |
| 544 | internal_format = GL_RGB565; | 544 | internal_format = GL_RGB565; |
| 545 | texture.gl_format = GL_RGB; | 545 | texture.gl_format = GL_RGB; |
| 546 | texture.gl_type = GL_UNSIGNED_SHORT_5_6_5; | 546 | texture.gl_type = GL_UNSIGNED_SHORT_5_6_5; |
diff --git a/src/video_core/renderer_vulkan/maxwell_to_vk.cpp b/src/video_core/renderer_vulkan/maxwell_to_vk.cpp index 57c3822c2..f8c77f4fa 100644 --- a/src/video_core/renderer_vulkan/maxwell_to_vk.cpp +++ b/src/video_core/renderer_vulkan/maxwell_to_vk.cpp | |||
| @@ -117,101 +117,101 @@ struct FormatTuple { | |||
| 117 | VkFormat format; ///< Vulkan format | 117 | VkFormat format; ///< Vulkan format |
| 118 | int usage = 0; ///< Describes image format usage | 118 | int usage = 0; ///< Describes image format usage |
| 119 | } constexpr tex_format_tuples[] = { | 119 | } constexpr tex_format_tuples[] = { |
| 120 | {VK_FORMAT_A8B8G8R8_UNORM_PACK32, Attachable | Storage}, // ABGR8U | 120 | {VK_FORMAT_A8B8G8R8_UNORM_PACK32, Attachable | Storage}, // A8B8G8R8_UNORM |
| 121 | {VK_FORMAT_A8B8G8R8_SNORM_PACK32, Attachable | Storage}, // ABGR8S | 121 | {VK_FORMAT_A8B8G8R8_SNORM_PACK32, Attachable | Storage}, // A8B8G8R8_SNORM |
| 122 | {VK_FORMAT_A8B8G8R8_SINT_PACK32, Attachable | Storage}, // ABGR8I | 122 | {VK_FORMAT_A8B8G8R8_SINT_PACK32, Attachable | Storage}, // A8B8G8R8_SINT |
| 123 | {VK_FORMAT_A8B8G8R8_UINT_PACK32, Attachable | Storage}, // ABGR8UI | 123 | {VK_FORMAT_A8B8G8R8_UINT_PACK32, Attachable | Storage}, // A8B8G8R8_UINT |
| 124 | {VK_FORMAT_R5G6B5_UNORM_PACK16, Attachable}, // B5G6R5U | 124 | {VK_FORMAT_R5G6B5_UNORM_PACK16, Attachable}, // R5G6B5_UNORM |
| 125 | {VK_FORMAT_B5G6R5_UNORM_PACK16, Attachable}, // R5G6B5U | 125 | {VK_FORMAT_B5G6R5_UNORM_PACK16, Attachable}, // B5G6R5_UNORM |
| 126 | {VK_FORMAT_A1R5G5B5_UNORM_PACK16, Attachable}, // B5G5R5A1U | 126 | {VK_FORMAT_A1R5G5B5_UNORM_PACK16, Attachable}, // A1R5G5B5_UNORM |
| 127 | {VK_FORMAT_A2B10G10R10_UNORM_PACK32, Attachable | Storage}, // A2B10G10R10U | 127 | {VK_FORMAT_A2B10G10R10_UNORM_PACK32, Attachable | Storage}, // A2B10G10R10_UNORM |
| 128 | {VK_FORMAT_A2B10G10R10_UINT_PACK32, Attachable | Storage}, // A2B10G10R10UI | 128 | {VK_FORMAT_A2B10G10R10_UINT_PACK32, Attachable | Storage}, // A2B10G10R10_UINT |
| 129 | {VK_FORMAT_A1R5G5B5_UNORM_PACK16, Attachable}, // A1B5G5R5U (flipped with swizzle) | 129 | {VK_FORMAT_A1R5G5B5_UNORM_PACK16, Attachable}, // A1B5G5R5_UNORM (flipped with swizzle) |
| 130 | {VK_FORMAT_R8_UNORM, Attachable | Storage}, // R8U | 130 | {VK_FORMAT_R8_UNORM, Attachable | Storage}, // R8_UNORM |
| 131 | {VK_FORMAT_R8_SNORM, Attachable | Storage}, // R8S | 131 | {VK_FORMAT_R8_SNORM, Attachable | Storage}, // R8_SNORM |
| 132 | {VK_FORMAT_R8_SINT, Attachable | Storage}, // R8I | 132 | {VK_FORMAT_R8_SINT, Attachable | Storage}, // R8_SINT |
| 133 | {VK_FORMAT_R8_UINT, Attachable | Storage}, // R8UI | 133 | {VK_FORMAT_R8_UINT, Attachable | Storage}, // R8_UINT |
| 134 | {VK_FORMAT_R16G16B16A16_SFLOAT, Attachable | Storage}, // RGBA16F | 134 | {VK_FORMAT_R16G16B16A16_SFLOAT, Attachable | Storage}, // R16G16B16A16_FLOAT |
| 135 | {VK_FORMAT_R16G16B16A16_UNORM, Attachable | Storage}, // RGBA16U | 135 | {VK_FORMAT_R16G16B16A16_UNORM, Attachable | Storage}, // R16G16B16A16_UNORM |
| 136 | {VK_FORMAT_R16G16B16A16_SNORM, Attachable | Storage}, // RGBA16S | 136 | {VK_FORMAT_R16G16B16A16_SNORM, Attachable | Storage}, // R16G16B16A16_SNORM |
| 137 | {VK_FORMAT_R16G16B16A16_SINT, Attachable | Storage}, // RGBA16I | 137 | {VK_FORMAT_R16G16B16A16_SINT, Attachable | Storage}, // R16G16B16A16_SINT |
| 138 | {VK_FORMAT_R16G16B16A16_UINT, Attachable | Storage}, // RGBA16UI | 138 | {VK_FORMAT_R16G16B16A16_UINT, Attachable | Storage}, // R16G16B16A16_UINT |
| 139 | {VK_FORMAT_B10G11R11_UFLOAT_PACK32, Attachable | Storage}, // R11FG11FB10F | 139 | {VK_FORMAT_B10G11R11_UFLOAT_PACK32, Attachable | Storage}, // B10G11R11_FLOAT |
| 140 | {VK_FORMAT_R32G32B32A32_UINT, Attachable | Storage}, // RGBA32UI | 140 | {VK_FORMAT_R32G32B32A32_UINT, Attachable | Storage}, // R32G32B32A32_UINT |
| 141 | {VK_FORMAT_BC1_RGBA_UNORM_BLOCK}, // DXT1 | 141 | {VK_FORMAT_BC1_RGBA_UNORM_BLOCK}, // BC1_RGBA_UNORM |
| 142 | {VK_FORMAT_BC2_UNORM_BLOCK}, // DXT23 | 142 | {VK_FORMAT_BC2_UNORM_BLOCK}, // BC2_UNORM |
| 143 | {VK_FORMAT_BC3_UNORM_BLOCK}, // DXT45 | 143 | {VK_FORMAT_BC3_UNORM_BLOCK}, // BC3_UNORM |
| 144 | {VK_FORMAT_BC4_UNORM_BLOCK}, // DXN1UNORM | 144 | {VK_FORMAT_BC4_UNORM_BLOCK}, // BC4_UNORM |
| 145 | {VK_FORMAT_BC4_SNORM_BLOCK}, // DXN1SNORM | 145 | {VK_FORMAT_BC4_SNORM_BLOCK}, // BC4_SNORM |
| 146 | {VK_FORMAT_BC5_UNORM_BLOCK}, // DXN2UNORM | 146 | {VK_FORMAT_BC5_UNORM_BLOCK}, // BC5_UNORM |
| 147 | {VK_FORMAT_BC5_SNORM_BLOCK}, // DXN2SNORM | 147 | {VK_FORMAT_BC5_SNORM_BLOCK}, // BC5_SNORM |
| 148 | {VK_FORMAT_BC7_UNORM_BLOCK}, // BC7U | 148 | {VK_FORMAT_BC7_UNORM_BLOCK}, // BC7_UNORM |
| 149 | {VK_FORMAT_BC6H_UFLOAT_BLOCK}, // BC6H_UF16 | 149 | {VK_FORMAT_BC6H_UFLOAT_BLOCK}, // BC6H_UFLOAT |
| 150 | {VK_FORMAT_BC6H_SFLOAT_BLOCK}, // BC6H_SF16 | 150 | {VK_FORMAT_BC6H_SFLOAT_BLOCK}, // BC6H_SFLOAT |
| 151 | {VK_FORMAT_ASTC_4x4_UNORM_BLOCK}, // ASTC_2D_4X4 | 151 | {VK_FORMAT_ASTC_4x4_UNORM_BLOCK}, // ASTC_2D_4X4_UNORM |
| 152 | {VK_FORMAT_B8G8R8A8_UNORM, Attachable}, // BGRA8 | 152 | {VK_FORMAT_B8G8R8A8_UNORM, Attachable}, // B8G8R8A8_UNORM |
| 153 | {VK_FORMAT_R32G32B32A32_SFLOAT, Attachable | Storage}, // RGBA32F | 153 | {VK_FORMAT_R32G32B32A32_SFLOAT, Attachable | Storage}, // R32G32B32A32_FLOAT |
| 154 | {VK_FORMAT_R32G32B32A32_SINT, Attachable | Storage}, // RGBA32I | 154 | {VK_FORMAT_R32G32B32A32_SINT, Attachable | Storage}, // R32G32B32A32_SINT |
| 155 | {VK_FORMAT_R32G32_SFLOAT, Attachable | Storage}, // RG32F | 155 | {VK_FORMAT_R32G32_SFLOAT, Attachable | Storage}, // R32G32_FLOAT |
| 156 | {VK_FORMAT_R32G32_SINT, Attachable | Storage}, // RG32I | 156 | {VK_FORMAT_R32G32_SINT, Attachable | Storage}, // R32G32_SINT |
| 157 | {VK_FORMAT_R32_SFLOAT, Attachable | Storage}, // R32F | 157 | {VK_FORMAT_R32_SFLOAT, Attachable | Storage}, // R32_FLOAT |
| 158 | {VK_FORMAT_R16_SFLOAT, Attachable | Storage}, // R16F | 158 | {VK_FORMAT_R16_SFLOAT, Attachable | Storage}, // R16_FLOAT |
| 159 | {VK_FORMAT_R16_UNORM, Attachable | Storage}, // R16U | 159 | {VK_FORMAT_R16_UNORM, Attachable | Storage}, // R16_UNORM |
| 160 | {VK_FORMAT_UNDEFINED}, // R16S | 160 | {VK_FORMAT_UNDEFINED}, // R16_SNORM |
| 161 | {VK_FORMAT_R16_UINT, Attachable | Storage}, // R16UI | 161 | {VK_FORMAT_R16_UINT, Attachable | Storage}, // R16_UINT |
| 162 | {VK_FORMAT_UNDEFINED}, // R16I | 162 | {VK_FORMAT_UNDEFINED}, // R16_SINT |
| 163 | {VK_FORMAT_R16G16_UNORM, Attachable | Storage}, // RG16 | 163 | {VK_FORMAT_R16G16_UNORM, Attachable | Storage}, // R16G16_UNORM |
| 164 | {VK_FORMAT_R16G16_SFLOAT, Attachable | Storage}, // RG16F | 164 | {VK_FORMAT_R16G16_SFLOAT, Attachable | Storage}, // R16G16_FLOAT |
| 165 | {VK_FORMAT_UNDEFINED}, // RG16UI | 165 | {VK_FORMAT_UNDEFINED}, // R16G16_UINT |
| 166 | {VK_FORMAT_UNDEFINED}, // RG16I | 166 | {VK_FORMAT_UNDEFINED}, // R16G16_SINT |
| 167 | {VK_FORMAT_R16G16_SNORM, Attachable | Storage}, // RG16S | 167 | {VK_FORMAT_R16G16_SNORM, Attachable | Storage}, // R16G16_SNORM |
| 168 | {VK_FORMAT_UNDEFINED}, // RGB32F | 168 | {VK_FORMAT_UNDEFINED}, // R32G32B32_FLOAT |
| 169 | {VK_FORMAT_R8G8B8A8_SRGB, Attachable}, // RGBA8_SRGB | 169 | {VK_FORMAT_R8G8B8A8_SRGB, Attachable}, // A8B8G8R8_SRGB |
| 170 | {VK_FORMAT_R8G8_UNORM, Attachable | Storage}, // RG8U | 170 | {VK_FORMAT_R8G8_UNORM, Attachable | Storage}, // R8G8_UNORM |
| 171 | {VK_FORMAT_R8G8_SNORM, Attachable | Storage}, // RG8S | 171 | {VK_FORMAT_R8G8_SNORM, Attachable | Storage}, // R8G8_SNORM |
| 172 | {VK_FORMAT_R8G8_SINT, Attachable | Storage}, // RG8I | 172 | {VK_FORMAT_R8G8_SINT, Attachable | Storage}, // R8G8_SINT |
| 173 | {VK_FORMAT_R8G8_UINT, Attachable | Storage}, // RG8UI | 173 | {VK_FORMAT_R8G8_UINT, Attachable | Storage}, // R8G8_UINT |
| 174 | {VK_FORMAT_R32G32_UINT, Attachable | Storage}, // RG32UI | 174 | {VK_FORMAT_R32G32_UINT, Attachable | Storage}, // R32G32_UINT |
| 175 | {VK_FORMAT_UNDEFINED}, // RGBX16F | 175 | {VK_FORMAT_UNDEFINED}, // R16G16B16X16_FLOAT |
| 176 | {VK_FORMAT_R32_UINT, Attachable | Storage}, // R32UI | 176 | {VK_FORMAT_R32_UINT, Attachable | Storage}, // R32_UINT |
| 177 | {VK_FORMAT_R32_SINT, Attachable | Storage}, // R32I | 177 | {VK_FORMAT_R32_SINT, Attachable | Storage}, // R32_SINT |
| 178 | {VK_FORMAT_ASTC_8x8_UNORM_BLOCK}, // ASTC_2D_8X8 | 178 | {VK_FORMAT_ASTC_8x8_UNORM_BLOCK}, // ASTC_2D_8X8_UNORM |
| 179 | {VK_FORMAT_UNDEFINED}, // ASTC_2D_8X5 | 179 | {VK_FORMAT_UNDEFINED}, // ASTC_2D_8X5_UNORM |
| 180 | {VK_FORMAT_UNDEFINED}, // ASTC_2D_5X4 | 180 | {VK_FORMAT_UNDEFINED}, // ASTC_2D_5X4_UNORM |
| 181 | {VK_FORMAT_B8G8R8A8_SRGB, Attachable}, // BGRA8_SRGB | 181 | {VK_FORMAT_B8G8R8A8_SRGB, Attachable}, // B8G8R8A8_SRGB |
| 182 | {VK_FORMAT_BC1_RGBA_SRGB_BLOCK}, // DXT1_SRGB | 182 | {VK_FORMAT_BC1_RGBA_SRGB_BLOCK}, // BC1_RGBA_SRGB |
| 183 | {VK_FORMAT_BC2_SRGB_BLOCK}, // DXT23_SRGB | 183 | {VK_FORMAT_BC2_SRGB_BLOCK}, // BC2_SRGB |
| 184 | {VK_FORMAT_BC3_SRGB_BLOCK}, // DXT45_SRGB | 184 | {VK_FORMAT_BC3_SRGB_BLOCK}, // BC3_SRGB |
| 185 | {VK_FORMAT_BC7_SRGB_BLOCK}, // BC7U_SRGB | 185 | {VK_FORMAT_BC7_SRGB_BLOCK}, // BC7_SRGB |
| 186 | {VK_FORMAT_R4G4B4A4_UNORM_PACK16, Attachable}, // R4G4B4A4U | 186 | {VK_FORMAT_R4G4B4A4_UNORM_PACK16, Attachable}, // A4B4G4R4_UNORM |
| 187 | {VK_FORMAT_ASTC_4x4_SRGB_BLOCK}, // ASTC_2D_4X4_SRGB | 187 | {VK_FORMAT_ASTC_4x4_SRGB_BLOCK}, // ASTC_2D_4X4_SRGB |
| 188 | {VK_FORMAT_ASTC_8x8_SRGB_BLOCK}, // ASTC_2D_8X8_SRGB | 188 | {VK_FORMAT_ASTC_8x8_SRGB_BLOCK}, // ASTC_2D_8X8_SRGB |
| 189 | {VK_FORMAT_ASTC_8x5_SRGB_BLOCK}, // ASTC_2D_8X5_SRGB | 189 | {VK_FORMAT_ASTC_8x5_SRGB_BLOCK}, // ASTC_2D_8X5_SRGB |
| 190 | {VK_FORMAT_ASTC_5x4_SRGB_BLOCK}, // ASTC_2D_5X4_SRGB | 190 | {VK_FORMAT_ASTC_5x4_SRGB_BLOCK}, // ASTC_2D_5X4_SRGB |
| 191 | {VK_FORMAT_ASTC_5x5_UNORM_BLOCK}, // ASTC_2D_5X5 | 191 | {VK_FORMAT_ASTC_5x5_UNORM_BLOCK}, // ASTC_2D_5X5_UNORM |
| 192 | {VK_FORMAT_ASTC_5x5_SRGB_BLOCK}, // ASTC_2D_5X5_SRGB | 192 | {VK_FORMAT_ASTC_5x5_SRGB_BLOCK}, // ASTC_2D_5X5_SRGB |
| 193 | {VK_FORMAT_ASTC_10x8_UNORM_BLOCK}, // ASTC_2D_10X8 | 193 | {VK_FORMAT_ASTC_10x8_UNORM_BLOCK}, // ASTC_2D_10X8_UNORM |
| 194 | {VK_FORMAT_ASTC_10x8_SRGB_BLOCK}, // ASTC_2D_10X8_SRGB | 194 | {VK_FORMAT_ASTC_10x8_SRGB_BLOCK}, // ASTC_2D_10X8_SRGB |
| 195 | {VK_FORMAT_ASTC_6x6_UNORM_BLOCK}, // ASTC_2D_6X6 | 195 | {VK_FORMAT_ASTC_6x6_UNORM_BLOCK}, // ASTC_2D_6X6_UNORM |
| 196 | {VK_FORMAT_ASTC_6x6_SRGB_BLOCK}, // ASTC_2D_6X6_SRGB | 196 | {VK_FORMAT_ASTC_6x6_SRGB_BLOCK}, // ASTC_2D_6X6_SRGB |
| 197 | {VK_FORMAT_ASTC_10x10_UNORM_BLOCK}, // ASTC_2D_10X10 | 197 | {VK_FORMAT_ASTC_10x10_UNORM_BLOCK}, // ASTC_2D_10X10_UNORM |
| 198 | {VK_FORMAT_ASTC_10x10_SRGB_BLOCK}, // ASTC_2D_10X10_SRGB | 198 | {VK_FORMAT_ASTC_10x10_SRGB_BLOCK}, // ASTC_2D_10X10_SRGB |
| 199 | {VK_FORMAT_ASTC_12x12_UNORM_BLOCK}, // ASTC_2D_12X12 | 199 | {VK_FORMAT_ASTC_12x12_UNORM_BLOCK}, // ASTC_2D_12X12_UNORM |
| 200 | {VK_FORMAT_ASTC_12x12_SRGB_BLOCK}, // ASTC_2D_12X12_SRGB | 200 | {VK_FORMAT_ASTC_12x12_SRGB_BLOCK}, // ASTC_2D_12X12_SRGB |
| 201 | {VK_FORMAT_ASTC_8x6_UNORM_BLOCK}, // ASTC_2D_8X6 | 201 | {VK_FORMAT_ASTC_8x6_UNORM_BLOCK}, // ASTC_2D_8X6_UNORM |
| 202 | {VK_FORMAT_ASTC_8x6_SRGB_BLOCK}, // ASTC_2D_8X6_SRGB | 202 | {VK_FORMAT_ASTC_8x6_SRGB_BLOCK}, // ASTC_2D_8X6_SRGB |
| 203 | {VK_FORMAT_ASTC_6x5_UNORM_BLOCK}, // ASTC_2D_6X5 | 203 | {VK_FORMAT_ASTC_6x5_UNORM_BLOCK}, // ASTC_2D_6X5_UNORM |
| 204 | {VK_FORMAT_ASTC_6x5_SRGB_BLOCK}, // ASTC_2D_6X5_SRGB | 204 | {VK_FORMAT_ASTC_6x5_SRGB_BLOCK}, // ASTC_2D_6X5_SRGB |
| 205 | {VK_FORMAT_E5B9G9R9_UFLOAT_PACK32}, // E5B9G9R9F | 205 | {VK_FORMAT_E5B9G9R9_UFLOAT_PACK32}, // E5B9G9R9_FLOAT |
| 206 | 206 | ||
| 207 | // Depth formats | 207 | // Depth formats |
| 208 | {VK_FORMAT_D32_SFLOAT, Attachable}, // Z32F | 208 | {VK_FORMAT_D32_SFLOAT, Attachable}, // D32_FLOAT |
| 209 | {VK_FORMAT_D16_UNORM, Attachable}, // Z16 | 209 | {VK_FORMAT_D16_UNORM, Attachable}, // D16_UNORM |
| 210 | 210 | ||
| 211 | // DepthStencil formats | 211 | // DepthStencil formats |
| 212 | {VK_FORMAT_D24_UNORM_S8_UINT, Attachable}, // Z24S8 | 212 | {VK_FORMAT_D24_UNORM_S8_UINT, Attachable}, // D24_UNORM_S8_UINT |
| 213 | {VK_FORMAT_D24_UNORM_S8_UINT, Attachable}, // S8Z24 (emulated) | 213 | {VK_FORMAT_D24_UNORM_S8_UINT, Attachable}, // S8_UINT_D24_UNORM (emulated) |
| 214 | {VK_FORMAT_D32_SFLOAT_S8_UINT, Attachable}, // Z32FS8 | 214 | {VK_FORMAT_D32_SFLOAT_S8_UINT, Attachable}, // D32_FLOAT_S8_UINT |
| 215 | }; | 215 | }; |
| 216 | static_assert(std::size(tex_format_tuples) == VideoCore::Surface::MaxPixelFormat); | 216 | static_assert(std::size(tex_format_tuples) == VideoCore::Surface::MaxPixelFormat); |
| 217 | 217 | ||
| @@ -232,7 +232,7 @@ FormatInfo SurfaceFormat(const VKDevice& device, FormatType format_type, PixelFo | |||
| 232 | return {VK_FORMAT_A8B8G8R8_UNORM_PACK32, true, true}; | 232 | return {VK_FORMAT_A8B8G8R8_UNORM_PACK32, true, true}; |
| 233 | } | 233 | } |
| 234 | 234 | ||
| 235 | // Use ABGR8 on hardware that doesn't support ASTC natively | 235 | // Use A8B8G8R8_UNORM on hardware that doesn't support ASTC natively |
| 236 | if (!device.IsOptimalAstcSupported() && VideoCore::Surface::IsPixelFormatASTC(pixel_format)) { | 236 | if (!device.IsOptimalAstcSupported() && VideoCore::Surface::IsPixelFormatASTC(pixel_format)) { |
| 237 | tuple.format = VideoCore::Surface::IsPixelFormatSRGB(pixel_format) | 237 | tuple.format = VideoCore::Surface::IsPixelFormatSRGB(pixel_format) |
| 238 | ? VK_FORMAT_A8B8G8R8_SRGB_PACK32 | 238 | ? VK_FORMAT_A8B8G8R8_SRGB_PACK32 |
diff --git a/src/video_core/renderer_vulkan/vk_blit_screen.cpp b/src/video_core/renderer_vulkan/vk_blit_screen.cpp index fbd406f2b..be175a829 100644 --- a/src/video_core/renderer_vulkan/vk_blit_screen.cpp +++ b/src/video_core/renderer_vulkan/vk_blit_screen.cpp | |||
| @@ -183,9 +183,9 @@ std::size_t GetSizeInBytes(const Tegra::FramebufferConfig& framebuffer) { | |||
| 183 | 183 | ||
| 184 | VkFormat GetFormat(const Tegra::FramebufferConfig& framebuffer) { | 184 | VkFormat GetFormat(const Tegra::FramebufferConfig& framebuffer) { |
| 185 | switch (framebuffer.pixel_format) { | 185 | switch (framebuffer.pixel_format) { |
| 186 | case Tegra::FramebufferConfig::PixelFormat::ABGR8: | 186 | case Tegra::FramebufferConfig::PixelFormat::A8B8G8R8_UNORM: |
| 187 | return VK_FORMAT_A8B8G8R8_UNORM_PACK32; | 187 | return VK_FORMAT_A8B8G8R8_UNORM_PACK32; |
| 188 | case Tegra::FramebufferConfig::PixelFormat::RGB565: | 188 | case Tegra::FramebufferConfig::PixelFormat::RGB565_UNORM: |
| 189 | return VK_FORMAT_R5G6B5_UNORM_PACK16; | 189 | return VK_FORMAT_R5G6B5_UNORM_PACK16; |
| 190 | default: | 190 | default: |
| 191 | UNIMPLEMENTED_MSG("Unknown framebuffer pixel format: {}", | 191 | UNIMPLEMENTED_MSG("Unknown framebuffer pixel format: {}", |
diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.cpp b/src/video_core/renderer_vulkan/vk_texture_cache.cpp index 430031665..29c53a5fa 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_texture_cache.cpp | |||
| @@ -233,7 +233,7 @@ void CachedSurface::UploadTexture(const std::vector<u8>& staging_buffer) { | |||
| 233 | void CachedSurface::DownloadTexture(std::vector<u8>& staging_buffer) { | 233 | void CachedSurface::DownloadTexture(std::vector<u8>& staging_buffer) { |
| 234 | UNIMPLEMENTED_IF(params.IsBuffer()); | 234 | UNIMPLEMENTED_IF(params.IsBuffer()); |
| 235 | 235 | ||
| 236 | if (params.pixel_format == VideoCore::Surface::PixelFormat::A1B5G5R5U) { | 236 | if (params.pixel_format == VideoCore::Surface::PixelFormat::A1B5G5R5_UNORM) { |
| 237 | LOG_WARNING(Render_Vulkan, "A1B5G5R5 flushing is stubbed"); | 237 | LOG_WARNING(Render_Vulkan, "A1B5G5R5 flushing is stubbed"); |
| 238 | } | 238 | } |
| 239 | 239 | ||
| @@ -382,7 +382,7 @@ VkImageView CachedSurfaceView::GetImageView(SwizzleSource x_source, SwizzleSourc | |||
| 382 | 382 | ||
| 383 | std::array swizzle{MaxwellToVK::SwizzleSource(x_source), MaxwellToVK::SwizzleSource(y_source), | 383 | std::array swizzle{MaxwellToVK::SwizzleSource(x_source), MaxwellToVK::SwizzleSource(y_source), |
| 384 | MaxwellToVK::SwizzleSource(z_source), MaxwellToVK::SwizzleSource(w_source)}; | 384 | MaxwellToVK::SwizzleSource(z_source), MaxwellToVK::SwizzleSource(w_source)}; |
| 385 | if (params.pixel_format == VideoCore::Surface::PixelFormat::A1B5G5R5U) { | 385 | if (params.pixel_format == VideoCore::Surface::PixelFormat::A1B5G5R5_UNORM) { |
| 386 | // A1B5G5R5 is implemented as A1R5G5B5, we have to change the swizzle here. | 386 | // A1B5G5R5 is implemented as A1R5G5B5, we have to change the swizzle here. |
| 387 | std::swap(swizzle[0], swizzle[2]); | 387 | std::swap(swizzle[0], swizzle[2]); |
| 388 | } | 388 | } |
| @@ -394,11 +394,11 @@ VkImageView CachedSurfaceView::GetImageView(SwizzleSource x_source, SwizzleSourc | |||
| 394 | UNIMPLEMENTED_IF(x_source != SwizzleSource::R && x_source != SwizzleSource::G); | 394 | UNIMPLEMENTED_IF(x_source != SwizzleSource::R && x_source != SwizzleSource::G); |
| 395 | const bool is_first = x_source == SwizzleSource::R; | 395 | const bool is_first = x_source == SwizzleSource::R; |
| 396 | switch (params.pixel_format) { | 396 | switch (params.pixel_format) { |
| 397 | case VideoCore::Surface::PixelFormat::Z24S8: | 397 | case VideoCore::Surface::PixelFormat::D24_UNORM_S8_UINT: |
| 398 | case VideoCore::Surface::PixelFormat::Z32FS8: | 398 | case VideoCore::Surface::PixelFormat::D32_FLOAT_S8_UINT: |
| 399 | aspect = is_first ? VK_IMAGE_ASPECT_DEPTH_BIT : VK_IMAGE_ASPECT_STENCIL_BIT; | 399 | aspect = is_first ? VK_IMAGE_ASPECT_DEPTH_BIT : VK_IMAGE_ASPECT_STENCIL_BIT; |
| 400 | break; | 400 | break; |
| 401 | case VideoCore::Surface::PixelFormat::S8Z24: | 401 | case VideoCore::Surface::PixelFormat::S8_UINT_D24_UNORM: |
| 402 | aspect = is_first ? VK_IMAGE_ASPECT_STENCIL_BIT : VK_IMAGE_ASPECT_DEPTH_BIT; | 402 | aspect = is_first ? VK_IMAGE_ASPECT_STENCIL_BIT : VK_IMAGE_ASPECT_DEPTH_BIT; |
| 403 | break; | 403 | break; |
| 404 | default: | 404 | default: |
diff --git a/src/video_core/shader/decode/image.cpp b/src/video_core/shader/decode/image.cpp index 07778dc3e..e75ca4fdb 100644 --- a/src/video_core/shader/decode/image.cpp +++ b/src/video_core/shader/decode/image.cpp | |||
| @@ -31,11 +31,11 @@ ComponentType GetComponentType(Tegra::Engines::SamplerDescriptor descriptor, | |||
| 31 | std::size_t component) { | 31 | std::size_t component) { |
| 32 | const TextureFormat format{descriptor.format}; | 32 | const TextureFormat format{descriptor.format}; |
| 33 | switch (format) { | 33 | switch (format) { |
| 34 | case TextureFormat::R16_G16_B16_A16: | 34 | case TextureFormat::R16G16B16A16: |
| 35 | case TextureFormat::R32_G32_B32_A32: | 35 | case TextureFormat::R32G32B32A32: |
| 36 | case TextureFormat::R32_G32_B32: | 36 | case TextureFormat::R32G32B32: |
| 37 | case TextureFormat::R32_G32: | 37 | case TextureFormat::R32G32: |
| 38 | case TextureFormat::R16_G16: | 38 | case TextureFormat::R16G16: |
| 39 | case TextureFormat::R32: | 39 | case TextureFormat::R32: |
| 40 | case TextureFormat::R16: | 40 | case TextureFormat::R16: |
| 41 | case TextureFormat::R8: | 41 | case TextureFormat::R8: |
| @@ -97,7 +97,7 @@ ComponentType GetComponentType(Tegra::Engines::SamplerDescriptor descriptor, | |||
| 97 | break; | 97 | break; |
| 98 | case TextureFormat::B5G6R5: | 98 | case TextureFormat::B5G6R5: |
| 99 | case TextureFormat::B6G5R5: | 99 | case TextureFormat::B6G5R5: |
| 100 | case TextureFormat::BF10GF11RF11: | 100 | case TextureFormat::B10G11R11: |
| 101 | if (component == 0) { | 101 | if (component == 0) { |
| 102 | return descriptor.b_type; | 102 | return descriptor.b_type; |
| 103 | } | 103 | } |
| @@ -108,9 +108,9 @@ ComponentType GetComponentType(Tegra::Engines::SamplerDescriptor descriptor, | |||
| 108 | return descriptor.r_type; | 108 | return descriptor.r_type; |
| 109 | } | 109 | } |
| 110 | break; | 110 | break; |
| 111 | case TextureFormat::G8R24: | 111 | case TextureFormat::R24G8: |
| 112 | case TextureFormat::G24R8: | 112 | case TextureFormat::R8G24: |
| 113 | case TextureFormat::G8R8: | 113 | case TextureFormat::R8G8: |
| 114 | case TextureFormat::G4R4: | 114 | case TextureFormat::G4R4: |
| 115 | if (component == 0) { | 115 | if (component == 0) { |
| 116 | return descriptor.g_type; | 116 | return descriptor.g_type; |
| @@ -137,15 +137,15 @@ bool IsComponentEnabled(std::size_t component_mask, std::size_t component) { | |||
| 137 | 137 | ||
| 138 | u32 GetComponentSize(TextureFormat format, std::size_t component) { | 138 | u32 GetComponentSize(TextureFormat format, std::size_t component) { |
| 139 | switch (format) { | 139 | switch (format) { |
| 140 | case TextureFormat::R32_G32_B32_A32: | 140 | case TextureFormat::R32G32B32A32: |
| 141 | return 32; | 141 | return 32; |
| 142 | case TextureFormat::R16_G16_B16_A16: | 142 | case TextureFormat::R16G16B16A16: |
| 143 | return 16; | 143 | return 16; |
| 144 | case TextureFormat::R32_G32_B32: | 144 | case TextureFormat::R32G32B32: |
| 145 | return component <= 2 ? 32 : 0; | 145 | return component <= 2 ? 32 : 0; |
| 146 | case TextureFormat::R32_G32: | 146 | case TextureFormat::R32G32: |
| 147 | return component <= 1 ? 32 : 0; | 147 | return component <= 1 ? 32 : 0; |
| 148 | case TextureFormat::R16_G16: | 148 | case TextureFormat::R16G16: |
| 149 | return component <= 1 ? 16 : 0; | 149 | return component <= 1 ? 16 : 0; |
| 150 | case TextureFormat::R32: | 150 | case TextureFormat::R32: |
| 151 | return component == 0 ? 32 : 0; | 151 | return component == 0 ? 32 : 0; |
| @@ -192,7 +192,7 @@ u32 GetComponentSize(TextureFormat format, std::size_t component) { | |||
| 192 | return 6; | 192 | return 6; |
| 193 | } | 193 | } |
| 194 | return 0; | 194 | return 0; |
| 195 | case TextureFormat::BF10GF11RF11: | 195 | case TextureFormat::B10G11R11: |
| 196 | if (component == 1 || component == 2) { | 196 | if (component == 1 || component == 2) { |
| 197 | return 11; | 197 | return 11; |
| 198 | } | 198 | } |
| @@ -200,7 +200,7 @@ u32 GetComponentSize(TextureFormat format, std::size_t component) { | |||
| 200 | return 10; | 200 | return 10; |
| 201 | } | 201 | } |
| 202 | return 0; | 202 | return 0; |
| 203 | case TextureFormat::G8R24: | 203 | case TextureFormat::R24G8: |
| 204 | if (component == 0) { | 204 | if (component == 0) { |
| 205 | return 8; | 205 | return 8; |
| 206 | } | 206 | } |
| @@ -208,7 +208,7 @@ u32 GetComponentSize(TextureFormat format, std::size_t component) { | |||
| 208 | return 24; | 208 | return 24; |
| 209 | } | 209 | } |
| 210 | return 0; | 210 | return 0; |
| 211 | case TextureFormat::G24R8: | 211 | case TextureFormat::R8G24: |
| 212 | if (component == 0) { | 212 | if (component == 0) { |
| 213 | return 8; | 213 | return 8; |
| 214 | } | 214 | } |
| @@ -216,7 +216,7 @@ u32 GetComponentSize(TextureFormat format, std::size_t component) { | |||
| 216 | return 24; | 216 | return 24; |
| 217 | } | 217 | } |
| 218 | return 0; | 218 | return 0; |
| 219 | case TextureFormat::G8R8: | 219 | case TextureFormat::R8G8: |
| 220 | return (component == 0 || component == 1) ? 8 : 0; | 220 | return (component == 0 || component == 1) ? 8 : 0; |
| 221 | case TextureFormat::G4R4: | 221 | case TextureFormat::G4R4: |
| 222 | return (component == 0 || component == 1) ? 4 : 0; | 222 | return (component == 0 || component == 1) ? 4 : 0; |
| @@ -231,25 +231,25 @@ std::size_t GetImageComponentMask(TextureFormat format) { | |||
| 231 | constexpr u8 B = 0b0100; | 231 | constexpr u8 B = 0b0100; |
| 232 | constexpr u8 A = 0b1000; | 232 | constexpr u8 A = 0b1000; |
| 233 | switch (format) { | 233 | switch (format) { |
| 234 | case TextureFormat::R32_G32_B32_A32: | 234 | case TextureFormat::R32G32B32A32: |
| 235 | case TextureFormat::R16_G16_B16_A16: | 235 | case TextureFormat::R16G16B16A16: |
| 236 | case TextureFormat::A8R8G8B8: | 236 | case TextureFormat::A8R8G8B8: |
| 237 | case TextureFormat::A2B10G10R10: | 237 | case TextureFormat::A2B10G10R10: |
| 238 | case TextureFormat::A4B4G4R4: | 238 | case TextureFormat::A4B4G4R4: |
| 239 | case TextureFormat::A5B5G5R1: | 239 | case TextureFormat::A5B5G5R1: |
| 240 | case TextureFormat::A1B5G5R5: | 240 | case TextureFormat::A1B5G5R5: |
| 241 | return std::size_t{R | G | B | A}; | 241 | return std::size_t{R | G | B | A}; |
| 242 | case TextureFormat::R32_G32_B32: | 242 | case TextureFormat::R32G32B32: |
| 243 | case TextureFormat::R32_B24G8: | 243 | case TextureFormat::R32_B24G8: |
| 244 | case TextureFormat::B5G6R5: | 244 | case TextureFormat::B5G6R5: |
| 245 | case TextureFormat::B6G5R5: | 245 | case TextureFormat::B6G5R5: |
| 246 | case TextureFormat::BF10GF11RF11: | 246 | case TextureFormat::B10G11R11: |
| 247 | return std::size_t{R | G | B}; | 247 | return std::size_t{R | G | B}; |
| 248 | case TextureFormat::R32_G32: | 248 | case TextureFormat::R32G32: |
| 249 | case TextureFormat::R16_G16: | 249 | case TextureFormat::R16G16: |
| 250 | case TextureFormat::G8R24: | 250 | case TextureFormat::R24G8: |
| 251 | case TextureFormat::G24R8: | 251 | case TextureFormat::R8G24: |
| 252 | case TextureFormat::G8R8: | 252 | case TextureFormat::R8G8: |
| 253 | case TextureFormat::G4R4: | 253 | case TextureFormat::G4R4: |
| 254 | return std::size_t{R | G}; | 254 | return std::size_t{R | G}; |
| 255 | case TextureFormat::R32: | 255 | case TextureFormat::R32: |
diff --git a/src/video_core/surface.cpp b/src/video_core/surface.cpp index 492ab6215..1688267bb 100644 --- a/src/video_core/surface.cpp +++ b/src/video_core/surface.cpp | |||
| @@ -74,131 +74,131 @@ bool SurfaceTargetIsArray(SurfaceTarget target) { | |||
| 74 | 74 | ||
| 75 | PixelFormat PixelFormatFromDepthFormat(Tegra::DepthFormat format) { | 75 | PixelFormat PixelFormatFromDepthFormat(Tegra::DepthFormat format) { |
| 76 | switch (format) { | 76 | switch (format) { |
| 77 | case Tegra::DepthFormat::S8_Z24_UNORM: | 77 | case Tegra::DepthFormat::S8_UINT_Z24_UNORM: |
| 78 | return PixelFormat::S8Z24; | 78 | return PixelFormat::S8_UINT_D24_UNORM; |
| 79 | case Tegra::DepthFormat::Z24_S8_UNORM: | 79 | case Tegra::DepthFormat::D24S8_UNORM: |
| 80 | return PixelFormat::Z24S8; | 80 | return PixelFormat::D24_UNORM_S8_UINT; |
| 81 | case Tegra::DepthFormat::Z32_FLOAT: | 81 | case Tegra::DepthFormat::D32_FLOAT: |
| 82 | return PixelFormat::Z32F; | 82 | return PixelFormat::D32_FLOAT; |
| 83 | case Tegra::DepthFormat::Z16_UNORM: | 83 | case Tegra::DepthFormat::D16_UNORM: |
| 84 | return PixelFormat::Z16; | 84 | return PixelFormat::D16_UNORM; |
| 85 | case Tegra::DepthFormat::Z32_S8_X24_FLOAT: | 85 | case Tegra::DepthFormat::D32_FLOAT_S8X24_UINT: |
| 86 | return PixelFormat::Z32FS8; | 86 | return PixelFormat::D32_FLOAT_S8_UINT; |
| 87 | default: | 87 | default: |
| 88 | UNIMPLEMENTED_MSG("Unimplemented format={}", static_cast<u32>(format)); | 88 | UNIMPLEMENTED_MSG("Unimplemented format={}", static_cast<u32>(format)); |
| 89 | return PixelFormat::S8Z24; | 89 | return PixelFormat::S8_UINT_D24_UNORM; |
| 90 | } | 90 | } |
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | PixelFormat PixelFormatFromRenderTargetFormat(Tegra::RenderTargetFormat format) { | 93 | PixelFormat PixelFormatFromRenderTargetFormat(Tegra::RenderTargetFormat format) { |
| 94 | switch (format) { | 94 | switch (format) { |
| 95 | case Tegra::RenderTargetFormat::RGBA32_FLOAT: | 95 | case Tegra::RenderTargetFormat::R32B32G32A32_FLOAT: |
| 96 | return PixelFormat::RGBA32F; | 96 | return PixelFormat::R32G32B32A32_FLOAT; |
| 97 | case Tegra::RenderTargetFormat::RGBA32_SINT: | 97 | case Tegra::RenderTargetFormat::R32G32B32A32_SINT: |
| 98 | return PixelFormat::RGBA32I; | 98 | return PixelFormat::R32G32B32A32_SINT; |
| 99 | case Tegra::RenderTargetFormat::RGBA32_UINT: | 99 | case Tegra::RenderTargetFormat::R32G32B32A32_UINT: |
| 100 | return PixelFormat::RGBA32UI; | 100 | return PixelFormat::R32G32B32A32_UINT; |
| 101 | case Tegra::RenderTargetFormat::RGBA16_UNORM: | 101 | case Tegra::RenderTargetFormat::R16G16B16A16_UNORM: |
| 102 | return PixelFormat::RGBA16U; | 102 | return PixelFormat::R16G16B16A16_UNORM; |
| 103 | case Tegra::RenderTargetFormat::RGBA16_SNORM: | 103 | case Tegra::RenderTargetFormat::R16G16B16A16_SNORM: |
| 104 | return PixelFormat::RGBA16S; | 104 | return PixelFormat::R16G16B16A16_SNORM; |
| 105 | case Tegra::RenderTargetFormat::RGBA16_SINT: | 105 | case Tegra::RenderTargetFormat::R16G16B16A16_SINT: |
| 106 | return PixelFormat::RGBA16I; | 106 | return PixelFormat::R16G16B16A16_SINT; |
| 107 | case Tegra::RenderTargetFormat::RGBA16_UINT: | 107 | case Tegra::RenderTargetFormat::R16G16B16A16_UINT: |
| 108 | return PixelFormat::RGBA16UI; | 108 | return PixelFormat::R16G16B16A16_UINT; |
| 109 | case Tegra::RenderTargetFormat::RGBA16_FLOAT: | 109 | case Tegra::RenderTargetFormat::R16G16B16A16_FLOAT: |
| 110 | return PixelFormat::RGBA16F; | 110 | return PixelFormat::R16G16B16A16_FLOAT; |
| 111 | case Tegra::RenderTargetFormat::RG32_FLOAT: | 111 | case Tegra::RenderTargetFormat::R32G32_FLOAT: |
| 112 | return PixelFormat::RG32F; | 112 | return PixelFormat::R32G32_FLOAT; |
| 113 | case Tegra::RenderTargetFormat::RG32_SINT: | 113 | case Tegra::RenderTargetFormat::R32G32_SINT: |
| 114 | return PixelFormat::RG32I; | 114 | return PixelFormat::R32G32_SINT; |
| 115 | case Tegra::RenderTargetFormat::RG32_UINT: | 115 | case Tegra::RenderTargetFormat::R32G32_UINT: |
| 116 | return PixelFormat::RG32UI; | 116 | return PixelFormat::R32G32_UINT; |
| 117 | case Tegra::RenderTargetFormat::RGBX16_FLOAT: | 117 | case Tegra::RenderTargetFormat::R16G16B16X16_FLOAT: |
| 118 | return PixelFormat::RGBX16F; | 118 | return PixelFormat::R16G16B16X16_FLOAT; |
| 119 | case Tegra::RenderTargetFormat::BGRA8_UNORM: | 119 | case Tegra::RenderTargetFormat::B8G8R8A8_UNORM: |
| 120 | return PixelFormat::BGRA8; | 120 | return PixelFormat::B8G8R8A8_UNORM; |
| 121 | case Tegra::RenderTargetFormat::BGRA8_SRGB: | 121 | case Tegra::RenderTargetFormat::B8G8R8A8_SRGB: |
| 122 | return PixelFormat::BGRA8_SRGB; | 122 | return PixelFormat::B8G8R8A8_SRGB; |
| 123 | case Tegra::RenderTargetFormat::RGB10_A2_UNORM: | 123 | case Tegra::RenderTargetFormat::A2B10G10R10_UNORM: |
| 124 | return PixelFormat::A2B10G10R10U; | 124 | return PixelFormat::A2B10G10R10_UNORM; |
| 125 | case Tegra::RenderTargetFormat::RGB10_A2_UINT: | 125 | case Tegra::RenderTargetFormat::A2B10G10R10_UINT: |
| 126 | return PixelFormat::A2B10G10R10UI; | 126 | return PixelFormat::A2B10G10R10_UINT; |
| 127 | case Tegra::RenderTargetFormat::RGBA8_UNORM: | 127 | case Tegra::RenderTargetFormat::A8B8G8R8_UNORM: |
| 128 | return PixelFormat::ABGR8U; | 128 | return PixelFormat::A8B8G8R8_UNORM; |
| 129 | case Tegra::RenderTargetFormat::RGBA8_SRGB: | 129 | case Tegra::RenderTargetFormat::A8B8G8R8_SRGB: |
| 130 | return PixelFormat::RGBA8_SRGB; | 130 | return PixelFormat::A8B8G8R8_SRGB; |
| 131 | case Tegra::RenderTargetFormat::RGBA8_SNORM: | 131 | case Tegra::RenderTargetFormat::A8B8G8R8_SNORM: |
| 132 | return PixelFormat::ABGR8S; | 132 | return PixelFormat::A8B8G8R8_SNORM; |
| 133 | case Tegra::RenderTargetFormat::RGBA8_SINT: | 133 | case Tegra::RenderTargetFormat::A8B8G8R8_SINT: |
| 134 | return PixelFormat::ABGR8I; | 134 | return PixelFormat::A8B8G8R8_SINT; |
| 135 | case Tegra::RenderTargetFormat::RGBA8_UINT: | 135 | case Tegra::RenderTargetFormat::A8B8G8R8_UINT: |
| 136 | return PixelFormat::ABGR8UI; | 136 | return PixelFormat::A8B8G8R8_UINT; |
| 137 | case Tegra::RenderTargetFormat::RG16_UNORM: | 137 | case Tegra::RenderTargetFormat::R16G16_UNORM: |
| 138 | return PixelFormat::RG16; | 138 | return PixelFormat::R16G16_UNORM; |
| 139 | case Tegra::RenderTargetFormat::RG16_SNORM: | 139 | case Tegra::RenderTargetFormat::R16G16_SNORM: |
| 140 | return PixelFormat::RG16S; | 140 | return PixelFormat::R16G16_SNORM; |
| 141 | case Tegra::RenderTargetFormat::RG16_SINT: | 141 | case Tegra::RenderTargetFormat::R16G16_SINT: |
| 142 | return PixelFormat::RG16I; | 142 | return PixelFormat::R16G16_SINT; |
| 143 | case Tegra::RenderTargetFormat::RG16_UINT: | 143 | case Tegra::RenderTargetFormat::R16G16_UINT: |
| 144 | return PixelFormat::RG16UI; | 144 | return PixelFormat::R16G16_UINT; |
| 145 | case Tegra::RenderTargetFormat::RG16_FLOAT: | 145 | case Tegra::RenderTargetFormat::R16G16_FLOAT: |
| 146 | return PixelFormat::RG16F; | 146 | return PixelFormat::R16G16_FLOAT; |
| 147 | case Tegra::RenderTargetFormat::R11G11B10_FLOAT: | 147 | case Tegra::RenderTargetFormat::B10G11R11_FLOAT: |
| 148 | return PixelFormat::R11FG11FB10F; | 148 | return PixelFormat::B10G11R11_FLOAT; |
| 149 | case Tegra::RenderTargetFormat::R32_SINT: | 149 | case Tegra::RenderTargetFormat::R32_SINT: |
| 150 | return PixelFormat::R32I; | 150 | return PixelFormat::R32_SINT; |
| 151 | case Tegra::RenderTargetFormat::R32_UINT: | 151 | case Tegra::RenderTargetFormat::R32_UINT: |
| 152 | return PixelFormat::R32UI; | 152 | return PixelFormat::R32_UINT; |
| 153 | case Tegra::RenderTargetFormat::R32_FLOAT: | 153 | case Tegra::RenderTargetFormat::R32_FLOAT: |
| 154 | return PixelFormat::R32F; | 154 | return PixelFormat::R32_FLOAT; |
| 155 | case Tegra::RenderTargetFormat::B5G6R5_UNORM: | 155 | case Tegra::RenderTargetFormat::R5G6B5_UNORM: |
| 156 | return PixelFormat::B5G6R5U; | 156 | return PixelFormat::R5G6B5_UNORM; |
| 157 | case Tegra::RenderTargetFormat::BGR5A1_UNORM: | 157 | case Tegra::RenderTargetFormat::A1R5G5B5_UNORM: |
| 158 | return PixelFormat::B5G5R5A1U; | 158 | return PixelFormat::A1R5G5B5_UNORM; |
| 159 | case Tegra::RenderTargetFormat::RG8_UNORM: | 159 | case Tegra::RenderTargetFormat::R8G8_UNORM: |
| 160 | return PixelFormat::RG8U; | 160 | return PixelFormat::R8G8_UNORM; |
| 161 | case Tegra::RenderTargetFormat::RG8_SNORM: | 161 | case Tegra::RenderTargetFormat::R8G8_SNORM: |
| 162 | return PixelFormat::RG8S; | 162 | return PixelFormat::R8G8_SNORM; |
| 163 | case Tegra::RenderTargetFormat::RG8_SINT: | 163 | case Tegra::RenderTargetFormat::R8G8_SINT: |
| 164 | return PixelFormat::RG8I; | 164 | return PixelFormat::R8G8_SINT; |
| 165 | case Tegra::RenderTargetFormat::RG8_UINT: | 165 | case Tegra::RenderTargetFormat::R8G8_UINT: |
| 166 | return PixelFormat::RG8UI; | 166 | return PixelFormat::R8G8_UINT; |
| 167 | case Tegra::RenderTargetFormat::R16_UNORM: | 167 | case Tegra::RenderTargetFormat::R16_UNORM: |
| 168 | return PixelFormat::R16U; | 168 | return PixelFormat::R16_UNORM; |
| 169 | case Tegra::RenderTargetFormat::R16_SNORM: | 169 | case Tegra::RenderTargetFormat::R16_SNORM: |
| 170 | return PixelFormat::R16S; | 170 | return PixelFormat::R16_SNORM; |
| 171 | case Tegra::RenderTargetFormat::R16_SINT: | 171 | case Tegra::RenderTargetFormat::R16_SINT: |
| 172 | return PixelFormat::R16I; | 172 | return PixelFormat::R16_SINT; |
| 173 | case Tegra::RenderTargetFormat::R16_UINT: | 173 | case Tegra::RenderTargetFormat::R16_UINT: |
| 174 | return PixelFormat::R16UI; | 174 | return PixelFormat::R16_UINT; |
| 175 | case Tegra::RenderTargetFormat::R16_FLOAT: | 175 | case Tegra::RenderTargetFormat::R16_FLOAT: |
| 176 | return PixelFormat::R16F; | 176 | return PixelFormat::R16_FLOAT; |
| 177 | case Tegra::RenderTargetFormat::R8_UNORM: | 177 | case Tegra::RenderTargetFormat::R8_UNORM: |
| 178 | return PixelFormat::R8U; | 178 | return PixelFormat::R8_UNORM; |
| 179 | case Tegra::RenderTargetFormat::R8_SNORM: | 179 | case Tegra::RenderTargetFormat::R8_SNORM: |
| 180 | return PixelFormat::R8S; | 180 | return PixelFormat::R8_SNORM; |
| 181 | case Tegra::RenderTargetFormat::R8_SINT: | 181 | case Tegra::RenderTargetFormat::R8_SINT: |
| 182 | return PixelFormat::R8I; | 182 | return PixelFormat::R8_SINT; |
| 183 | case Tegra::RenderTargetFormat::R8_UINT: | 183 | case Tegra::RenderTargetFormat::R8_UINT: |
| 184 | return PixelFormat::R8UI; | 184 | return PixelFormat::R8_UINT; |
| 185 | default: | 185 | default: |
| 186 | UNIMPLEMENTED_MSG("Unimplemented format={}", static_cast<int>(format)); | 186 | UNIMPLEMENTED_MSG("Unimplemented format={}", static_cast<int>(format)); |
| 187 | return PixelFormat::ABGR8U; | 187 | return PixelFormat::A8B8G8R8_UNORM; |
| 188 | } | 188 | } |
| 189 | } | 189 | } |
| 190 | 190 | ||
| 191 | PixelFormat PixelFormatFromGPUPixelFormat(Tegra::FramebufferConfig::PixelFormat format) { | 191 | PixelFormat PixelFormatFromGPUPixelFormat(Tegra::FramebufferConfig::PixelFormat format) { |
| 192 | switch (format) { | 192 | switch (format) { |
| 193 | case Tegra::FramebufferConfig::PixelFormat::ABGR8: | 193 | case Tegra::FramebufferConfig::PixelFormat::A8B8G8R8_UNORM: |
| 194 | return PixelFormat::ABGR8U; | 194 | return PixelFormat::A8B8G8R8_UNORM; |
| 195 | case Tegra::FramebufferConfig::PixelFormat::RGB565: | 195 | case Tegra::FramebufferConfig::PixelFormat::RGB565_UNORM: |
| 196 | return PixelFormat::B5G6R5U; | 196 | return PixelFormat::R5G6B5_UNORM; |
| 197 | case Tegra::FramebufferConfig::PixelFormat::BGRA8: | 197 | case Tegra::FramebufferConfig::PixelFormat::B8G8R8A8_UNORM: |
| 198 | return PixelFormat::BGRA8; | 198 | return PixelFormat::B8G8R8A8_UNORM; |
| 199 | default: | 199 | default: |
| 200 | UNIMPLEMENTED_MSG("Unimplemented format={}", static_cast<u32>(format)); | 200 | UNIMPLEMENTED_MSG("Unimplemented format={}", static_cast<u32>(format)); |
| 201 | return PixelFormat::ABGR8U; | 201 | return PixelFormat::A8B8G8R8_UNORM; |
| 202 | } | 202 | } |
| 203 | } | 203 | } |
| 204 | 204 | ||
| @@ -226,27 +226,27 @@ SurfaceType GetFormatType(PixelFormat pixel_format) { | |||
| 226 | 226 | ||
| 227 | bool IsPixelFormatASTC(PixelFormat format) { | 227 | bool IsPixelFormatASTC(PixelFormat format) { |
| 228 | switch (format) { | 228 | switch (format) { |
| 229 | case PixelFormat::ASTC_2D_4X4: | 229 | case PixelFormat::ASTC_2D_4X4_UNORM: |
| 230 | case PixelFormat::ASTC_2D_5X4: | 230 | case PixelFormat::ASTC_2D_5X4_UNORM: |
| 231 | case PixelFormat::ASTC_2D_5X5: | 231 | case PixelFormat::ASTC_2D_5X5_UNORM: |
| 232 | case PixelFormat::ASTC_2D_8X8: | 232 | case PixelFormat::ASTC_2D_8X8_UNORM: |
| 233 | case PixelFormat::ASTC_2D_8X5: | 233 | case PixelFormat::ASTC_2D_8X5_UNORM: |
| 234 | case PixelFormat::ASTC_2D_4X4_SRGB: | 234 | case PixelFormat::ASTC_2D_4X4_SRGB: |
| 235 | case PixelFormat::ASTC_2D_5X4_SRGB: | 235 | case PixelFormat::ASTC_2D_5X4_SRGB: |
| 236 | case PixelFormat::ASTC_2D_5X5_SRGB: | 236 | case PixelFormat::ASTC_2D_5X5_SRGB: |
| 237 | case PixelFormat::ASTC_2D_8X8_SRGB: | 237 | case PixelFormat::ASTC_2D_8X8_SRGB: |
| 238 | case PixelFormat::ASTC_2D_8X5_SRGB: | 238 | case PixelFormat::ASTC_2D_8X5_SRGB: |
| 239 | case PixelFormat::ASTC_2D_10X8: | 239 | case PixelFormat::ASTC_2D_10X8_UNORM: |
| 240 | case PixelFormat::ASTC_2D_10X8_SRGB: | 240 | case PixelFormat::ASTC_2D_10X8_SRGB: |
| 241 | case PixelFormat::ASTC_2D_6X6: | 241 | case PixelFormat::ASTC_2D_6X6_UNORM: |
| 242 | case PixelFormat::ASTC_2D_6X6_SRGB: | 242 | case PixelFormat::ASTC_2D_6X6_SRGB: |
| 243 | case PixelFormat::ASTC_2D_10X10: | 243 | case PixelFormat::ASTC_2D_10X10_UNORM: |
| 244 | case PixelFormat::ASTC_2D_10X10_SRGB: | 244 | case PixelFormat::ASTC_2D_10X10_SRGB: |
| 245 | case PixelFormat::ASTC_2D_12X12: | 245 | case PixelFormat::ASTC_2D_12X12_UNORM: |
| 246 | case PixelFormat::ASTC_2D_12X12_SRGB: | 246 | case PixelFormat::ASTC_2D_12X12_SRGB: |
| 247 | case PixelFormat::ASTC_2D_8X6: | 247 | case PixelFormat::ASTC_2D_8X6_UNORM: |
| 248 | case PixelFormat::ASTC_2D_8X6_SRGB: | 248 | case PixelFormat::ASTC_2D_8X6_SRGB: |
| 249 | case PixelFormat::ASTC_2D_6X5: | 249 | case PixelFormat::ASTC_2D_6X5_UNORM: |
| 250 | case PixelFormat::ASTC_2D_6X5_SRGB: | 250 | case PixelFormat::ASTC_2D_6X5_SRGB: |
| 251 | return true; | 251 | return true; |
| 252 | default: | 252 | default: |
| @@ -256,12 +256,12 @@ bool IsPixelFormatASTC(PixelFormat format) { | |||
| 256 | 256 | ||
| 257 | bool IsPixelFormatSRGB(PixelFormat format) { | 257 | bool IsPixelFormatSRGB(PixelFormat format) { |
| 258 | switch (format) { | 258 | switch (format) { |
| 259 | case PixelFormat::RGBA8_SRGB: | 259 | case PixelFormat::A8B8G8R8_SRGB: |
| 260 | case PixelFormat::BGRA8_SRGB: | 260 | case PixelFormat::B8G8R8A8_SRGB: |
| 261 | case PixelFormat::DXT1_SRGB: | 261 | case PixelFormat::BC1_RGBA_SRGB: |
| 262 | case PixelFormat::DXT23_SRGB: | 262 | case PixelFormat::BC2_SRGB: |
| 263 | case PixelFormat::DXT45_SRGB: | 263 | case PixelFormat::BC3_SRGB: |
| 264 | case PixelFormat::BC7U_SRGB: | 264 | case PixelFormat::BC7_SRGB: |
| 265 | case PixelFormat::ASTC_2D_4X4_SRGB: | 265 | case PixelFormat::ASTC_2D_4X4_SRGB: |
| 266 | case PixelFormat::ASTC_2D_8X8_SRGB: | 266 | case PixelFormat::ASTC_2D_8X8_SRGB: |
| 267 | case PixelFormat::ASTC_2D_8X5_SRGB: | 267 | case PixelFormat::ASTC_2D_8X5_SRGB: |
diff --git a/src/video_core/surface.h b/src/video_core/surface.h index 826c5a3ad..cfd12fa61 100644 --- a/src/video_core/surface.h +++ b/src/video_core/surface.h | |||
| @@ -15,105 +15,105 @@ | |||
| 15 | namespace VideoCore::Surface { | 15 | namespace VideoCore::Surface { |
| 16 | 16 | ||
| 17 | enum class PixelFormat { | 17 | enum class PixelFormat { |
| 18 | ABGR8U, | 18 | A8B8G8R8_UNORM, |
| 19 | ABGR8S, | 19 | A8B8G8R8_SNORM, |
| 20 | ABGR8I, | 20 | A8B8G8R8_SINT, |
| 21 | ABGR8UI, | 21 | A8B8G8R8_UINT, |
| 22 | B5G6R5U, | 22 | R5G6B5_UNORM, |
| 23 | R5G6B5U, | 23 | B5G6R5_UNORM, |
| 24 | B5G5R5A1U, | 24 | A1R5G5B5_UNORM, |
| 25 | A2B10G10R10U, | 25 | A2B10G10R10_UNORM, |
| 26 | A2B10G10R10UI, | 26 | A2B10G10R10_UINT, |
| 27 | A1B5G5R5U, | 27 | A1B5G5R5_UNORM, |
| 28 | R8U, | 28 | R8_UNORM, |
| 29 | R8S, | 29 | R8_SNORM, |
| 30 | R8I, | 30 | R8_SINT, |
| 31 | R8UI, | 31 | R8_UINT, |
| 32 | RGBA16F, | 32 | R16G16B16A16_FLOAT, |
| 33 | RGBA16U, | 33 | R16G16B16A16_UNORM, |
| 34 | RGBA16S, | 34 | R16G16B16A16_SNORM, |
| 35 | RGBA16I, | 35 | R16G16B16A16_SINT, |
| 36 | RGBA16UI, | 36 | R16G16B16A16_UINT, |
| 37 | R11FG11FB10F, | 37 | B10G11R11_FLOAT, |
| 38 | RGBA32UI, | 38 | R32G32B32A32_UINT, |
| 39 | DXT1, | 39 | BC1_RGBA_UNORM, |
| 40 | DXT23, | 40 | BC2_UNORM, |
| 41 | DXT45, | 41 | BC3_UNORM, |
| 42 | DXN1UNORM, // This is also known as BC4 | 42 | BC4_UNORM, |
| 43 | DXN1SNORM, | 43 | BC4_SNORM, |
| 44 | DXN2UNORM, | 44 | BC5_UNORM, |
| 45 | DXN2SNORM, | 45 | BC5_SNORM, |
| 46 | BC7U, | 46 | BC7_UNORM, |
| 47 | BC6H_UF16, | 47 | BC6H_UFLOAT, |
| 48 | BC6H_SF16, | 48 | BC6H_SFLOAT, |
| 49 | ASTC_2D_4X4, | 49 | ASTC_2D_4X4_UNORM, |
| 50 | BGRA8, | 50 | B8G8R8A8_UNORM, |
| 51 | RGBA32F, | 51 | R32G32B32A32_FLOAT, |
| 52 | RGBA32I, | 52 | R32G32B32A32_SINT, |
| 53 | RG32F, | 53 | R32G32_FLOAT, |
| 54 | RG32I, | 54 | R32G32_SINT, |
| 55 | R32F, | 55 | R32_FLOAT, |
| 56 | R16F, | 56 | R16_FLOAT, |
| 57 | R16U, | 57 | R16_UNORM, |
| 58 | R16S, | 58 | R16_SNORM, |
| 59 | R16UI, | 59 | R16_UINT, |
| 60 | R16I, | 60 | R16_SINT, |
| 61 | RG16, | 61 | R16G16_UNORM, |
| 62 | RG16F, | 62 | R16G16_FLOAT, |
| 63 | RG16UI, | 63 | R16G16_UINT, |
| 64 | RG16I, | 64 | R16G16_SINT, |
| 65 | RG16S, | 65 | R16G16_SNORM, |
| 66 | RGB32F, | 66 | R32G32B32_FLOAT, |
| 67 | RGBA8_SRGB, | 67 | A8B8G8R8_SRGB, |
| 68 | RG8U, | 68 | R8G8_UNORM, |
| 69 | RG8S, | 69 | R8G8_SNORM, |
| 70 | RG8I, | 70 | R8G8_SINT, |
| 71 | RG8UI, | 71 | R8G8_UINT, |
| 72 | RG32UI, | 72 | R32G32_UINT, |
| 73 | RGBX16F, | 73 | R16G16B16X16_FLOAT, |
| 74 | R32UI, | 74 | R32_UINT, |
| 75 | R32I, | 75 | R32_SINT, |
| 76 | ASTC_2D_8X8, | 76 | ASTC_2D_8X8_UNORM, |
| 77 | ASTC_2D_8X5, | 77 | ASTC_2D_8X5_UNORM, |
| 78 | ASTC_2D_5X4, | 78 | ASTC_2D_5X4_UNORM, |
| 79 | BGRA8_SRGB, | 79 | B8G8R8A8_SRGB, |
| 80 | DXT1_SRGB, | 80 | BC1_RGBA_SRGB, |
| 81 | DXT23_SRGB, | 81 | BC2_SRGB, |
| 82 | DXT45_SRGB, | 82 | BC3_SRGB, |
| 83 | BC7U_SRGB, | 83 | BC7_SRGB, |
| 84 | R4G4B4A4U, | 84 | A4B4G4R4_UNORM, |
| 85 | ASTC_2D_4X4_SRGB, | 85 | ASTC_2D_4X4_SRGB, |
| 86 | ASTC_2D_8X8_SRGB, | 86 | ASTC_2D_8X8_SRGB, |
| 87 | ASTC_2D_8X5_SRGB, | 87 | ASTC_2D_8X5_SRGB, |
| 88 | ASTC_2D_5X4_SRGB, | 88 | ASTC_2D_5X4_SRGB, |
| 89 | ASTC_2D_5X5, | 89 | ASTC_2D_5X5_UNORM, |
| 90 | ASTC_2D_5X5_SRGB, | 90 | ASTC_2D_5X5_SRGB, |
| 91 | ASTC_2D_10X8, | 91 | ASTC_2D_10X8_UNORM, |
| 92 | ASTC_2D_10X8_SRGB, | 92 | ASTC_2D_10X8_SRGB, |
| 93 | ASTC_2D_6X6, | 93 | ASTC_2D_6X6_UNORM, |
| 94 | ASTC_2D_6X6_SRGB, | 94 | ASTC_2D_6X6_SRGB, |
| 95 | ASTC_2D_10X10, | 95 | ASTC_2D_10X10_UNORM, |
| 96 | ASTC_2D_10X10_SRGB, | 96 | ASTC_2D_10X10_SRGB, |
| 97 | ASTC_2D_12X12, | 97 | ASTC_2D_12X12_UNORM, |
| 98 | ASTC_2D_12X12_SRGB, | 98 | ASTC_2D_12X12_SRGB, |
| 99 | ASTC_2D_8X6, | 99 | ASTC_2D_8X6_UNORM, |
| 100 | ASTC_2D_8X6_SRGB, | 100 | ASTC_2D_8X6_SRGB, |
| 101 | ASTC_2D_6X5, | 101 | ASTC_2D_6X5_UNORM, |
| 102 | ASTC_2D_6X5_SRGB, | 102 | ASTC_2D_6X5_SRGB, |
| 103 | E5B9G9R9F, | 103 | E5B9G9R9_FLOAT, |
| 104 | 104 | ||
| 105 | MaxColorFormat, | 105 | MaxColorFormat, |
| 106 | 106 | ||
| 107 | // Depth formats | 107 | // Depth formats |
| 108 | Z32F = MaxColorFormat, | 108 | D32_FLOAT = MaxColorFormat, |
| 109 | Z16, | 109 | D16_UNORM, |
| 110 | 110 | ||
| 111 | MaxDepthFormat, | 111 | MaxDepthFormat, |
| 112 | 112 | ||
| 113 | // DepthStencil formats | 113 | // DepthStencil formats |
| 114 | Z24S8 = MaxDepthFormat, | 114 | D24_UNORM_S8_UINT = MaxDepthFormat, |
| 115 | S8Z24, | 115 | S8_UINT_D24_UNORM, |
| 116 | Z32FS8, | 116 | D32_FLOAT_S8_UINT, |
| 117 | 117 | ||
| 118 | MaxDepthStencilFormat, | 118 | MaxDepthStencilFormat, |
| 119 | 119 | ||
| @@ -141,97 +141,97 @@ enum class SurfaceTarget { | |||
| 141 | }; | 141 | }; |
| 142 | 142 | ||
| 143 | constexpr std::array<u32, MaxPixelFormat> compression_factor_shift_table = {{ | 143 | constexpr std::array<u32, MaxPixelFormat> compression_factor_shift_table = {{ |
| 144 | 0, // ABGR8U | 144 | 0, // A8B8G8R8_UNORM |
| 145 | 0, // ABGR8S | 145 | 0, // A8B8G8R8_SNORM |
| 146 | 0, // ABGR8I | 146 | 0, // A8B8G8R8_SINT |
| 147 | 0, // ABGR8UI | 147 | 0, // A8B8G8R8_UINT |
| 148 | 0, // B5G6R5U | 148 | 0, // R5G6B5_UNORM |
| 149 | 0, // R5G6B5U | 149 | 0, // B5G6R5_UNORM |
| 150 | 0, // B5G5R5A1U | 150 | 0, // A1R5G5B5_UNORM |
| 151 | 0, // A2B10G10R10U | 151 | 0, // A2B10G10R10_UNORM |
| 152 | 0, // A2B10G10R10UI | 152 | 0, // A2B10G10R10_UINT |
| 153 | 0, // A1B5G5R5U | 153 | 0, // A1B5G5R5_UNORM |
| 154 | 0, // R8U | 154 | 0, // R8_UNORM |
| 155 | 0, // R8S | 155 | 0, // R8_SNORM |
| 156 | 0, // R8I | 156 | 0, // R8_SINT |
| 157 | 0, // R8UI | 157 | 0, // R8_UINT |
| 158 | 0, // RGBA16F | 158 | 0, // R16G16B16A16_FLOAT |
| 159 | 0, // RGBA16U | 159 | 0, // R16G16B16A16_UNORM |
| 160 | 0, // RGBA16S | 160 | 0, // R16G16B16A16_SNORM |
| 161 | 0, // RGBA16I | 161 | 0, // R16G16B16A16_SINT |
| 162 | 0, // RGBA16UI | 162 | 0, // R16G16B16A16_UINT |
| 163 | 0, // R11FG11FB10F | 163 | 0, // B10G11R11_FLOAT |
| 164 | 0, // RGBA32UI | 164 | 0, // R32G32B32A32_UINT |
| 165 | 2, // DXT1 | 165 | 2, // BC1_RGBA_UNORM |
| 166 | 2, // DXT23 | 166 | 2, // BC2_UNORM |
| 167 | 2, // DXT45 | 167 | 2, // BC3_UNORM |
| 168 | 2, // DXN1UNORM | 168 | 2, // BC4_UNORM |
| 169 | 2, // DXN1SNORM | 169 | 2, // BC4_SNORM |
| 170 | 2, // DXN2UNORM | 170 | 2, // BC5_UNORM |
| 171 | 2, // DXN2SNORM | 171 | 2, // BC5_SNORM |
| 172 | 2, // BC7U | 172 | 2, // BC7_UNORM |
| 173 | 2, // BC6H_UF16 | 173 | 2, // BC6H_UFLOAT |
| 174 | 2, // BC6H_SF16 | 174 | 2, // BC6H_SFLOAT |
| 175 | 2, // ASTC_2D_4X4 | 175 | 2, // ASTC_2D_4X4_UNORM |
| 176 | 0, // BGRA8 | 176 | 0, // B8G8R8A8_UNORM |
| 177 | 0, // RGBA32F | 177 | 0, // R32G32B32A32_FLOAT |
| 178 | 0, // RGBA32I | 178 | 0, // R32G32B32A32_SINT |
| 179 | 0, // RG32F | 179 | 0, // R32G32_FLOAT |
| 180 | 0, // RG32I | 180 | 0, // R32G32_SINT |
| 181 | 0, // R32F | 181 | 0, // R32_FLOAT |
| 182 | 0, // R16F | 182 | 0, // R16_FLOAT |
| 183 | 0, // R16U | 183 | 0, // R16_UNORM |
| 184 | 0, // R16S | 184 | 0, // R16_SNORM |
| 185 | 0, // R16UI | 185 | 0, // R16_UINT |
| 186 | 0, // R16I | 186 | 0, // R16_SINT |
| 187 | 0, // RG16 | 187 | 0, // R16G16_UNORM |
| 188 | 0, // RG16F | 188 | 0, // R16G16_FLOAT |
| 189 | 0, // RG16UI | 189 | 0, // R16G16_UINT |
| 190 | 0, // RG16I | 190 | 0, // R16G16_SINT |
| 191 | 0, // RG16S | 191 | 0, // R16G16_SNORM |
| 192 | 0, // RGB32F | 192 | 0, // R32G32B32_FLOAT |
| 193 | 0, // RGBA8_SRGB | 193 | 0, // A8B8G8R8_SRGB |
| 194 | 0, // RG8U | 194 | 0, // R8G8_UNORM |
| 195 | 0, // RG8S | 195 | 0, // R8G8_SNORM |
| 196 | 0, // RG8I | 196 | 0, // R8G8_SINT |
| 197 | 0, // RG8UI | 197 | 0, // R8G8_UINT |
| 198 | 0, // RG32UI | 198 | 0, // R32G32_UINT |
| 199 | 0, // RGBX16F | 199 | 0, // R16G16B16X16_FLOAT |
| 200 | 0, // R32UI | 200 | 0, // R32_UINT |
| 201 | 0, // R32I | 201 | 0, // R32_SINT |
| 202 | 2, // ASTC_2D_8X8 | 202 | 2, // ASTC_2D_8X8_UNORM |
| 203 | 2, // ASTC_2D_8X5 | 203 | 2, // ASTC_2D_8X5_UNORM |
| 204 | 2, // ASTC_2D_5X4 | 204 | 2, // ASTC_2D_5X4_UNORM |
| 205 | 0, // BGRA8_SRGB | 205 | 0, // B8G8R8A8_SRGB |
| 206 | 2, // DXT1_SRGB | 206 | 2, // BC1_RGBA_SRGB |
| 207 | 2, // DXT23_SRGB | 207 | 2, // BC2_SRGB |
| 208 | 2, // DXT45_SRGB | 208 | 2, // BC3_SRGB |
| 209 | 2, // BC7U_SRGB | 209 | 2, // BC7_SRGB |
| 210 | 0, // R4G4B4A4U | 210 | 0, // A4B4G4R4_UNORM |
| 211 | 2, // ASTC_2D_4X4_SRGB | 211 | 2, // ASTC_2D_4X4_SRGB |
| 212 | 2, // ASTC_2D_8X8_SRGB | 212 | 2, // ASTC_2D_8X8_SRGB |
| 213 | 2, // ASTC_2D_8X5_SRGB | 213 | 2, // ASTC_2D_8X5_SRGB |
| 214 | 2, // ASTC_2D_5X4_SRGB | 214 | 2, // ASTC_2D_5X4_SRGB |
| 215 | 2, // ASTC_2D_5X5 | 215 | 2, // ASTC_2D_5X5_UNORM |
| 216 | 2, // ASTC_2D_5X5_SRGB | 216 | 2, // ASTC_2D_5X5_SRGB |
| 217 | 2, // ASTC_2D_10X8 | 217 | 2, // ASTC_2D_10X8_UNORM |
| 218 | 2, // ASTC_2D_10X8_SRGB | 218 | 2, // ASTC_2D_10X8_SRGB |
| 219 | 2, // ASTC_2D_6X6 | 219 | 2, // ASTC_2D_6X6_UNORM |
| 220 | 2, // ASTC_2D_6X6_SRGB | 220 | 2, // ASTC_2D_6X6_SRGB |
| 221 | 2, // ASTC_2D_10X10 | 221 | 2, // ASTC_2D_10X10_UNORM |
| 222 | 2, // ASTC_2D_10X10_SRGB | 222 | 2, // ASTC_2D_10X10_SRGB |
| 223 | 2, // ASTC_2D_12X12 | 223 | 2, // ASTC_2D_12X12_UNORM |
| 224 | 2, // ASTC_2D_12X12_SRGB | 224 | 2, // ASTC_2D_12X12_SRGB |
| 225 | 2, // ASTC_2D_8X6 | 225 | 2, // ASTC_2D_8X6_UNORM |
| 226 | 2, // ASTC_2D_8X6_SRGB | 226 | 2, // ASTC_2D_8X6_SRGB |
| 227 | 2, // ASTC_2D_6X5 | 227 | 2, // ASTC_2D_6X5_UNORM |
| 228 | 2, // ASTC_2D_6X5_SRGB | 228 | 2, // ASTC_2D_6X5_SRGB |
| 229 | 0, // E5B9G9R9F | 229 | 0, // E5B9G9R9_FLOAT |
| 230 | 0, // Z32F | 230 | 0, // D32_FLOAT |
| 231 | 0, // Z16 | 231 | 0, // D16_UNORM |
| 232 | 0, // Z24S8 | 232 | 0, // D24_UNORM_S8_UINT |
| 233 | 0, // S8Z24 | 233 | 0, // S8_UINT_D24_UNORM |
| 234 | 0, // Z32FS8 | 234 | 0, // D32_FLOAT_S8_UINT |
| 235 | }}; | 235 | }}; |
| 236 | 236 | ||
| 237 | /** | 237 | /** |
| @@ -251,97 +251,97 @@ inline constexpr u32 GetCompressionFactor(PixelFormat format) { | |||
| 251 | } | 251 | } |
| 252 | 252 | ||
| 253 | constexpr std::array<u32, MaxPixelFormat> block_width_table = {{ | 253 | constexpr std::array<u32, MaxPixelFormat> block_width_table = {{ |
| 254 | 1, // ABGR8U | 254 | 1, // A8B8G8R8_UNORM |
| 255 | 1, // ABGR8S | 255 | 1, // A8B8G8R8_SNORM |
| 256 | 1, // ABGR8I | 256 | 1, // A8B8G8R8_SINT |
| 257 | 1, // ABGR8UI | 257 | 1, // A8B8G8R8_UINT |
| 258 | 1, // B5G6R5U | 258 | 1, // R5G6B5_UNORM |
| 259 | 1, // R5G6B5U | 259 | 1, // B5G6R5_UNORM |
| 260 | 1, // B5G5R5A1U | 260 | 1, // A1R5G5B5_UNORM |
| 261 | 1, // A2B10G10R10U | 261 | 1, // A2B10G10R10_UNORM |
| 262 | 1, // A2B10G10R10UI | 262 | 1, // A2B10G10R10_UINT |
| 263 | 1, // A1B5G5R5U | 263 | 1, // A1B5G5R5_UNORM |
| 264 | 1, // R8U | 264 | 1, // R8_UNORM |
| 265 | 1, // R8S | 265 | 1, // R8_SNORM |
| 266 | 1, // R8I | 266 | 1, // R8_SINT |
| 267 | 1, // R8UI | 267 | 1, // R8_UINT |
| 268 | 1, // RGBA16F | 268 | 1, // R16G16B16A16_FLOAT |
| 269 | 1, // RGBA16U | 269 | 1, // R16G16B16A16_UNORM |
| 270 | 1, // RGBA16S | 270 | 1, // R16G16B16A16_SNORM |
| 271 | 1, // RGBA16I | 271 | 1, // R16G16B16A16_SINT |
| 272 | 1, // RGBA16UI | 272 | 1, // R16G16B16A16_UINT |
| 273 | 1, // R11FG11FB10F | 273 | 1, // B10G11R11_FLOAT |
| 274 | 1, // RGBA32UI | 274 | 1, // R32G32B32A32_UINT |
| 275 | 4, // DXT1 | 275 | 4, // BC1_RGBA_UNORM |
| 276 | 4, // DXT23 | 276 | 4, // BC2_UNORM |
| 277 | 4, // DXT45 | 277 | 4, // BC3_UNORM |
| 278 | 4, // DXN1UNORM | 278 | 4, // BC4_UNORM |
| 279 | 4, // DXN1SNORM | 279 | 4, // BC4_SNORM |
| 280 | 4, // DXN2UNORM | 280 | 4, // BC5_UNORM |
| 281 | 4, // DXN2SNORM | 281 | 4, // BC5_SNORM |
| 282 | 4, // BC7U | 282 | 4, // BC7_UNORM |
| 283 | 4, // BC6H_UF16 | 283 | 4, // BC6H_UFLOAT |
| 284 | 4, // BC6H_SF16 | 284 | 4, // BC6H_SFLOAT |
| 285 | 4, // ASTC_2D_4X4 | 285 | 4, // ASTC_2D_4X4_UNORM |
| 286 | 1, // BGRA8 | 286 | 1, // B8G8R8A8_UNORM |
| 287 | 1, // RGBA32F | 287 | 1, // R32G32B32A32_FLOAT |
| 288 | 1, // RGBA32I | 288 | 1, // R32G32B32A32_SINT |
| 289 | 1, // RG32F | 289 | 1, // R32G32_FLOAT |
| 290 | 1, // RG32I | 290 | 1, // R32G32_SINT |
| 291 | 1, // R32F | 291 | 1, // R32_FLOAT |
| 292 | 1, // R16F | 292 | 1, // R16_FLOAT |
| 293 | 1, // R16U | 293 | 1, // R16_UNORM |
| 294 | 1, // R16S | 294 | 1, // R16_SNORM |
| 295 | 1, // R16UI | 295 | 1, // R16_UINT |
| 296 | 1, // R16I | 296 | 1, // R16_SINT |
| 297 | 1, // RG16 | 297 | 1, // R16G16_UNORM |
| 298 | 1, // RG16F | 298 | 1, // R16G16_FLOAT |
| 299 | 1, // RG16UI | 299 | 1, // R16G16_UINT |
| 300 | 1, // RG16I | 300 | 1, // R16G16_SINT |
| 301 | 1, // RG16S | 301 | 1, // R16G16_SNORM |
| 302 | 1, // RGB32F | 302 | 1, // R32G32B32_FLOAT |
| 303 | 1, // RGBA8_SRGB | 303 | 1, // A8B8G8R8_SRGB |
| 304 | 1, // RG8U | 304 | 1, // R8G8_UNORM |
| 305 | 1, // RG8S | 305 | 1, // R8G8_SNORM |
| 306 | 1, // RG8I | 306 | 1, // R8G8_SINT |
| 307 | 1, // RG8UI | 307 | 1, // R8G8_UINT |
| 308 | 1, // RG32UI | 308 | 1, // R32G32_UINT |
| 309 | 1, // RGBX16F | 309 | 1, // R16G16B16X16_FLOAT |
| 310 | 1, // R32UI | 310 | 1, // R32_UINT |
| 311 | 1, // R32I | 311 | 1, // R32_SINT |
| 312 | 8, // ASTC_2D_8X8 | 312 | 8, // ASTC_2D_8X8_UNORM |
| 313 | 8, // ASTC_2D_8X5 | 313 | 8, // ASTC_2D_8X5_UNORM |
| 314 | 5, // ASTC_2D_5X4 | 314 | 5, // ASTC_2D_5X4_UNORM |
| 315 | 1, // BGRA8_SRGB | 315 | 1, // B8G8R8A8_SRGB |
| 316 | 4, // DXT1_SRGB | 316 | 4, // BC1_RGBA_SRGB |
| 317 | 4, // DXT23_SRGB | 317 | 4, // BC2_SRGB |
| 318 | 4, // DXT45_SRGB | 318 | 4, // BC3_SRGB |
| 319 | 4, // BC7U_SRGB | 319 | 4, // BC7_SRGB |
| 320 | 1, // R4G4B4A4U | 320 | 1, // A4B4G4R4_UNORM |
| 321 | 4, // ASTC_2D_4X4_SRGB | 321 | 4, // ASTC_2D_4X4_SRGB |
| 322 | 8, // ASTC_2D_8X8_SRGB | 322 | 8, // ASTC_2D_8X8_SRGB |
| 323 | 8, // ASTC_2D_8X5_SRGB | 323 | 8, // ASTC_2D_8X5_SRGB |
| 324 | 5, // ASTC_2D_5X4_SRGB | 324 | 5, // ASTC_2D_5X4_SRGB |
| 325 | 5, // ASTC_2D_5X5 | 325 | 5, // ASTC_2D_5X5_UNORM |
| 326 | 5, // ASTC_2D_5X5_SRGB | 326 | 5, // ASTC_2D_5X5_SRGB |
| 327 | 10, // ASTC_2D_10X8 | 327 | 10, // ASTC_2D_10X8_UNORM |
| 328 | 10, // ASTC_2D_10X8_SRGB | 328 | 10, // ASTC_2D_10X8_SRGB |
| 329 | 6, // ASTC_2D_6X6 | 329 | 6, // ASTC_2D_6X6_UNORM |
| 330 | 6, // ASTC_2D_6X6_SRGB | 330 | 6, // ASTC_2D_6X6_SRGB |
| 331 | 10, // ASTC_2D_10X10 | 331 | 10, // ASTC_2D_10X10_UNORM |
| 332 | 10, // ASTC_2D_10X10_SRGB | 332 | 10, // ASTC_2D_10X10_SRGB |
| 333 | 12, // ASTC_2D_12X12 | 333 | 12, // ASTC_2D_12X12_UNORM |
| 334 | 12, // ASTC_2D_12X12_SRGB | 334 | 12, // ASTC_2D_12X12_SRGB |
| 335 | 8, // ASTC_2D_8X6 | 335 | 8, // ASTC_2D_8X6_UNORM |
| 336 | 8, // ASTC_2D_8X6_SRGB | 336 | 8, // ASTC_2D_8X6_SRGB |
| 337 | 6, // ASTC_2D_6X5 | 337 | 6, // ASTC_2D_6X5_UNORM |
| 338 | 6, // ASTC_2D_6X5_SRGB | 338 | 6, // ASTC_2D_6X5_SRGB |
| 339 | 1, // E5B9G9R9F | 339 | 1, // E5B9G9R9_FLOAT |
| 340 | 1, // Z32F | 340 | 1, // D32_FLOAT |
| 341 | 1, // Z16 | 341 | 1, // D16_UNORM |
| 342 | 1, // Z24S8 | 342 | 1, // D24_UNORM_S8_UINT |
| 343 | 1, // S8Z24 | 343 | 1, // S8_UINT_D24_UNORM |
| 344 | 1, // Z32FS8 | 344 | 1, // D32_FLOAT_S8_UINT |
| 345 | }}; | 345 | }}; |
| 346 | 346 | ||
| 347 | static constexpr u32 GetDefaultBlockWidth(PixelFormat format) { | 347 | static constexpr u32 GetDefaultBlockWidth(PixelFormat format) { |
| @@ -353,97 +353,97 @@ static constexpr u32 GetDefaultBlockWidth(PixelFormat format) { | |||
| 353 | } | 353 | } |
| 354 | 354 | ||
| 355 | constexpr std::array<u32, MaxPixelFormat> block_height_table = {{ | 355 | constexpr std::array<u32, MaxPixelFormat> block_height_table = {{ |
| 356 | 1, // ABGR8U | 356 | 1, // A8B8G8R8_UNORM |
| 357 | 1, // ABGR8S | 357 | 1, // A8B8G8R8_SNORM |
| 358 | 1, // ABGR8I | 358 | 1, // A8B8G8R8_SINT |
| 359 | 1, // ABGR8UI | 359 | 1, // A8B8G8R8_UINT |
| 360 | 1, // B5G6R5U | 360 | 1, // R5G6B5_UNORM |
| 361 | 1, // R5G6B5U | 361 | 1, // B5G6R5_UNORM |
| 362 | 1, // B5G5R5A1U | 362 | 1, // A1R5G5B5_UNORM |
| 363 | 1, // A2B10G10R10U | 363 | 1, // A2B10G10R10_UNORM |
| 364 | 1, // A2B10G10R10UI | 364 | 1, // A2B10G10R10_UINT |
| 365 | 1, // A1B5G5R5U | 365 | 1, // A1B5G5R5_UNORM |
| 366 | 1, // R8U | 366 | 1, // R8_UNORM |
| 367 | 1, // R8S | 367 | 1, // R8_SNORM |
| 368 | 1, // R8I | 368 | 1, // R8_SINT |
| 369 | 1, // R8UI | 369 | 1, // R8_UINT |
| 370 | 1, // RGBA16F | 370 | 1, // R16G16B16A16_FLOAT |
| 371 | 1, // RGBA16U | 371 | 1, // R16G16B16A16_UNORM |
| 372 | 1, // RGBA16S | 372 | 1, // R16G16B16A16_SNORM |
| 373 | 1, // RGBA16I | 373 | 1, // R16G16B16A16_SINT |
| 374 | 1, // RGBA16UI | 374 | 1, // R16G16B16A16_UINT |
| 375 | 1, // R11FG11FB10F | 375 | 1, // B10G11R11_FLOAT |
| 376 | 1, // RGBA32UI | 376 | 1, // R32G32B32A32_UINT |
| 377 | 4, // DXT1 | 377 | 4, // BC1_RGBA_UNORM |
| 378 | 4, // DXT23 | 378 | 4, // BC2_UNORM |
| 379 | 4, // DXT45 | 379 | 4, // BC3_UNORM |
| 380 | 4, // DXN1UNORM | 380 | 4, // BC4_UNORM |
| 381 | 4, // DXN1SNORM | 381 | 4, // BC4_SNORM |
| 382 | 4, // DXN2UNORM | 382 | 4, // BC5_UNORM |
| 383 | 4, // DXN2SNORM | 383 | 4, // BC5_SNORM |
| 384 | 4, // BC7U | 384 | 4, // BC7_UNORM |
| 385 | 4, // BC6H_UF16 | 385 | 4, // BC6H_UFLOAT |
| 386 | 4, // BC6H_SF16 | 386 | 4, // BC6H_SFLOAT |
| 387 | 4, // ASTC_2D_4X4 | 387 | 4, // ASTC_2D_4X4_UNORM |
| 388 | 1, // BGRA8 | 388 | 1, // B8G8R8A8_UNORM |
| 389 | 1, // RGBA32F | 389 | 1, // R32G32B32A32_FLOAT |
| 390 | 1, // RGBA32I | 390 | 1, // R32G32B32A32_SINT |
| 391 | 1, // RG32F | 391 | 1, // R32G32_FLOAT |
| 392 | 1, // RG32I | 392 | 1, // R32G32_SINT |
| 393 | 1, // R32F | 393 | 1, // R32_FLOAT |
| 394 | 1, // R16F | 394 | 1, // R16_FLOAT |
| 395 | 1, // R16U | 395 | 1, // R16_UNORM |
| 396 | 1, // R16S | 396 | 1, // R16_SNORM |
| 397 | 1, // R16UI | 397 | 1, // R16_UINT |
| 398 | 1, // R16I | 398 | 1, // R16_SINT |
| 399 | 1, // RG16 | 399 | 1, // R16G16_UNORM |
| 400 | 1, // RG16F | 400 | 1, // R16G16_FLOAT |
| 401 | 1, // RG16UI | 401 | 1, // R16G16_UINT |
| 402 | 1, // RG16I | 402 | 1, // R16G16_SINT |
| 403 | 1, // RG16S | 403 | 1, // R16G16_SNORM |
| 404 | 1, // RGB32F | 404 | 1, // R32G32B32_FLOAT |
| 405 | 1, // RGBA8_SRGB | 405 | 1, // A8B8G8R8_SRGB |
| 406 | 1, // RG8U | 406 | 1, // R8G8_UNORM |
| 407 | 1, // RG8S | 407 | 1, // R8G8_SNORM |
| 408 | 1, // RG8I | 408 | 1, // R8G8_SINT |
| 409 | 1, // RG8UI | 409 | 1, // R8G8_UINT |
| 410 | 1, // RG32UI | 410 | 1, // R32G32_UINT |
| 411 | 1, // RGBX16F | 411 | 1, // R16G16B16X16_FLOAT |
| 412 | 1, // R32UI | 412 | 1, // R32_UINT |
| 413 | 1, // R32I | 413 | 1, // R32_SINT |
| 414 | 8, // ASTC_2D_8X8 | 414 | 8, // ASTC_2D_8X8_UNORM |
| 415 | 5, // ASTC_2D_8X5 | 415 | 5, // ASTC_2D_8X5_UNORM |
| 416 | 4, // ASTC_2D_5X4 | 416 | 4, // ASTC_2D_5X4_UNORM |
| 417 | 1, // BGRA8_SRGB | 417 | 1, // B8G8R8A8_SRGB |
| 418 | 4, // DXT1_SRGB | 418 | 4, // BC1_RGBA_SRGB |
| 419 | 4, // DXT23_SRGB | 419 | 4, // BC2_SRGB |
| 420 | 4, // DXT45_SRGB | 420 | 4, // BC3_SRGB |
| 421 | 4, // BC7U_SRGB | 421 | 4, // BC7_SRGB |
| 422 | 1, // R4G4B4A4U | 422 | 1, // A4B4G4R4_UNORM |
| 423 | 4, // ASTC_2D_4X4_SRGB | 423 | 4, // ASTC_2D_4X4_SRGB |
| 424 | 8, // ASTC_2D_8X8_SRGB | 424 | 8, // ASTC_2D_8X8_SRGB |
| 425 | 5, // ASTC_2D_8X5_SRGB | 425 | 5, // ASTC_2D_8X5_SRGB |
| 426 | 4, // ASTC_2D_5X4_SRGB | 426 | 4, // ASTC_2D_5X4_SRGB |
| 427 | 5, // ASTC_2D_5X5 | 427 | 5, // ASTC_2D_5X5_UNORM |
| 428 | 5, // ASTC_2D_5X5_SRGB | 428 | 5, // ASTC_2D_5X5_SRGB |
| 429 | 8, // ASTC_2D_10X8 | 429 | 8, // ASTC_2D_10X8_UNORM |
| 430 | 8, // ASTC_2D_10X8_SRGB | 430 | 8, // ASTC_2D_10X8_SRGB |
| 431 | 6, // ASTC_2D_6X6 | 431 | 6, // ASTC_2D_6X6_UNORM |
| 432 | 6, // ASTC_2D_6X6_SRGB | 432 | 6, // ASTC_2D_6X6_SRGB |
| 433 | 10, // ASTC_2D_10X10 | 433 | 10, // ASTC_2D_10X10_UNORM |
| 434 | 10, // ASTC_2D_10X10_SRGB | 434 | 10, // ASTC_2D_10X10_SRGB |
| 435 | 12, // ASTC_2D_12X12 | 435 | 12, // ASTC_2D_12X12_UNORM |
| 436 | 12, // ASTC_2D_12X12_SRGB | 436 | 12, // ASTC_2D_12X12_SRGB |
| 437 | 6, // ASTC_2D_8X6 | 437 | 6, // ASTC_2D_8X6_UNORM |
| 438 | 6, // ASTC_2D_8X6_SRGB | 438 | 6, // ASTC_2D_8X6_SRGB |
| 439 | 5, // ASTC_2D_6X5 | 439 | 5, // ASTC_2D_6X5_UNORM |
| 440 | 5, // ASTC_2D_6X5_SRGB | 440 | 5, // ASTC_2D_6X5_SRGB |
| 441 | 1, // E5B9G9R9F | 441 | 1, // E5B9G9R9_FLOAT |
| 442 | 1, // Z32F | 442 | 1, // D32_FLOAT |
| 443 | 1, // Z16 | 443 | 1, // D16_UNORM |
| 444 | 1, // Z24S8 | 444 | 1, // D24_UNORM_S8_UINT |
| 445 | 1, // S8Z24 | 445 | 1, // S8_UINT_D24_UNORM |
| 446 | 1, // Z32FS8 | 446 | 1, // D32_FLOAT_S8_UINT |
| 447 | }}; | 447 | }}; |
| 448 | 448 | ||
| 449 | static constexpr u32 GetDefaultBlockHeight(PixelFormat format) { | 449 | static constexpr u32 GetDefaultBlockHeight(PixelFormat format) { |
| @@ -455,97 +455,97 @@ static constexpr u32 GetDefaultBlockHeight(PixelFormat format) { | |||
| 455 | } | 455 | } |
| 456 | 456 | ||
| 457 | constexpr std::array<u32, MaxPixelFormat> bpp_table = {{ | 457 | constexpr std::array<u32, MaxPixelFormat> bpp_table = {{ |
| 458 | 32, // ABGR8U | 458 | 32, // A8B8G8R8_UNORM |
| 459 | 32, // ABGR8S | 459 | 32, // A8B8G8R8_SNORM |
| 460 | 32, // ABGR8I | 460 | 32, // A8B8G8R8_SINT |
| 461 | 32, // ABGR8UI | 461 | 32, // A8B8G8R8_UINT |
| 462 | 16, // B5G6R5U | 462 | 16, // R5G6B5_UNORM |
| 463 | 16, // R5G6B5U | 463 | 16, // B5G6R5_UNORM |
| 464 | 16, // B5G5R5A1U | 464 | 16, // A1R5G5B5_UNORM |
| 465 | 32, // A2B10G10R10U | 465 | 32, // A2B10G10R10_UNORM |
| 466 | 32, // A2B10G10R10UI | 466 | 32, // A2B10G10R10_UINT |
| 467 | 16, // A1B5G5R5U | 467 | 16, // A1B5G5R5_UNORM |
| 468 | 8, // R8U | 468 | 8, // R8_UNORM |
| 469 | 8, // R8S | 469 | 8, // R8_SNORM |
| 470 | 8, // R8I | 470 | 8, // R8_SINT |
| 471 | 8, // R8UI | 471 | 8, // R8_UINT |
| 472 | 64, // RGBA16F | 472 | 64, // R16G16B16A16_FLOAT |
| 473 | 64, // RGBA16U | 473 | 64, // R16G16B16A16_UNORM |
| 474 | 64, // RGBA16S | 474 | 64, // R16G16B16A16_SNORM |
| 475 | 64, // RGBA16I | 475 | 64, // R16G16B16A16_SINT |
| 476 | 64, // RGBA16UI | 476 | 64, // R16G16B16A16_UINT |
| 477 | 32, // R11FG11FB10F | 477 | 32, // B10G11R11_FLOAT |
| 478 | 128, // RGBA32UI | 478 | 128, // R32G32B32A32_UINT |
| 479 | 64, // DXT1 | 479 | 64, // BC1_RGBA_UNORM |
| 480 | 128, // DXT23 | 480 | 128, // BC2_UNORM |
| 481 | 128, // DXT45 | 481 | 128, // BC3_UNORM |
| 482 | 64, // DXN1UNORM | 482 | 64, // BC4_UNORM |
| 483 | 64, // DXN1SNORM | 483 | 64, // BC4_SNORM |
| 484 | 128, // DXN2UNORM | 484 | 128, // BC5_UNORM |
| 485 | 128, // DXN2SNORM | 485 | 128, // BC5_SNORM |
| 486 | 128, // BC7U | 486 | 128, // BC7_UNORM |
| 487 | 128, // BC6H_UF16 | 487 | 128, // BC6H_UFLOAT |
| 488 | 128, // BC6H_SF16 | 488 | 128, // BC6H_SFLOAT |
| 489 | 128, // ASTC_2D_4X4 | 489 | 128, // ASTC_2D_4X4_UNORM |
| 490 | 32, // BGRA8 | 490 | 32, // B8G8R8A8_UNORM |
| 491 | 128, // RGBA32F | 491 | 128, // R32G32B32A32_FLOAT |
| 492 | 128, // RGBA32I | 492 | 128, // R32G32B32A32_SINT |
| 493 | 64, // RG32F | 493 | 64, // R32G32_FLOAT |
| 494 | 64, // RG32I | 494 | 64, // R32G32_SINT |
| 495 | 32, // R32F | 495 | 32, // R32_FLOAT |
| 496 | 16, // R16F | 496 | 16, // R16_FLOAT |
| 497 | 16, // R16U | 497 | 16, // R16_UNORM |
| 498 | 16, // R16S | 498 | 16, // R16_SNORM |
| 499 | 16, // R16UI | 499 | 16, // R16_UINT |
| 500 | 16, // R16I | 500 | 16, // R16_SINT |
| 501 | 32, // RG16 | 501 | 32, // R16G16_UNORM |
| 502 | 32, // RG16F | 502 | 32, // R16G16_FLOAT |
| 503 | 32, // RG16UI | 503 | 32, // R16G16_UINT |
| 504 | 32, // RG16I | 504 | 32, // R16G16_SINT |
| 505 | 32, // RG16S | 505 | 32, // R16G16_SNORM |
| 506 | 96, // RGB32F | 506 | 96, // R32G32B32_FLOAT |
| 507 | 32, // RGBA8_SRGB | 507 | 32, // A8B8G8R8_SRGB |
| 508 | 16, // RG8U | 508 | 16, // R8G8_UNORM |
| 509 | 16, // RG8S | 509 | 16, // R8G8_SNORM |
| 510 | 16, // RG8I | 510 | 16, // R8G8_SINT |
| 511 | 16, // RG8UI | 511 | 16, // R8G8_UINT |
| 512 | 64, // RG32UI | 512 | 64, // R32G32_UINT |
| 513 | 64, // RGBX16F | 513 | 64, // R16G16B16X16_FLOAT |
| 514 | 32, // R32UI | 514 | 32, // R32_UINT |
| 515 | 32, // R32I | 515 | 32, // R32_SINT |
| 516 | 128, // ASTC_2D_8X8 | 516 | 128, // ASTC_2D_8X8_UNORM |
| 517 | 128, // ASTC_2D_8X5 | 517 | 128, // ASTC_2D_8X5_UNORM |
| 518 | 128, // ASTC_2D_5X4 | 518 | 128, // ASTC_2D_5X4_UNORM |
| 519 | 32, // BGRA8_SRGB | 519 | 32, // B8G8R8A8_SRGB |
| 520 | 64, // DXT1_SRGB | 520 | 64, // BC1_RGBA_SRGB |
| 521 | 128, // DXT23_SRGB | 521 | 128, // BC2_SRGB |
| 522 | 128, // DXT45_SRGB | 522 | 128, // BC3_SRGB |
| 523 | 128, // BC7U | 523 | 128, // BC7_UNORM |
| 524 | 16, // R4G4B4A4U | 524 | 16, // A4B4G4R4_UNORM |
| 525 | 128, // ASTC_2D_4X4_SRGB | 525 | 128, // ASTC_2D_4X4_SRGB |
| 526 | 128, // ASTC_2D_8X8_SRGB | 526 | 128, // ASTC_2D_8X8_SRGB |
| 527 | 128, // ASTC_2D_8X5_SRGB | 527 | 128, // ASTC_2D_8X5_SRGB |
| 528 | 128, // ASTC_2D_5X4_SRGB | 528 | 128, // ASTC_2D_5X4_SRGB |
| 529 | 128, // ASTC_2D_5X5 | 529 | 128, // ASTC_2D_5X5_UNORM |
| 530 | 128, // ASTC_2D_5X5_SRGB | 530 | 128, // ASTC_2D_5X5_SRGB |
| 531 | 128, // ASTC_2D_10X8 | 531 | 128, // ASTC_2D_10X8_UNORM |
| 532 | 128, // ASTC_2D_10X8_SRGB | 532 | 128, // ASTC_2D_10X8_SRGB |
| 533 | 128, // ASTC_2D_6X6 | 533 | 128, // ASTC_2D_6X6_UNORM |
| 534 | 128, // ASTC_2D_6X6_SRGB | 534 | 128, // ASTC_2D_6X6_SRGB |
| 535 | 128, // ASTC_2D_10X10 | 535 | 128, // ASTC_2D_10X10_UNORM |
| 536 | 128, // ASTC_2D_10X10_SRGB | 536 | 128, // ASTC_2D_10X10_SRGB |
| 537 | 128, // ASTC_2D_12X12 | 537 | 128, // ASTC_2D_12X12_UNORM |
| 538 | 128, // ASTC_2D_12X12_SRGB | 538 | 128, // ASTC_2D_12X12_SRGB |
| 539 | 128, // ASTC_2D_8X6 | 539 | 128, // ASTC_2D_8X6_UNORM |
| 540 | 128, // ASTC_2D_8X6_SRGB | 540 | 128, // ASTC_2D_8X6_SRGB |
| 541 | 128, // ASTC_2D_6X5 | 541 | 128, // ASTC_2D_6X5_UNORM |
| 542 | 128, // ASTC_2D_6X5_SRGB | 542 | 128, // ASTC_2D_6X5_SRGB |
| 543 | 32, // E5B9G9R9F | 543 | 32, // E5B9G9R9_FLOAT |
| 544 | 32, // Z32F | 544 | 32, // D32_FLOAT |
| 545 | 16, // Z16 | 545 | 16, // D16_UNORM |
| 546 | 32, // Z24S8 | 546 | 32, // D24_UNORM_S8_UINT |
| 547 | 32, // S8Z24 | 547 | 32, // S8_UINT_D24_UNORM |
| 548 | 64, // Z32FS8 | 548 | 64, // D32_FLOAT_S8_UINT |
| 549 | }}; | 549 | }}; |
| 550 | 550 | ||
| 551 | static constexpr u32 GetFormatBpp(PixelFormat format) { | 551 | static constexpr u32 GetFormatBpp(PixelFormat format) { |
diff --git a/src/video_core/texture_cache/format_lookup_table.cpp b/src/video_core/texture_cache/format_lookup_table.cpp index 148a3935d..a1cc4756d 100644 --- a/src/video_core/texture_cache/format_lookup_table.cpp +++ b/src/video_core/texture_cache/format_lookup_table.cpp | |||
| @@ -42,125 +42,125 @@ struct Table { | |||
| 42 | bool is_srgb; | 42 | bool is_srgb; |
| 43 | }; | 43 | }; |
| 44 | constexpr std::array<Table, 86> DefinitionTable = {{ | 44 | constexpr std::array<Table, 86> DefinitionTable = {{ |
| 45 | {TextureFormat::A8R8G8B8, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ABGR8U}, | 45 | {TextureFormat::A8R8G8B8, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::A8B8G8R8_UNORM}, |
| 46 | {TextureFormat::A8R8G8B8, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::ABGR8S}, | 46 | {TextureFormat::A8R8G8B8, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::A8B8G8R8_SNORM}, |
| 47 | {TextureFormat::A8R8G8B8, C, UINT, UINT, UINT, UINT, PixelFormat::ABGR8UI}, | 47 | {TextureFormat::A8R8G8B8, C, UINT, UINT, UINT, UINT, PixelFormat::A8B8G8R8_UINT}, |
| 48 | {TextureFormat::A8R8G8B8, C, SINT, SINT, SINT, SINT, PixelFormat::ABGR8I}, | 48 | {TextureFormat::A8R8G8B8, C, SINT, SINT, SINT, SINT, PixelFormat::A8B8G8R8_SINT}, |
| 49 | {TextureFormat::A8R8G8B8, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::RGBA8_SRGB}, | 49 | {TextureFormat::A8R8G8B8, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::A8B8G8R8_SRGB}, |
| 50 | 50 | ||
| 51 | {TextureFormat::B5G6R5, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::R5G6B5U}, | 51 | {TextureFormat::B5G6R5, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::B5G6R5_UNORM}, |
| 52 | 52 | ||
| 53 | {TextureFormat::A2B10G10R10, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::A2B10G10R10U}, | 53 | {TextureFormat::A2B10G10R10, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::A2B10G10R10_UNORM}, |
| 54 | {TextureFormat::A2B10G10R10, C, UINT, UINT, UINT, UINT, PixelFormat::A2B10G10R10UI}, | 54 | {TextureFormat::A2B10G10R10, C, UINT, UINT, UINT, UINT, PixelFormat::A2B10G10R10_UINT}, |
| 55 | 55 | ||
| 56 | {TextureFormat::A1B5G5R5, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::A1B5G5R5U}, | 56 | {TextureFormat::A1B5G5R5, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::A1B5G5R5_UNORM}, |
| 57 | 57 | ||
| 58 | {TextureFormat::A4B4G4R4, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::R4G4B4A4U}, | 58 | {TextureFormat::A4B4G4R4, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::A4B4G4R4_UNORM}, |
| 59 | 59 | ||
| 60 | {TextureFormat::R8, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::R8U}, | 60 | {TextureFormat::R8, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::R8_UNORM}, |
| 61 | {TextureFormat::R8, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::R8S}, | 61 | {TextureFormat::R8, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::R8_SNORM}, |
| 62 | {TextureFormat::R8, C, UINT, UINT, UINT, UINT, PixelFormat::R8UI}, | 62 | {TextureFormat::R8, C, UINT, UINT, UINT, UINT, PixelFormat::R8_UINT}, |
| 63 | {TextureFormat::R8, C, SINT, SINT, SINT, SINT, PixelFormat::R8I}, | 63 | {TextureFormat::R8, C, SINT, SINT, SINT, SINT, PixelFormat::R8_SINT}, |
| 64 | 64 | ||
| 65 | {TextureFormat::G8R8, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::RG8U}, | 65 | {TextureFormat::R8G8, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::R8G8_UNORM}, |
| 66 | {TextureFormat::G8R8, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::RG8S}, | 66 | {TextureFormat::R8G8, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::R8G8_SNORM}, |
| 67 | {TextureFormat::G8R8, C, UINT, UINT, UINT, UINT, PixelFormat::RG8UI}, | 67 | {TextureFormat::R8G8, C, UINT, UINT, UINT, UINT, PixelFormat::R8G8_UINT}, |
| 68 | {TextureFormat::G8R8, C, SINT, SINT, SINT, SINT, PixelFormat::RG8I}, | 68 | {TextureFormat::R8G8, C, SINT, SINT, SINT, SINT, PixelFormat::R8G8_SINT}, |
| 69 | 69 | ||
| 70 | {TextureFormat::R16_G16_B16_A16, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::RGBA16S}, | 70 | {TextureFormat::R16G16B16A16, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::R16G16B16A16_SNORM}, |
| 71 | {TextureFormat::R16_G16_B16_A16, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::RGBA16U}, | 71 | {TextureFormat::R16G16B16A16, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::R16G16B16A16_UNORM}, |
| 72 | {TextureFormat::R16_G16_B16_A16, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::RGBA16F}, | 72 | {TextureFormat::R16G16B16A16, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::R16G16B16A16_FLOAT}, |
| 73 | {TextureFormat::R16_G16_B16_A16, C, UINT, UINT, UINT, UINT, PixelFormat::RGBA16UI}, | 73 | {TextureFormat::R16G16B16A16, C, UINT, UINT, UINT, UINT, PixelFormat::R16G16B16A16_UINT}, |
| 74 | {TextureFormat::R16_G16_B16_A16, C, SINT, SINT, SINT, SINT, PixelFormat::RGBA16I}, | 74 | {TextureFormat::R16G16B16A16, C, SINT, SINT, SINT, SINT, PixelFormat::R16G16B16A16_SINT}, |
| 75 | 75 | ||
| 76 | {TextureFormat::R16_G16, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::RG16F}, | 76 | {TextureFormat::R16G16, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::R16G16_FLOAT}, |
| 77 | {TextureFormat::R16_G16, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::RG16}, | 77 | {TextureFormat::R16G16, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::R16G16_UNORM}, |
| 78 | {TextureFormat::R16_G16, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::RG16S}, | 78 | {TextureFormat::R16G16, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::R16G16_SNORM}, |
| 79 | {TextureFormat::R16_G16, C, UINT, UINT, UINT, UINT, PixelFormat::RG16UI}, | 79 | {TextureFormat::R16G16, C, UINT, UINT, UINT, UINT, PixelFormat::R16G16_UINT}, |
| 80 | {TextureFormat::R16_G16, C, SINT, SINT, SINT, SINT, PixelFormat::RG16I}, | 80 | {TextureFormat::R16G16, C, SINT, SINT, SINT, SINT, PixelFormat::R16G16_SINT}, |
| 81 | 81 | ||
| 82 | {TextureFormat::R16, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::R16F}, | 82 | {TextureFormat::R16, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::R16_FLOAT}, |
| 83 | {TextureFormat::R16, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::R16U}, | 83 | {TextureFormat::R16, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::R16_UNORM}, |
| 84 | {TextureFormat::R16, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::R16S}, | 84 | {TextureFormat::R16, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::R16_SNORM}, |
| 85 | {TextureFormat::R16, C, UINT, UINT, UINT, UINT, PixelFormat::R16UI}, | 85 | {TextureFormat::R16, C, UINT, UINT, UINT, UINT, PixelFormat::R16_UINT}, |
| 86 | {TextureFormat::R16, C, SINT, SINT, SINT, SINT, PixelFormat::R16I}, | 86 | {TextureFormat::R16, C, SINT, SINT, SINT, SINT, PixelFormat::R16_SINT}, |
| 87 | 87 | ||
| 88 | {TextureFormat::BF10GF11RF11, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::R11FG11FB10F}, | 88 | {TextureFormat::B10G11R11, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::B10G11R11_FLOAT}, |
| 89 | 89 | ||
| 90 | {TextureFormat::R32_G32_B32_A32, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::RGBA32F}, | 90 | {TextureFormat::R32G32B32A32, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::R32G32B32A32_FLOAT}, |
| 91 | {TextureFormat::R32_G32_B32_A32, C, UINT, UINT, UINT, UINT, PixelFormat::RGBA32UI}, | 91 | {TextureFormat::R32G32B32A32, C, UINT, UINT, UINT, UINT, PixelFormat::R32G32B32A32_UINT}, |
| 92 | {TextureFormat::R32_G32_B32_A32, C, SINT, SINT, SINT, SINT, PixelFormat::RGBA32I}, | 92 | {TextureFormat::R32G32B32A32, C, SINT, SINT, SINT, SINT, PixelFormat::R32G32B32A32_SINT}, |
| 93 | 93 | ||
| 94 | {TextureFormat::R32_G32_B32, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::RGB32F}, | 94 | {TextureFormat::R32G32B32, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::R32G32B32_FLOAT}, |
| 95 | 95 | ||
| 96 | {TextureFormat::R32_G32, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::RG32F}, | 96 | {TextureFormat::R32G32, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::R32G32_FLOAT}, |
| 97 | {TextureFormat::R32_G32, C, UINT, UINT, UINT, UINT, PixelFormat::RG32UI}, | 97 | {TextureFormat::R32G32, C, UINT, UINT, UINT, UINT, PixelFormat::R32G32_UINT}, |
| 98 | {TextureFormat::R32_G32, C, SINT, SINT, SINT, SINT, PixelFormat::RG32I}, | 98 | {TextureFormat::R32G32, C, SINT, SINT, SINT, SINT, PixelFormat::R32G32_SINT}, |
| 99 | 99 | ||
| 100 | {TextureFormat::R32, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::R32F}, | 100 | {TextureFormat::R32, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::R32_FLOAT}, |
| 101 | {TextureFormat::R32, C, UINT, UINT, UINT, UINT, PixelFormat::R32UI}, | 101 | {TextureFormat::R32, C, UINT, UINT, UINT, UINT, PixelFormat::R32_UINT}, |
| 102 | {TextureFormat::R32, C, SINT, SINT, SINT, SINT, PixelFormat::R32I}, | 102 | {TextureFormat::R32, C, SINT, SINT, SINT, SINT, PixelFormat::R32_SINT}, |
| 103 | 103 | ||
| 104 | {TextureFormat::E5B9G9R9_SHAREDEXP, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::E5B9G9R9F}, | 104 | {TextureFormat::E5B9G9R9, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::E5B9G9R9_FLOAT}, |
| 105 | 105 | ||
| 106 | {TextureFormat::ZF32, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::Z32F}, | 106 | {TextureFormat::D32, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::D32_FLOAT}, |
| 107 | {TextureFormat::Z16, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::Z16}, | 107 | {TextureFormat::D16, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::D16_UNORM}, |
| 108 | {TextureFormat::S8Z24, C, UINT, UNORM, UNORM, UNORM, PixelFormat::S8Z24}, | 108 | {TextureFormat::S8D24, C, UINT, UNORM, UNORM, UNORM, PixelFormat::S8_UINT_D24_UNORM}, |
| 109 | {TextureFormat::G24R8, C, UINT, UNORM, UNORM, UNORM, PixelFormat::S8Z24}, | 109 | {TextureFormat::R8G24, C, UINT, UNORM, UNORM, UNORM, PixelFormat::S8_UINT_D24_UNORM}, |
| 110 | {TextureFormat::ZF32_X24S8, C, FLOAT, UINT, UNORM, UNORM, PixelFormat::Z32FS8}, | 110 | {TextureFormat::D32S8, C, FLOAT, UINT, UNORM, UNORM, PixelFormat::D32_FLOAT_S8_UINT}, |
| 111 | 111 | ||
| 112 | {TextureFormat::DXT1, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::DXT1}, | 112 | {TextureFormat::BC1_RGBA, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::BC1_RGBA_UNORM}, |
| 113 | {TextureFormat::DXT1, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::DXT1_SRGB}, | 113 | {TextureFormat::BC1_RGBA, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::BC1_RGBA_SRGB}, |
| 114 | 114 | ||
| 115 | {TextureFormat::DXT23, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::DXT23}, | 115 | {TextureFormat::BC2, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::BC2_UNORM}, |
| 116 | {TextureFormat::DXT23, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::DXT23_SRGB}, | 116 | {TextureFormat::BC2, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::BC2_SRGB}, |
| 117 | 117 | ||
| 118 | {TextureFormat::DXT45, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::DXT45}, | 118 | {TextureFormat::BC3, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::BC3_UNORM}, |
| 119 | {TextureFormat::DXT45, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::DXT45_SRGB}, | 119 | {TextureFormat::BC3, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::BC3_SRGB}, |
| 120 | 120 | ||
| 121 | {TextureFormat::DXN1, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::DXN1UNORM}, | 121 | {TextureFormat::BC4, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::BC4_UNORM}, |
| 122 | {TextureFormat::DXN1, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::DXN1SNORM}, | 122 | {TextureFormat::BC4, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::BC4_SNORM}, |
| 123 | 123 | ||
| 124 | {TextureFormat::DXN2, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::DXN2UNORM}, | 124 | {TextureFormat::BC5, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::BC5_UNORM}, |
| 125 | {TextureFormat::DXN2, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::DXN2SNORM}, | 125 | {TextureFormat::BC5, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::BC5_SNORM}, |
| 126 | 126 | ||
| 127 | {TextureFormat::BC7U, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::BC7U}, | 127 | {TextureFormat::BC7, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::BC7_UNORM}, |
| 128 | {TextureFormat::BC7U, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::BC7U_SRGB}, | 128 | {TextureFormat::BC7, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::BC7_SRGB}, |
| 129 | 129 | ||
| 130 | {TextureFormat::BC6H_SF16, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::BC6H_SF16}, | 130 | {TextureFormat::BC6H_SFLOAT, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::BC6H_SFLOAT}, |
| 131 | {TextureFormat::BC6H_UF16, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::BC6H_UF16}, | 131 | {TextureFormat::BC6H_UFLOAT, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::BC6H_UFLOAT}, |
| 132 | 132 | ||
| 133 | {TextureFormat::ASTC_2D_4X4, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_4X4}, | 133 | {TextureFormat::ASTC_2D_4X4, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_4X4_UNORM}, |
| 134 | {TextureFormat::ASTC_2D_4X4, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_4X4_SRGB}, | 134 | {TextureFormat::ASTC_2D_4X4, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_4X4_SRGB}, |
| 135 | 135 | ||
| 136 | {TextureFormat::ASTC_2D_5X4, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_5X4}, | 136 | {TextureFormat::ASTC_2D_5X4, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_5X4_UNORM}, |
| 137 | {TextureFormat::ASTC_2D_5X4, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_5X4_SRGB}, | 137 | {TextureFormat::ASTC_2D_5X4, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_5X4_SRGB}, |
| 138 | 138 | ||
| 139 | {TextureFormat::ASTC_2D_5X5, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_5X5}, | 139 | {TextureFormat::ASTC_2D_5X5, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_5X5_UNORM}, |
| 140 | {TextureFormat::ASTC_2D_5X5, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_5X5_SRGB}, | 140 | {TextureFormat::ASTC_2D_5X5, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_5X5_SRGB}, |
| 141 | 141 | ||
| 142 | {TextureFormat::ASTC_2D_8X8, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_8X8}, | 142 | {TextureFormat::ASTC_2D_8X8, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_8X8_UNORM}, |
| 143 | {TextureFormat::ASTC_2D_8X8, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_8X8_SRGB}, | 143 | {TextureFormat::ASTC_2D_8X8, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_8X8_SRGB}, |
| 144 | 144 | ||
| 145 | {TextureFormat::ASTC_2D_8X5, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_8X5}, | 145 | {TextureFormat::ASTC_2D_8X5, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_8X5_UNORM}, |
| 146 | {TextureFormat::ASTC_2D_8X5, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_8X5_SRGB}, | 146 | {TextureFormat::ASTC_2D_8X5, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_8X5_SRGB}, |
| 147 | 147 | ||
| 148 | {TextureFormat::ASTC_2D_10X8, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_10X8}, | 148 | {TextureFormat::ASTC_2D_10X8, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_10X8_UNORM}, |
| 149 | {TextureFormat::ASTC_2D_10X8, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_10X8_SRGB}, | 149 | {TextureFormat::ASTC_2D_10X8, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_10X8_SRGB}, |
| 150 | 150 | ||
| 151 | {TextureFormat::ASTC_2D_6X6, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_6X6}, | 151 | {TextureFormat::ASTC_2D_6X6, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_6X6_UNORM}, |
| 152 | {TextureFormat::ASTC_2D_6X6, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_6X6_SRGB}, | 152 | {TextureFormat::ASTC_2D_6X6, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_6X6_SRGB}, |
| 153 | 153 | ||
| 154 | {TextureFormat::ASTC_2D_10X10, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_10X10}, | 154 | {TextureFormat::ASTC_2D_10X10, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_10X10_UNORM}, |
| 155 | {TextureFormat::ASTC_2D_10X10, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_10X10_SRGB}, | 155 | {TextureFormat::ASTC_2D_10X10, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_10X10_SRGB}, |
| 156 | 156 | ||
| 157 | {TextureFormat::ASTC_2D_12X12, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_12X12}, | 157 | {TextureFormat::ASTC_2D_12X12, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_12X12_UNORM}, |
| 158 | {TextureFormat::ASTC_2D_12X12, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_12X12_SRGB}, | 158 | {TextureFormat::ASTC_2D_12X12, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_12X12_SRGB}, |
| 159 | 159 | ||
| 160 | {TextureFormat::ASTC_2D_8X6, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_8X6}, | 160 | {TextureFormat::ASTC_2D_8X6, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_8X6_UNORM}, |
| 161 | {TextureFormat::ASTC_2D_8X6, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_8X6_SRGB}, | 161 | {TextureFormat::ASTC_2D_8X6, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_8X6_SRGB}, |
| 162 | 162 | ||
| 163 | {TextureFormat::ASTC_2D_6X5, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_6X5}, | 163 | {TextureFormat::ASTC_2D_6X5, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_6X5_UNORM}, |
| 164 | {TextureFormat::ASTC_2D_6X5, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_6X5_SRGB}, | 164 | {TextureFormat::ASTC_2D_6X5, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_6X5_SRGB}, |
| 165 | }}; | 165 | }}; |
| 166 | 166 | ||
| @@ -191,7 +191,7 @@ PixelFormat FormatLookupTable::GetPixelFormat(TextureFormat format, bool is_srgb | |||
| 191 | static_cast<int>(format), is_srgb, static_cast<int>(red_component), | 191 | static_cast<int>(format), is_srgb, static_cast<int>(red_component), |
| 192 | static_cast<int>(green_component), static_cast<int>(blue_component), | 192 | static_cast<int>(green_component), static_cast<int>(blue_component), |
| 193 | static_cast<int>(alpha_component)); | 193 | static_cast<int>(alpha_component)); |
| 194 | return PixelFormat::ABGR8U; | 194 | return PixelFormat::A8B8G8R8_UNORM; |
| 195 | } | 195 | } |
| 196 | 196 | ||
| 197 | void FormatLookupTable::Set(TextureFormat format, bool is_srgb, ComponentType red_component, | 197 | void FormatLookupTable::Set(TextureFormat format, bool is_srgb, ComponentType red_component, |
diff --git a/src/video_core/texture_cache/surface_base.cpp b/src/video_core/texture_cache/surface_base.cpp index 0caf3b4f0..dfcf36e0b 100644 --- a/src/video_core/texture_cache/surface_base.cpp +++ b/src/video_core/texture_cache/surface_base.cpp | |||
| @@ -228,7 +228,7 @@ void SurfaceBaseImpl::LoadBuffer(Tegra::MemoryManager& memory_manager, | |||
| 228 | } | 228 | } |
| 229 | } | 229 | } |
| 230 | 230 | ||
| 231 | if (!is_converted && params.pixel_format != PixelFormat::S8Z24) { | 231 | if (!is_converted && params.pixel_format != PixelFormat::S8_UINT_D24_UNORM) { |
| 232 | return; | 232 | return; |
| 233 | } | 233 | } |
| 234 | 234 | ||
diff --git a/src/video_core/texture_cache/surface_params.cpp b/src/video_core/texture_cache/surface_params.cpp index 0b2b2b8c4..1803fce15 100644 --- a/src/video_core/texture_cache/surface_params.cpp +++ b/src/video_core/texture_cache/surface_params.cpp | |||
| @@ -83,12 +83,12 @@ SurfaceParams SurfaceParams::CreateForTexture(const FormatLookupTable& lookup_ta | |||
| 83 | params.type = GetFormatType(params.pixel_format); | 83 | params.type = GetFormatType(params.pixel_format); |
| 84 | if (entry.is_shadow && params.type == SurfaceType::ColorTexture) { | 84 | if (entry.is_shadow && params.type == SurfaceType::ColorTexture) { |
| 85 | switch (params.pixel_format) { | 85 | switch (params.pixel_format) { |
| 86 | case PixelFormat::R16U: | 86 | case PixelFormat::R16_UNORM: |
| 87 | case PixelFormat::R16F: | 87 | case PixelFormat::R16_FLOAT: |
| 88 | params.pixel_format = PixelFormat::Z16; | 88 | params.pixel_format = PixelFormat::D16_UNORM; |
| 89 | break; | 89 | break; |
| 90 | case PixelFormat::R32F: | 90 | case PixelFormat::R32_FLOAT: |
| 91 | params.pixel_format = PixelFormat::Z32F; | 91 | params.pixel_format = PixelFormat::D32_FLOAT; |
| 92 | break; | 92 | break; |
| 93 | default: | 93 | default: |
| 94 | UNIMPLEMENTED_MSG("Unimplemented shadow convert format: {}", | 94 | UNIMPLEMENTED_MSG("Unimplemented shadow convert format: {}", |
| @@ -195,8 +195,8 @@ SurfaceParams SurfaceParams::CreateForFramebuffer(Core::System& system, std::siz | |||
| 195 | SurfaceParams params; | 195 | SurfaceParams params; |
| 196 | params.is_tiled = | 196 | params.is_tiled = |
| 197 | config.memory_layout.type == Tegra::Engines::Maxwell3D::Regs::InvMemoryLayout::BlockLinear; | 197 | config.memory_layout.type == Tegra::Engines::Maxwell3D::Regs::InvMemoryLayout::BlockLinear; |
| 198 | params.srgb_conversion = config.format == Tegra::RenderTargetFormat::BGRA8_SRGB || | 198 | params.srgb_conversion = config.format == Tegra::RenderTargetFormat::B8G8R8A8_SRGB || |
| 199 | config.format == Tegra::RenderTargetFormat::RGBA8_SRGB; | 199 | config.format == Tegra::RenderTargetFormat::A8B8G8R8_SRGB; |
| 200 | params.block_width = config.memory_layout.block_width; | 200 | params.block_width = config.memory_layout.block_width; |
| 201 | params.block_height = config.memory_layout.block_height; | 201 | params.block_height = config.memory_layout.block_height; |
| 202 | params.block_depth = config.memory_layout.block_depth; | 202 | params.block_depth = config.memory_layout.block_depth; |
| @@ -235,8 +235,8 @@ SurfaceParams SurfaceParams::CreateForFermiCopySurface( | |||
| 235 | const Tegra::Engines::Fermi2D::Regs::Surface& config) { | 235 | const Tegra::Engines::Fermi2D::Regs::Surface& config) { |
| 236 | SurfaceParams params{}; | 236 | SurfaceParams params{}; |
| 237 | params.is_tiled = !config.linear; | 237 | params.is_tiled = !config.linear; |
| 238 | params.srgb_conversion = config.format == Tegra::RenderTargetFormat::BGRA8_SRGB || | 238 | params.srgb_conversion = config.format == Tegra::RenderTargetFormat::B8G8R8A8_SRGB || |
| 239 | config.format == Tegra::RenderTargetFormat::RGBA8_SRGB; | 239 | config.format == Tegra::RenderTargetFormat::A8B8G8R8_SRGB; |
| 240 | params.block_width = params.is_tiled ? std::min(config.BlockWidth(), 5U) : 0, | 240 | params.block_width = params.is_tiled ? std::min(config.BlockWidth(), 5U) : 0, |
| 241 | params.block_height = params.is_tiled ? std::min(config.BlockHeight(), 5U) : 0, | 241 | params.block_height = params.is_tiled ? std::min(config.BlockHeight(), 5U) : 0, |
| 242 | params.block_depth = params.is_tiled ? std::min(config.BlockDepth(), 5U) : 0, | 242 | params.block_depth = params.is_tiled ? std::min(config.BlockDepth(), 5U) : 0, |
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index cdcddb225..96c4e4cc2 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h | |||
| @@ -373,9 +373,9 @@ protected: | |||
| 373 | siblings_table[static_cast<std::size_t>(b)] = a; | 373 | siblings_table[static_cast<std::size_t>(b)] = a; |
| 374 | }; | 374 | }; |
| 375 | std::fill(siblings_table.begin(), siblings_table.end(), PixelFormat::Invalid); | 375 | std::fill(siblings_table.begin(), siblings_table.end(), PixelFormat::Invalid); |
| 376 | make_siblings(PixelFormat::Z16, PixelFormat::R16U); | 376 | make_siblings(PixelFormat::D16_UNORM, PixelFormat::R16_UNORM); |
| 377 | make_siblings(PixelFormat::Z32F, PixelFormat::R32F); | 377 | make_siblings(PixelFormat::D32_FLOAT, PixelFormat::R32_FLOAT); |
| 378 | make_siblings(PixelFormat::Z32FS8, PixelFormat::RG32F); | 378 | make_siblings(PixelFormat::D32_FLOAT_S8_UINT, PixelFormat::R32G32_FLOAT); |
| 379 | 379 | ||
| 380 | sampled_textures.reserve(64); | 380 | sampled_textures.reserve(64); |
| 381 | } | 381 | } |
| @@ -1031,7 +1031,7 @@ private: | |||
| 1031 | params.pitch = 4; | 1031 | params.pitch = 4; |
| 1032 | params.num_levels = 1; | 1032 | params.num_levels = 1; |
| 1033 | params.emulated_levels = 1; | 1033 | params.emulated_levels = 1; |
| 1034 | params.pixel_format = VideoCore::Surface::PixelFormat::R8U; | 1034 | params.pixel_format = VideoCore::Surface::PixelFormat::R8_UNORM; |
| 1035 | params.type = VideoCore::Surface::SurfaceType::ColorTexture; | 1035 | params.type = VideoCore::Surface::SurfaceType::ColorTexture; |
| 1036 | auto surface = CreateSurface(0ULL, params); | 1036 | auto surface = CreateSurface(0ULL, params); |
| 1037 | invalid_memory.resize(surface->GetHostSizeInBytes(), 0U); | 1037 | invalid_memory.resize(surface->GetHostSizeInBytes(), 0U); |
diff --git a/src/video_core/textures/convert.cpp b/src/video_core/textures/convert.cpp index f3efa7eb0..962921483 100644 --- a/src/video_core/textures/convert.cpp +++ b/src/video_core/textures/convert.cpp | |||
| @@ -35,7 +35,7 @@ void SwapS8Z24ToZ24S8(u8* data, u32 width, u32 height) { | |||
| 35 | S8Z24 s8z24_pixel{}; | 35 | S8Z24 s8z24_pixel{}; |
| 36 | Z24S8 z24s8_pixel{}; | 36 | Z24S8 z24s8_pixel{}; |
| 37 | constexpr auto bpp{ | 37 | constexpr auto bpp{ |
| 38 | VideoCore::Surface::GetBytesPerPixel(VideoCore::Surface::PixelFormat::S8Z24)}; | 38 | VideoCore::Surface::GetBytesPerPixel(VideoCore::Surface::PixelFormat::S8_UINT_D24_UNORM)}; |
| 39 | for (std::size_t y = 0; y < height; ++y) { | 39 | for (std::size_t y = 0; y < height; ++y) { |
| 40 | for (std::size_t x = 0; x < width; ++x) { | 40 | for (std::size_t x = 0; x < width; ++x) { |
| 41 | const std::size_t offset{bpp * (y * width + x)}; | 41 | const std::size_t offset{bpp * (y * width + x)}; |
| @@ -73,7 +73,7 @@ void ConvertFromGuestToHost(u8* in_data, u8* out_data, PixelFormat pixel_format, | |||
| 73 | in_data, width, height, depth, block_width, block_height); | 73 | in_data, width, height, depth, block_width, block_height); |
| 74 | std::copy(rgba8_data.begin(), rgba8_data.end(), out_data); | 74 | std::copy(rgba8_data.begin(), rgba8_data.end(), out_data); |
| 75 | 75 | ||
| 76 | } else if (convert_s8z24 && pixel_format == PixelFormat::S8Z24) { | 76 | } else if (convert_s8z24 && pixel_format == PixelFormat::S8_UINT_D24_UNORM) { |
| 77 | Tegra::Texture::ConvertS8Z24ToZ24S8(in_data, width, height); | 77 | Tegra::Texture::ConvertS8Z24ToZ24S8(in_data, width, height); |
| 78 | } | 78 | } |
| 79 | } | 79 | } |
| @@ -85,7 +85,7 @@ void ConvertFromHostToGuest(u8* data, PixelFormat pixel_format, u32 width, u32 h | |||
| 85 | static_cast<u32>(pixel_format)); | 85 | static_cast<u32>(pixel_format)); |
| 86 | UNREACHABLE(); | 86 | UNREACHABLE(); |
| 87 | 87 | ||
| 88 | } else if (convert_s8z24 && pixel_format == PixelFormat::S8Z24) { | 88 | } else if (convert_s8z24 && pixel_format == PixelFormat::S8_UINT_D24_UNORM) { |
| 89 | Tegra::Texture::ConvertZ24S8ToS8Z24(data, width, height); | 89 | Tegra::Texture::ConvertZ24S8ToS8Z24(data, width, height); |
| 90 | } | 90 | } |
| 91 | } | 91 | } |
diff --git a/src/video_core/textures/decoders.cpp b/src/video_core/textures/decoders.cpp index 548e4c3fe..0cd17cb89 100644 --- a/src/video_core/textures/decoders.cpp +++ b/src/video_core/textures/decoders.cpp | |||
| @@ -193,53 +193,6 @@ void CopySwizzledData(u32 width, u32 height, u32 depth, u32 bytes_per_pixel, | |||
| 193 | } | 193 | } |
| 194 | } | 194 | } |
| 195 | 195 | ||
| 196 | u32 BytesPerPixel(TextureFormat format) { | ||
| 197 | switch (format) { | ||
| 198 | case TextureFormat::DXT1: | ||
| 199 | case TextureFormat::DXN1: | ||
| 200 | // In this case a 'pixel' actually refers to a 4x4 tile. | ||
| 201 | return 8; | ||
| 202 | case TextureFormat::DXT23: | ||
| 203 | case TextureFormat::DXT45: | ||
| 204 | case TextureFormat::DXN2: | ||
| 205 | case TextureFormat::BC7U: | ||
| 206 | case TextureFormat::BC6H_UF16: | ||
| 207 | case TextureFormat::BC6H_SF16: | ||
| 208 | // In this case a 'pixel' actually refers to a 4x4 tile. | ||
| 209 | return 16; | ||
| 210 | case TextureFormat::R32_G32_B32: | ||
| 211 | return 12; | ||
| 212 | case TextureFormat::ASTC_2D_4X4: | ||
| 213 | case TextureFormat::ASTC_2D_5X4: | ||
| 214 | case TextureFormat::ASTC_2D_8X8: | ||
| 215 | case TextureFormat::ASTC_2D_8X5: | ||
| 216 | case TextureFormat::ASTC_2D_10X8: | ||
| 217 | case TextureFormat::ASTC_2D_5X5: | ||
| 218 | case TextureFormat::A8R8G8B8: | ||
| 219 | case TextureFormat::A2B10G10R10: | ||
| 220 | case TextureFormat::BF10GF11RF11: | ||
| 221 | case TextureFormat::R32: | ||
| 222 | case TextureFormat::R16_G16: | ||
| 223 | return 4; | ||
| 224 | case TextureFormat::A1B5G5R5: | ||
| 225 | case TextureFormat::B5G6R5: | ||
| 226 | case TextureFormat::G8R8: | ||
| 227 | case TextureFormat::R16: | ||
| 228 | return 2; | ||
| 229 | case TextureFormat::R8: | ||
| 230 | return 1; | ||
| 231 | case TextureFormat::R16_G16_B16_A16: | ||
| 232 | return 8; | ||
| 233 | case TextureFormat::R32_G32_B32_A32: | ||
| 234 | return 16; | ||
| 235 | case TextureFormat::R32_G32: | ||
| 236 | return 8; | ||
| 237 | default: | ||
| 238 | UNIMPLEMENTED_MSG("Format not implemented"); | ||
| 239 | return 1; | ||
| 240 | } | ||
| 241 | } | ||
| 242 | |||
| 243 | void UnswizzleTexture(u8* const unswizzled_data, u8* address, u32 tile_size_x, u32 tile_size_y, | 196 | void UnswizzleTexture(u8* const unswizzled_data, u8* address, u32 tile_size_x, u32 tile_size_y, |
| 244 | u32 bytes_per_pixel, u32 width, u32 height, u32 depth, u32 block_height, | 197 | u32 bytes_per_pixel, u32 width, u32 height, u32 depth, u32 block_height, |
| 245 | u32 block_depth, u32 width_spacing) { | 198 | u32 block_depth, u32 width_spacing) { |
| @@ -328,48 +281,6 @@ void SwizzleKepler(const u32 width, const u32 height, const u32 dst_x, const u32 | |||
| 328 | } | 281 | } |
| 329 | } | 282 | } |
| 330 | 283 | ||
| 331 | std::vector<u8> DecodeTexture(const std::vector<u8>& texture_data, TextureFormat format, u32 width, | ||
| 332 | u32 height) { | ||
| 333 | std::vector<u8> rgba_data; | ||
| 334 | |||
| 335 | // TODO(Subv): Implement. | ||
| 336 | switch (format) { | ||
| 337 | case TextureFormat::DXT1: | ||
| 338 | case TextureFormat::DXT23: | ||
| 339 | case TextureFormat::DXT45: | ||
| 340 | case TextureFormat::DXN1: | ||
| 341 | case TextureFormat::DXN2: | ||
| 342 | case TextureFormat::BC7U: | ||
| 343 | case TextureFormat::BC6H_UF16: | ||
| 344 | case TextureFormat::BC6H_SF16: | ||
| 345 | case TextureFormat::ASTC_2D_4X4: | ||
| 346 | case TextureFormat::ASTC_2D_8X8: | ||
| 347 | case TextureFormat::ASTC_2D_5X5: | ||
| 348 | case TextureFormat::ASTC_2D_10X8: | ||
| 349 | case TextureFormat::A8R8G8B8: | ||
| 350 | case TextureFormat::A2B10G10R10: | ||
| 351 | case TextureFormat::A1B5G5R5: | ||
| 352 | case TextureFormat::B5G6R5: | ||
| 353 | case TextureFormat::R8: | ||
| 354 | case TextureFormat::G8R8: | ||
| 355 | case TextureFormat::BF10GF11RF11: | ||
| 356 | case TextureFormat::R32_G32_B32_A32: | ||
| 357 | case TextureFormat::R32_G32: | ||
| 358 | case TextureFormat::R32: | ||
| 359 | case TextureFormat::R16: | ||
| 360 | case TextureFormat::R16_G16: | ||
| 361 | case TextureFormat::R32_G32_B32: | ||
| 362 | // TODO(Subv): For the time being just forward the same data without any decoding. | ||
| 363 | rgba_data = texture_data; | ||
| 364 | break; | ||
| 365 | default: | ||
| 366 | UNIMPLEMENTED_MSG("Format not implemented"); | ||
| 367 | break; | ||
| 368 | } | ||
| 369 | |||
| 370 | return rgba_data; | ||
| 371 | } | ||
| 372 | |||
| 373 | std::size_t CalculateSize(bool tiled, u32 bytes_per_pixel, u32 width, u32 height, u32 depth, | 284 | std::size_t CalculateSize(bool tiled, u32 bytes_per_pixel, u32 width, u32 height, u32 depth, |
| 374 | u32 block_height, u32 block_depth) { | 285 | u32 block_height, u32 block_depth) { |
| 375 | if (tiled) { | 286 | if (tiled) { |
diff --git a/src/video_core/textures/decoders.h b/src/video_core/textures/decoders.h index 06f3ebf87..4c9a15048 100644 --- a/src/video_core/textures/decoders.h +++ b/src/video_core/textures/decoders.h | |||
| @@ -38,10 +38,6 @@ void CopySwizzledData(u32 width, u32 height, u32 depth, u32 bytes_per_pixel, | |||
| 38 | u32 out_bytes_per_pixel, u8* swizzled_data, u8* unswizzled_data, | 38 | u32 out_bytes_per_pixel, u8* swizzled_data, u8* unswizzled_data, |
| 39 | bool unswizzle, u32 block_height, u32 block_depth, u32 width_spacing); | 39 | bool unswizzle, u32 block_height, u32 block_depth, u32 width_spacing); |
| 40 | 40 | ||
| 41 | /// Decodes an unswizzled texture into a A8R8G8B8 texture. | ||
| 42 | std::vector<u8> DecodeTexture(const std::vector<u8>& texture_data, TextureFormat format, u32 width, | ||
| 43 | u32 height); | ||
| 44 | |||
| 45 | /// This function calculates the correct size of a texture depending if it's tiled or not. | 41 | /// This function calculates the correct size of a texture depending if it's tiled or not. |
| 46 | std::size_t CalculateSize(bool tiled, u32 bytes_per_pixel, u32 width, u32 height, u32 depth, | 42 | std::size_t CalculateSize(bool tiled, u32 bytes_per_pixel, u32 width, u32 height, u32 depth, |
| 47 | u32 block_height, u32 block_depth); | 43 | u32 block_height, u32 block_depth); |
diff --git a/src/video_core/textures/texture.h b/src/video_core/textures/texture.h index eba05aced..0574fef12 100644 --- a/src/video_core/textures/texture.h +++ b/src/video_core/textures/texture.h | |||
| @@ -12,10 +12,10 @@ | |||
| 12 | namespace Tegra::Texture { | 12 | namespace Tegra::Texture { |
| 13 | 13 | ||
| 14 | enum class TextureFormat : u32 { | 14 | enum class TextureFormat : u32 { |
| 15 | R32_G32_B32_A32 = 0x01, | 15 | R32G32B32A32 = 0x01, |
| 16 | R32_G32_B32 = 0x02, | 16 | R32G32B32 = 0x02, |
| 17 | R16_G16_B16_A16 = 0x03, | 17 | R16G16B16A16 = 0x03, |
| 18 | R32_G32 = 0x04, | 18 | R32G32 = 0x04, |
| 19 | R32_B24G8 = 0x05, | 19 | R32_B24G8 = 0x05, |
| 20 | ETC2_RGB = 0x06, | 20 | ETC2_RGB = 0x06, |
| 21 | X8B8G8R8 = 0x07, | 21 | X8B8G8R8 = 0x07, |
| @@ -23,19 +23,19 @@ enum class TextureFormat : u32 { | |||
| 23 | A2B10G10R10 = 0x09, | 23 | A2B10G10R10 = 0x09, |
| 24 | ETC2_RGB_PTA = 0x0a, | 24 | ETC2_RGB_PTA = 0x0a, |
| 25 | ETC2_RGBA = 0x0b, | 25 | ETC2_RGBA = 0x0b, |
| 26 | R16_G16 = 0x0c, | 26 | R16G16 = 0x0c, |
| 27 | G8R24 = 0x0d, | 27 | R24G8 = 0x0d, |
| 28 | G24R8 = 0x0e, | 28 | R8G24 = 0x0e, |
| 29 | R32 = 0x0f, | 29 | R32 = 0x0f, |
| 30 | BC6H_SF16 = 0x10, | 30 | BC6H_SFLOAT = 0x10, |
| 31 | BC6H_UF16 = 0x11, | 31 | BC6H_UFLOAT = 0x11, |
| 32 | A4B4G4R4 = 0x12, | 32 | A4B4G4R4 = 0x12, |
| 33 | A5B5G5R1 = 0x13, | 33 | A5B5G5R1 = 0x13, |
| 34 | A1B5G5R5 = 0x14, | 34 | A1B5G5R5 = 0x14, |
| 35 | B5G6R5 = 0x15, | 35 | B5G6R5 = 0x15, |
| 36 | B6G5R5 = 0x16, | 36 | B6G5R5 = 0x16, |
| 37 | BC7U = 0x17, | 37 | BC7 = 0x17, |
| 38 | G8R8 = 0x18, | 38 | R8G8 = 0x18, |
| 39 | EAC = 0x19, | 39 | EAC = 0x19, |
| 40 | EACX2 = 0x1a, | 40 | EACX2 = 0x1a, |
| 41 | R16 = 0x1b, | 41 | R16 = 0x1b, |
| @@ -43,23 +43,23 @@ enum class TextureFormat : u32 { | |||
| 43 | R8 = 0x1d, | 43 | R8 = 0x1d, |
| 44 | G4R4 = 0x1e, | 44 | G4R4 = 0x1e, |
| 45 | R1 = 0x1f, | 45 | R1 = 0x1f, |
| 46 | E5B9G9R9_SHAREDEXP = 0x20, | 46 | E5B9G9R9 = 0x20, |
| 47 | BF10GF11RF11 = 0x21, | 47 | B10G11R11 = 0x21, |
| 48 | G8B8G8R8 = 0x22, | 48 | G8B8G8R8 = 0x22, |
| 49 | B8G8R8G8 = 0x23, | 49 | B8G8R8G8 = 0x23, |
| 50 | DXT1 = 0x24, | 50 | BC1_RGBA = 0x24, |
| 51 | DXT23 = 0x25, | 51 | BC2 = 0x25, |
| 52 | DXT45 = 0x26, | 52 | BC3 = 0x26, |
| 53 | DXN1 = 0x27, | 53 | BC4 = 0x27, |
| 54 | DXN2 = 0x28, | 54 | BC5 = 0x28, |
| 55 | S8Z24 = 0x29, | 55 | S8D24 = 0x29, |
| 56 | X8Z24 = 0x2a, | 56 | X8Z24 = 0x2a, |
| 57 | Z24S8 = 0x2b, | 57 | D24S8 = 0x2b, |
| 58 | X4V4Z24__COV4R4V = 0x2c, | 58 | X4V4Z24__COV4R4V = 0x2c, |
| 59 | X4V4Z24__COV8R8V = 0x2d, | 59 | X4V4Z24__COV8R8V = 0x2d, |
| 60 | V8Z24__COV4R12V = 0x2e, | 60 | V8Z24__COV4R12V = 0x2e, |
| 61 | ZF32 = 0x2f, | 61 | D32 = 0x2f, |
| 62 | ZF32_X24S8 = 0x30, | 62 | D32S8 = 0x30, |
| 63 | X8Z24_X20V4S8__COV4R4V = 0x31, | 63 | X8Z24_X20V4S8__COV4R4V = 0x31, |
| 64 | X8Z24_X20V4S8__COV8R8V = 0x32, | 64 | X8Z24_X20V4S8__COV8R8V = 0x32, |
| 65 | ZF32_X20V4X8__COV4R4V = 0x33, | 65 | ZF32_X20V4X8__COV4R4V = 0x33, |
| @@ -69,7 +69,7 @@ enum class TextureFormat : u32 { | |||
| 69 | X8Z24_X16V8S8__COV4R12V = 0x37, | 69 | X8Z24_X16V8S8__COV4R12V = 0x37, |
| 70 | ZF32_X16V8X8__COV4R12V = 0x38, | 70 | ZF32_X16V8X8__COV4R12V = 0x38, |
| 71 | ZF32_X16V8S8__COV4R12V = 0x39, | 71 | ZF32_X16V8S8__COV4R12V = 0x39, |
| 72 | Z16 = 0x3a, | 72 | D16 = 0x3a, |
| 73 | V8Z24__COV8R24V = 0x3b, | 73 | V8Z24__COV8R24V = 0x3b, |
| 74 | X8Z24_X16V8S8__COV8R24V = 0x3c, | 74 | X8Z24_X16V8S8__COV8R24V = 0x3c, |
| 75 | ZF32_X16V8X8__COV8R24V = 0x3d, | 75 | ZF32_X16V8X8__COV8R24V = 0x3d, |
| @@ -375,7 +375,4 @@ struct FullTextureInfo { | |||
| 375 | TSCEntry tsc; | 375 | TSCEntry tsc; |
| 376 | }; | 376 | }; |
| 377 | 377 | ||
| 378 | /// Returns the number of bytes per pixel of the input texture format. | ||
| 379 | u32 BytesPerPixel(TextureFormat format); | ||
| 380 | |||
| 381 | } // namespace Tegra::Texture | 378 | } // namespace Tegra::Texture |