VERY experimental Nintendo Switch 2 emulator
C++
Video_Core: Implement texture format E5B9G9R9_SHAREDEXP.
Fernando Sahmkow5305d723c286
diff --git a/src/video_core/morton.cpp b/src/video_core/morton.cppindex fe5f08aced..2f2fe68595 100644--- a/src/video_core/morton.cpp+++ b/src/video_core/morton.cpp@@ -112,6 +112,7 @@ static constexpr ConversionArray morton_to_linear_fns = {MortonCopy<true, PixelFormat::ASTC_2D_8X6_SRGB>,MortonCopy<true, PixelFormat::ASTC_2D_6X5>,MortonCopy<true, PixelFormat::ASTC_2D_6X5_SRGB>,+ MortonCopy<true, PixelFormat::E5B9G9R9F>,MortonCopy<true, PixelFormat::Z32F>,MortonCopy<true, PixelFormat::Z16>,MortonCopy<true, PixelFormat::Z24S8>,@@ -192,6 +193,7 @@ static constexpr ConversionArray linear_to_morton_fns = {nullptr,nullptr,nullptr,+ MortonCopy<false, PixelFormat::E5B9G9R9F>,MortonCopy<false, PixelFormat::Z32F>,MortonCopy<false, PixelFormat::Z16>,MortonCopy<false, PixelFormat::Z24S8>,diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cppindex 2f9bfd7e41..55b3e58b26 100644--- a/src/video_core/renderer_opengl/gl_texture_cache.cpp+++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp@@ -131,6 +131,7 @@ constexpr std::array<FormatTuple, VideoCore::Surface::MaxPixelFormat> tex_format{GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_8X6_SRGB{GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_6X5{GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_6X5_SRGB+ {GL_RGB9_E5, GL_RGB, GL_UNSIGNED_INT_5_9_9_9_REV, ComponentType::Float, false}, // E5B9G9R9F// Depth formats{GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT, ComponentType::Float, false}, // Z32Fdiff --git a/src/video_core/surface.cpp b/src/video_core/surface.cppindex 9a3c05288b..621136b6ed 100644--- a/src/video_core/surface.cpp+++ b/src/video_core/surface.cpp@@ -315,6 +315,14 @@ PixelFormat PixelFormatFromTextureFormat(Tegra::Texture::TextureFormat format,break;}break;+ case Tegra::Texture::TextureFormat::E5B9G9R9_SHAREDEXP:+ switch (component_type) {+ case Tegra::Texture::ComponentType::FLOAT:+ return PixelFormat::E5B9G9R9F;+ default:+ break;+ }+ break;case Tegra::Texture::TextureFormat::ZF32:return PixelFormat::Z32F;case Tegra::Texture::TextureFormat::Z16:diff --git a/src/video_core/surface.h b/src/video_core/surface.hindex 97668f8029..d3bcd38c5e 100644--- a/src/video_core/surface.h+++ b/src/video_core/surface.h@@ -86,19 +86,20 @@ enum class PixelFormat {ASTC_2D_8X6_SRGB = 68,ASTC_2D_6X5 = 69,ASTC_2D_6X5_SRGB = 70,+ E5B9G9R9F = 71,MaxColorFormat,// Depth formats- Z32F = 71,- Z16 = 72,+ Z32F = 72,+ Z16 = 73,MaxDepthFormat,// DepthStencil formats- Z24S8 = 73,- S8Z24 = 74,- Z32FS8 = 75,+ Z24S8 = 74,+ S8Z24 = 75,+ Z32FS8 = 76,MaxDepthStencilFormat,@@ -207,6 +208,7 @@ constexpr std::array<u32, MaxPixelFormat> compression_factor_shift_table = {{2, // ASTC_2D_8X6_SRGB2, // ASTC_2D_6X52, // ASTC_2D_6X5_SRGB+ 0, // E5B9G9R9F0, // Z32F0, // Z160, // Z24S8@@ -302,6 +304,7 @@ constexpr std::array<u32, MaxPixelFormat> block_width_table = {{8, // ASTC_2D_8X6_SRGB6, // ASTC_2D_6X56, // ASTC_2D_6X5_SRGB+ 1, // E5B9G9R9F1, // Z32F1, // Z161, // Z24S8@@ -389,6 +392,7 @@ constexpr std::array<u32, MaxPixelFormat> block_height_table = {{6, // ASTC_2D_8X6_SRGB5, // ASTC_2D_6X55, // ASTC_2D_6X5_SRGB+ 1, // E5B9G9R9F1, // Z32F1, // Z161, // Z24S8@@ -476,6 +480,7 @@ constexpr std::array<u32, MaxPixelFormat> bpp_table = {{128, // ASTC_2D_8X6_SRGB128, // ASTC_2D_6X5128, // ASTC_2D_6X5_SRGB+ 32, // E5B9G9R9F32, // Z32F16, // Z1632, // Z24S8@@ -578,6 +583,7 @@ constexpr std::array<SurfaceCompression, MaxPixelFormat> compression_type_tableSurfaceCompression::Converted, // ASTC_2D_8X6_SRGBSurfaceCompression::Converted, // ASTC_2D_6X5SurfaceCompression::Converted, // ASTC_2D_6X5_SRGB+ SurfaceCompression::None, // E5B9G9R9FSurfaceCompression::None, // Z32FSurfaceCompression::None, // Z16SurfaceCompression::None, // Z24S8