From 99f9d47d16aaa943d952ab4b0a46837b2685aed2 Mon Sep 17 00:00:00 2001 From: Subv Date: Sat, 2 Jun 2018 13:17:09 -0500 Subject: GPU: Implemented the DXN1 (BC4) texture format. --- src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 6 ++++-- src/video_core/renderer_opengl/gl_rasterizer_cache.h | 7 +++++++ 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'src/video_core/renderer_opengl') diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index 10a460a82..65d643447 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp @@ -53,6 +53,7 @@ static constexpr std::array tex_form {GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_RGB, GL_UNSIGNED_INT_8_8_8_8, true}, // DXT1 {GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, true}, // DXT23 {GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, true}, // DXT45 + {GL_COMPRESSED_RED_RGTC1, GL_RED, GL_UNSIGNED_INT_8_8_8_8, true}, // DXN1 }}; static const FormatTuple& GetFormatTuple(PixelFormat pixel_format, ComponentType component_type) { @@ -113,7 +114,7 @@ static constexpr std::array, MortonCopy, MortonCopy, MortonCopy, MortonCopy, MortonCopy, - MortonCopy, + MortonCopy, MortonCopy, }; static constexpr std::array, MortonCopy, MortonCopy, - // TODO(Subv): Swizzling the DXT1/DXT23/DXT45 formats is not yet supported + // TODO(Subv): Swizzling the DXT1/DXT23/DXT45/DXN1 formats is not yet supported + nullptr, nullptr, nullptr, nullptr, diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h index 07461017d..6f08678ab 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h @@ -63,6 +63,7 @@ struct SurfaceParams { DXT1 = 6, DXT23 = 7, DXT45 = 8, + DXN1 = 9, // This is also known as BC4 Max, Invalid = 255, @@ -107,6 +108,7 @@ struct SurfaceParams { 4, // DXT1 4, // DXT23 4, // DXT45 + 4, // DXN1 }}; ASSERT(static_cast(format) < compression_factor_table.size()); @@ -130,6 +132,7 @@ struct SurfaceParams { 64, // DXT1 128, // DXT23 128, // DXT45 + 64, // DXN1 }}; ASSERT(static_cast(format) < bpp_table.size()); @@ -185,6 +188,8 @@ struct SurfaceParams { return PixelFormat::DXT23; case Tegra::Texture::TextureFormat::DXT45: return PixelFormat::DXT45; + case Tegra::Texture::TextureFormat::DXN1: + return PixelFormat::DXN1; default: NGLOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast(format)); UNREACHABLE(); @@ -212,6 +217,8 @@ struct SurfaceParams { return Tegra::Texture::TextureFormat::DXT23; case PixelFormat::DXT45: return Tegra::Texture::TextureFormat::DXT45; + case PixelFormat::DXN1: + return Tegra::Texture::TextureFormat::DXN1; default: UNREACHABLE(); } -- cgit v1.2.3