From 06578e89b2598eca6c2da1cb8dcdc576aa3f632a Mon Sep 17 00:00:00 2001 From: greggameplayer <33609333+greggameplayer@users.noreply.github.com> Date: Fri, 31 Aug 2018 18:11:19 +0200 Subject: Implement BC6H_UF16 & BC6H_SF16 (#1092) * Implement BC6H_UF16 & BC6H_SF16 Require by ARMS * correct coding style * correct coding style part 2 --- .../renderer_opengl/gl_rasterizer_cache.cpp | 16 +++++- .../renderer_opengl/gl_rasterizer_cache.h | 66 +++++++++++++--------- src/video_core/textures/decoders.cpp | 4 ++ 3 files changed, 55 insertions(+), 31 deletions(-) (limited to 'src/video_core') diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index d87f90a62..e53a1a2ec 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp @@ -120,7 +120,11 @@ static constexpr std::array tex_form true}, // DXN2UNORM {GL_COMPRESSED_SIGNED_RG_RGTC2, GL_RG, GL_INT, ComponentType::SNorm, true}, // DXN2SNORM {GL_COMPRESSED_RGBA_BPTC_UNORM_ARB, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm, - true}, // BC7U + true}, // BC7U + {GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB, GL_RGB, GL_UNSIGNED_INT_8_8_8_8, + ComponentType::UNorm, true}, // BC6H_UF16 + {GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB, GL_RGB, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm, + true}, // BC6H_SF16 {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_4X4 {GL_RG8, GL_RG, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // G8R8U {GL_RG8, GL_RG, GL_BYTE, ComponentType::SNorm, false}, // G8R8S @@ -210,6 +214,8 @@ static bool IsFormatBCn(PixelFormat format) { case PixelFormat::DXN2SNORM: case PixelFormat::DXN2UNORM: case PixelFormat::BC7U: + case PixelFormat::BC6H_UF16: + case PixelFormat::BC6H_SF16: return true; } return false; @@ -266,6 +272,8 @@ static constexpr std::array&, Tegra::GPU MortonCopy, MortonCopy, MortonCopy, + MortonCopy, + MortonCopy, MortonCopy, MortonCopy, MortonCopy, @@ -314,8 +322,10 @@ static constexpr std::array&, Tegra::GPU MortonCopy, MortonCopy, MortonCopy, - // TODO(Subv): Swizzling DXT1/DXT23/DXT45/DXN1/DXN2/BC7U/ASTC_2D_4X4 formats is not - // supported + // TODO(Subv): Swizzling DXT1/DXT23/DXT45/DXN1/DXN2/BC7U/BC6H_UF16/BC6H_SF16/ASTC_2D_4X4 + // formats are not supported + nullptr, + 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 8a6ca2a4b..ecdd8d8e5 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h @@ -45,42 +45,44 @@ struct SurfaceParams { DXN2UNORM = 17, DXN2SNORM = 18, BC7U = 19, - ASTC_2D_4X4 = 20, - G8R8U = 21, - G8R8S = 22, - BGRA8 = 23, - RGBA32F = 24, - RG32F = 25, - R32F = 26, - R16F = 27, - R16U = 28, - R16S = 29, - R16UI = 30, - R16I = 31, - RG16 = 32, - RG16F = 33, - RG16UI = 34, - RG16I = 35, - RG16S = 36, - RGB32F = 37, - SRGBA8 = 38, - RG8U = 39, - RG8S = 40, - RG32UI = 41, - R32UI = 42, + BC6H_UF16 = 20, + BC6H_SF16 = 21, + ASTC_2D_4X4 = 22, + G8R8U = 23, + G8R8S = 24, + BGRA8 = 25, + RGBA32F = 26, + RG32F = 27, + R32F = 28, + R16F = 29, + R16U = 30, + R16S = 31, + R16UI = 32, + R16I = 33, + RG16 = 34, + RG16F = 35, + RG16UI = 36, + RG16I = 37, + RG16S = 38, + RGB32F = 39, + SRGBA8 = 40, + RG8U = 41, + RG8S = 42, + RG32UI = 43, + R32UI = 44, MaxColorFormat, // Depth formats - Z32F = 43, - Z16 = 44, + Z32F = 45, + Z16 = 46, MaxDepthFormat, // DepthStencil formats - Z24S8 = 45, - S8Z24 = 46, - Z32FS8 = 47, + Z24S8 = 47, + S8Z24 = 48, + Z32FS8 = 49, MaxDepthStencilFormat, @@ -138,6 +140,8 @@ struct SurfaceParams { 4, // DXN2UNORM 4, // DXN2SNORM 4, // BC7U + 4, // BC6H_UF16 + 4, // BC6H_SF16 4, // ASTC_2D_4X4 1, // G8R8U 1, // G8R8S @@ -197,6 +201,8 @@ struct SurfaceParams { 128, // DXN2UNORM 128, // DXN2SNORM 128, // BC7U + 128, // BC6H_UF16 + 128, // BC6H_SF16 32, // ASTC_2D_4X4 16, // G8R8U 16, // G8R8S @@ -482,6 +488,10 @@ struct SurfaceParams { UNREACHABLE(); case Tegra::Texture::TextureFormat::BC7U: return PixelFormat::BC7U; + case Tegra::Texture::TextureFormat::BC6H_UF16: + return PixelFormat::BC6H_UF16; + case Tegra::Texture::TextureFormat::BC6H_SF16: + return PixelFormat::BC6H_SF16; case Tegra::Texture::TextureFormat::ASTC_2D_4X4: return PixelFormat::ASTC_2D_4X4; case Tegra::Texture::TextureFormat::R16_G16: diff --git a/src/video_core/textures/decoders.cpp b/src/video_core/textures/decoders.cpp index 70746a34e..272294c62 100644 --- a/src/video_core/textures/decoders.cpp +++ b/src/video_core/textures/decoders.cpp @@ -56,6 +56,8 @@ u32 BytesPerPixel(TextureFormat format) { case TextureFormat::DXT45: case TextureFormat::DXN2: case TextureFormat::BC7U: + case TextureFormat::BC6H_UF16: + case TextureFormat::BC6H_SF16: // In this case a 'pixel' actually refers to a 4x4 tile. return 16; case TextureFormat::R32_G32_B32: @@ -106,6 +108,8 @@ std::vector DecodeTexture(const std::vector& texture_data, TextureFormat case TextureFormat::DXN1: case TextureFormat::DXN2: case TextureFormat::BC7U: + case TextureFormat::BC6H_UF16: + case TextureFormat::BC6H_SF16: case TextureFormat::ASTC_2D_4X4: case TextureFormat::A8R8G8B8: case TextureFormat::A2B10G10R10: -- cgit v1.2.3