From 2985056340b04c81df6afcf841dd541c94204817 Mon Sep 17 00:00:00 2001 From: Subv Date: Wed, 18 Apr 2018 18:11:14 -0500 Subject: GPU: Implemented the B5G6R5 format. --- src/video_core/renderer_opengl/gl_rasterizer_cache.h | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/video_core/renderer_opengl/gl_rasterizer_cache.h') diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h index 0ff0ce90f..23e4d02d8 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h @@ -53,10 +53,15 @@ enum class ScaleMatch { struct SurfaceParams { enum class PixelFormat { ABGR8 = 0, - DXT1 = 1, + B5G6R5 = 1, + DXT1 = 2, + + Max, Invalid = 255, }; + static constexpr size_t MaxPixelFormat = static_cast(PixelFormat::Max); + enum class ComponentType { Invalid = 0, SNorm = 1, @@ -78,8 +83,9 @@ struct SurfaceParams { if (format == PixelFormat::Invalid) return 0; - constexpr std::array bpp_table = { + constexpr std::array bpp_table = { 32, // ABGR8 + 16, // B5G6R5 64, // DXT1 }; @@ -115,6 +121,8 @@ struct SurfaceParams { switch (format) { case Tegra::Texture::TextureFormat::A8R8G8B8: return PixelFormat::ABGR8; + case Tegra::Texture::TextureFormat::B5G6R5: + return PixelFormat::B5G6R5; case Tegra::Texture::TextureFormat::DXT1: return PixelFormat::DXT1; default: @@ -128,6 +136,8 @@ struct SurfaceParams { switch (format) { case PixelFormat::ABGR8: return Tegra::Texture::TextureFormat::A8R8G8B8; + case PixelFormat::B5G6R5: + return Tegra::Texture::TextureFormat::B5G6R5; case PixelFormat::DXT1: return Tegra::Texture::TextureFormat::DXT1; default: @@ -189,7 +199,7 @@ struct SurfaceParams { } static SurfaceType GetFormatType(PixelFormat pixel_format) { - if ((unsigned int)pixel_format <= static_cast(PixelFormat::DXT1)) { + if (static_cast(pixel_format) < MaxPixelFormat) { return SurfaceType::ColorTexture; } -- cgit v1.2.3