summaryrefslogtreecommitdiffstats
path: root/src/video_core
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/video_core/morton.cpp8
-rw-r--r--src/video_core/renderer_opengl/gl_texture_cache.cpp4
-rw-r--r--src/video_core/renderer_vulkan/maxwell_to_vk.cpp4
-rw-r--r--src/video_core/renderer_vulkan/vk_device.cpp1
-rw-r--r--src/video_core/surface.cpp21
-rw-r--r--src/video_core/surface.h23
-rw-r--r--src/video_core/texture_cache/format_lookup_table.cpp7
7 files changed, 31 insertions, 37 deletions
diff --git a/src/video_core/morton.cpp b/src/video_core/morton.cpp
index 7f239566a..0c3c9f12d 100644
--- a/src/video_core/morton.cpp
+++ b/src/video_core/morton.cpp
@@ -46,6 +46,7 @@ static constexpr ConversionArray morton_to_linear_fns = {
MortonCopy<true, PixelFormat::ABGR8I>,
MortonCopy<true, PixelFormat::ABGR8UI>,
MortonCopy<true, PixelFormat::B5G6R5U>,
+ MortonCopy<true, PixelFormat::R5G6B5U>,
MortonCopy<true, PixelFormat::B5G5R5A1U>,
MortonCopy<true, PixelFormat::A2B10G10R10U>,
MortonCopy<true, PixelFormat::A2B10G10R10UI>,
@@ -64,7 +65,8 @@ static constexpr ConversionArray morton_to_linear_fns = {
MortonCopy<true, PixelFormat::DXT1>,
MortonCopy<true, PixelFormat::DXT23>,
MortonCopy<true, PixelFormat::DXT45>,
- MortonCopy<true, PixelFormat::DXN1>,
+ MortonCopy<true, PixelFormat::DXN1UNORM>,
+ MortonCopy<true, PixelFormat::DXN1SNORM>,
MortonCopy<true, PixelFormat::DXN2UNORM>,
MortonCopy<true, PixelFormat::DXN2SNORM>,
MortonCopy<true, PixelFormat::BC7U>,
@@ -138,6 +140,7 @@ static constexpr ConversionArray linear_to_morton_fns = {
MortonCopy<false, PixelFormat::ABGR8I>,
MortonCopy<false, PixelFormat::ABGR8UI>,
MortonCopy<false, PixelFormat::B5G6R5U>,
+ MortonCopy<false, PixelFormat::R5G6B5U>,
MortonCopy<false, PixelFormat::B5G5R5A1U>,
MortonCopy<false, PixelFormat::A2B10G10R10U>,
MortonCopy<false, PixelFormat::A2B10G10R10UI>,
@@ -156,7 +159,8 @@ static constexpr ConversionArray linear_to_morton_fns = {
MortonCopy<false, PixelFormat::DXT1>,
MortonCopy<false, PixelFormat::DXT23>,
MortonCopy<false, PixelFormat::DXT45>,
- MortonCopy<false, PixelFormat::DXN1>,
+ MortonCopy<false, PixelFormat::DXN1UNORM>,
+ MortonCopy<false, PixelFormat::DXN1SNORM>,
MortonCopy<false, PixelFormat::DXN2UNORM>,
MortonCopy<false, PixelFormat::DXN2SNORM>,
MortonCopy<false, PixelFormat::BC7U>,
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cpp
index 7f85ceca9..12f54c050 100644
--- a/src/video_core/renderer_opengl/gl_texture_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp
@@ -46,6 +46,7 @@ constexpr std::array<FormatTuple, VideoCore::Surface::MaxPixelFormat> tex_format
{GL_RGBA8I, GL_RGBA_INTEGER, GL_BYTE}, // ABGR8I
{GL_RGBA8UI, GL_RGBA_INTEGER, GL_UNSIGNED_BYTE}, // ABGR8UI
{GL_RGB565, GL_RGB, GL_UNSIGNED_SHORT_5_6_5}, // B5G6R5U
+ {GL_RGB565, GL_RGB, GL_UNSIGNED_SHORT_5_6_5_REV}, // R5G6B5U
{GL_RGB5_A1, GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV}, // B5G5R5A1U
{GL_RGB10_A2, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV}, // A2B10G10R10U
{GL_RGB10_A2UI, GL_RGBA_INTEGER, GL_UNSIGNED_INT_2_10_10_10_REV}, // A2B10G10R10UI
@@ -64,7 +65,8 @@ constexpr std::array<FormatTuple, VideoCore::Surface::MaxPixelFormat> tex_format
{GL_COMPRESSED_RGBA_S3TC_DXT1_EXT}, // DXT1
{GL_COMPRESSED_RGBA_S3TC_DXT3_EXT}, // DXT23
{GL_COMPRESSED_RGBA_S3TC_DXT5_EXT}, // DXT45
- {GL_COMPRESSED_RED_RGTC1}, // DXN1
+ {GL_COMPRESSED_RED_RGTC1}, // DXN1UNORM
+ {GL_COMPRESSED_SIGNED_RED_RGTC1}, // DXN1SNORM
{GL_COMPRESSED_RG_RGTC2}, // DXN2UNORM
{GL_COMPRESSED_SIGNED_RG_RGTC2}, // DXN2SNORM
{GL_COMPRESSED_RGBA_BPTC_UNORM}, // BC7U
diff --git a/src/video_core/renderer_vulkan/maxwell_to_vk.cpp b/src/video_core/renderer_vulkan/maxwell_to_vk.cpp
index 3cb3b00d9..57c3822c2 100644
--- a/src/video_core/renderer_vulkan/maxwell_to_vk.cpp
+++ b/src/video_core/renderer_vulkan/maxwell_to_vk.cpp
@@ -122,6 +122,7 @@ struct FormatTuple {
{VK_FORMAT_A8B8G8R8_SINT_PACK32, Attachable | Storage}, // ABGR8I
{VK_FORMAT_A8B8G8R8_UINT_PACK32, Attachable | Storage}, // ABGR8UI
{VK_FORMAT_R5G6B5_UNORM_PACK16, Attachable}, // B5G6R5U
+ {VK_FORMAT_B5G6R5_UNORM_PACK16, Attachable}, // R5G6B5U
{VK_FORMAT_A1R5G5B5_UNORM_PACK16, Attachable}, // B5G5R5A1U
{VK_FORMAT_A2B10G10R10_UNORM_PACK32, Attachable | Storage}, // A2B10G10R10U
{VK_FORMAT_A2B10G10R10_UINT_PACK32, Attachable | Storage}, // A2B10G10R10UI
@@ -140,7 +141,8 @@ struct FormatTuple {
{VK_FORMAT_BC1_RGBA_UNORM_BLOCK}, // DXT1
{VK_FORMAT_BC2_UNORM_BLOCK}, // DXT23
{VK_FORMAT_BC3_UNORM_BLOCK}, // DXT45
- {VK_FORMAT_BC4_UNORM_BLOCK}, // DXN1
+ {VK_FORMAT_BC4_UNORM_BLOCK}, // DXN1UNORM
+ {VK_FORMAT_BC4_SNORM_BLOCK}, // DXN1SNORM
{VK_FORMAT_BC5_UNORM_BLOCK}, // DXN2UNORM
{VK_FORMAT_BC5_SNORM_BLOCK}, // DXN2SNORM
{VK_FORMAT_BC7_UNORM_BLOCK}, // BC7U
diff --git a/src/video_core/renderer_vulkan/vk_device.cpp b/src/video_core/renderer_vulkan/vk_device.cpp
index 2f5621889..71f0ff427 100644
--- a/src/video_core/renderer_vulkan/vk_device.cpp
+++ b/src/video_core/renderer_vulkan/vk_device.cpp
@@ -125,6 +125,7 @@ std::unordered_map<VkFormat, VkFormatProperties> GetFormatProperties(
VK_FORMAT_BC2_UNORM_BLOCK,
VK_FORMAT_BC3_UNORM_BLOCK,
VK_FORMAT_BC4_UNORM_BLOCK,
+ VK_FORMAT_BC4_SNORM_BLOCK,
VK_FORMAT_BC5_UNORM_BLOCK,
VK_FORMAT_BC5_SNORM_BLOCK,
VK_FORMAT_BC7_UNORM_BLOCK,
diff --git a/src/video_core/surface.cpp b/src/video_core/surface.cpp
index c1c2f2c52..492ab6215 100644
--- a/src/video_core/surface.cpp
+++ b/src/video_core/surface.cpp
@@ -283,25 +283,4 @@ std::pair<u32, u32> GetASTCBlockSize(PixelFormat format) {
return {GetDefaultBlockWidth(format), GetDefaultBlockHeight(format)};
}
-bool IsFormatBCn(PixelFormat format) {
- switch (format) {
- case PixelFormat::DXT1:
- case PixelFormat::DXT23:
- case PixelFormat::DXT45:
- case PixelFormat::DXN1:
- case PixelFormat::DXN2SNORM:
- case PixelFormat::DXN2UNORM:
- case PixelFormat::BC7U:
- case PixelFormat::BC6H_UF16:
- case PixelFormat::BC6H_SF16:
- case PixelFormat::DXT1_SRGB:
- case PixelFormat::DXT23_SRGB:
- case PixelFormat::DXT45_SRGB:
- case PixelFormat::BC7U_SRGB:
- return true;
- default:
- return false;
- }
-}
-
} // namespace VideoCore::Surface
diff --git a/src/video_core/surface.h b/src/video_core/surface.h
index 9510db2c8..826c5a3ad 100644
--- a/src/video_core/surface.h
+++ b/src/video_core/surface.h
@@ -20,6 +20,7 @@ enum class PixelFormat {
ABGR8I,
ABGR8UI,
B5G6R5U,
+ R5G6B5U,
B5G5R5A1U,
A2B10G10R10U,
A2B10G10R10UI,
@@ -38,7 +39,8 @@ enum class PixelFormat {
DXT1,
DXT23,
DXT45,
- DXN1, // This is also known as BC4
+ DXN1UNORM, // This is also known as BC4
+ DXN1SNORM,
DXN2UNORM,
DXN2SNORM,
BC7U,
@@ -144,6 +146,7 @@ constexpr std::array<u32, MaxPixelFormat> compression_factor_shift_table = {{
0, // ABGR8I
0, // ABGR8UI
0, // B5G6R5U
+ 0, // R5G6B5U
0, // B5G5R5A1U
0, // A2B10G10R10U
0, // A2B10G10R10UI
@@ -162,7 +165,8 @@ constexpr std::array<u32, MaxPixelFormat> compression_factor_shift_table = {{
2, // DXT1
2, // DXT23
2, // DXT45
- 2, // DXN1
+ 2, // DXN1UNORM
+ 2, // DXN1SNORM
2, // DXN2UNORM
2, // DXN2SNORM
2, // BC7U
@@ -252,6 +256,7 @@ constexpr std::array<u32, MaxPixelFormat> block_width_table = {{
1, // ABGR8I
1, // ABGR8UI
1, // B5G6R5U
+ 1, // R5G6B5U
1, // B5G5R5A1U
1, // A2B10G10R10U
1, // A2B10G10R10UI
@@ -270,7 +275,8 @@ constexpr std::array<u32, MaxPixelFormat> block_width_table = {{
4, // DXT1
4, // DXT23
4, // DXT45
- 4, // DXN1
+ 4, // DXN1UNORM
+ 4, // DXN1SNORM
4, // DXN2UNORM
4, // DXN2SNORM
4, // BC7U
@@ -352,6 +358,7 @@ constexpr std::array<u32, MaxPixelFormat> block_height_table = {{
1, // ABGR8I
1, // ABGR8UI
1, // B5G6R5U
+ 1, // R5G6B5U
1, // B5G5R5A1U
1, // A2B10G10R10U
1, // A2B10G10R10UI
@@ -370,7 +377,8 @@ constexpr std::array<u32, MaxPixelFormat> block_height_table = {{
4, // DXT1
4, // DXT23
4, // DXT45
- 4, // DXN1
+ 4, // DXN1UNORM
+ 4, // DXN1SNORM
4, // DXN2UNORM
4, // DXN2SNORM
4, // BC7U
@@ -452,6 +460,7 @@ constexpr std::array<u32, MaxPixelFormat> bpp_table = {{
32, // ABGR8I
32, // ABGR8UI
16, // B5G6R5U
+ 16, // R5G6B5U
16, // B5G5R5A1U
32, // A2B10G10R10U
32, // A2B10G10R10UI
@@ -470,7 +479,8 @@ constexpr std::array<u32, MaxPixelFormat> bpp_table = {{
64, // DXT1
128, // DXT23
128, // DXT45
- 64, // DXN1
+ 64, // DXN1UNORM
+ 64, // DXN1SNORM
128, // DXN2UNORM
128, // DXN2SNORM
128, // BC7U
@@ -574,7 +584,4 @@ bool IsPixelFormatSRGB(PixelFormat format);
std::pair<u32, u32> GetASTCBlockSize(PixelFormat format);
-/// Returns true if the specified PixelFormat is a BCn format, e.g. DXT or DXN
-bool IsFormatBCn(PixelFormat format);
-
} // namespace VideoCore::Surface
diff --git a/src/video_core/texture_cache/format_lookup_table.cpp b/src/video_core/texture_cache/format_lookup_table.cpp
index b7f44ead2..148a3935d 100644
--- a/src/video_core/texture_cache/format_lookup_table.cpp
+++ b/src/video_core/texture_cache/format_lookup_table.cpp
@@ -48,7 +48,7 @@ constexpr std::array<Table, 86> DefinitionTable = {{
{TextureFormat::A8R8G8B8, C, SINT, SINT, SINT, SINT, PixelFormat::ABGR8I},
{TextureFormat::A8R8G8B8, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::RGBA8_SRGB},
- {TextureFormat::B5G6R5, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::B5G6R5U},
+ {TextureFormat::B5G6R5, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::R5G6B5U},
{TextureFormat::A2B10G10R10, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::A2B10G10R10U},
{TextureFormat::A2B10G10R10, C, UINT, UINT, UINT, UINT, PixelFormat::A2B10G10R10UI},
@@ -118,9 +118,8 @@ constexpr std::array<Table, 86> DefinitionTable = {{
{TextureFormat::DXT45, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::DXT45},
{TextureFormat::DXT45, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::DXT45_SRGB},
- // TODO: Use a different pixel format for SNORM
- {TextureFormat::DXN1, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::DXN1},
- {TextureFormat::DXN1, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::DXN1},
+ {TextureFormat::DXN1, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::DXN1UNORM},
+ {TextureFormat::DXN1, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::DXN1SNORM},
{TextureFormat::DXN2, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::DXN2UNORM},
{TextureFormat::DXN2, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::DXN2SNORM},