From 95691e1a8db97824a371de71e9525e1063d369ae Mon Sep 17 00:00:00 2001 From: Melissa Goad Date: Thu, 19 Apr 2018 03:29:29 -0500 Subject: [PATCH] Add RGB10_A2 texture formats --- src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 3 +++ src/video_core/renderer_opengl/gl_rasterizer_cache.h | 6 ++++++ src/video_core/textures/texture.h | 1 + 3 files changed, 10 insertions(+) diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index 2a0858eac3..fd66039069 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp @@ -52,6 +52,7 @@ static constexpr std::array tex_form {GL_RGBA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, false, 1}, // ABGR8 {GL_RGB, GL_RGB, GL_UNSIGNED_SHORT_5_6_5_REV, false, 1}, // B5G6R5 {GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_RGB, GL_UNSIGNED_INT_8_8_8_8, true, 16}, // DXT1 + {GL_RGB10_A2, GL_RGBA, GL_UNSIGNED_INT_10_10_10_2, false, 1}, // RGB10_A2 }}; static const FormatTuple& GetFormatTuple(PixelFormat pixel_format, ComponentType component_type) { @@ -124,6 +125,7 @@ static constexpr std::array, MortonCopy, MortonCopy, + MortonCopy, }; static constexpr std::array, // TODO(Subv): Swizzling the DXT1 format is not yet supported nullptr, + MortonCopy, }; // Allocate an uninitialized texture of appropriate size and format for the surface diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h index 23e4d02d84..139fc65d23 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h @@ -55,6 +55,7 @@ struct SurfaceParams { ABGR8 = 0, B5G6R5 = 1, DXT1 = 2, + RGB10_A2 = 3, Max, Invalid = 255, @@ -87,6 +88,7 @@ struct SurfaceParams { 32, // ABGR8 16, // B5G6R5 64, // DXT1 + 32, // RGB10_A2 }; ASSERT(static_cast(format) < bpp_table.size()); @@ -100,6 +102,8 @@ struct SurfaceParams { switch (format) { case Tegra::RenderTargetFormat::RGBA8_UNORM: return PixelFormat::ABGR8; + case Tegra::RenderTargetFormat::RGB10_A2_UNORM: + return PixelFormat::RGB10_A2; default: NGLOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast(format)); UNREACHABLE(); @@ -140,6 +144,8 @@ struct SurfaceParams { return Tegra::Texture::TextureFormat::B5G6R5; case PixelFormat::DXT1: return Tegra::Texture::TextureFormat::DXT1; + case PixelFormat::RGB10_A2: + return Tegra::Texture::TextureFormat::RGB10_A2; default: UNREACHABLE(); } diff --git a/src/video_core/textures/texture.h b/src/video_core/textures/texture.h index 86e45aa882..200169c14b 100644 --- a/src/video_core/textures/texture.h +++ b/src/video_core/textures/texture.h @@ -19,6 +19,7 @@ enum class TextureFormat : u32 { DXT1 = 0x24, DXT23 = 0x25, DXT45 = 0x26, + RGB10_A2 = 0xD1, }; enum class TextureType : u32 {