From 415c78b87c008f0d963679ea9bc06c8aa566b506 Mon Sep 17 00:00:00 2001 From: Liam Date: Sat, 20 May 2023 17:15:36 -0400 Subject: textures: add BC1 and BC3 compressors and recompression setting --- .../renderer_opengl/gl_texture_cache.cpp | 31 ++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'src/video_core/renderer_opengl') diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cpp index 31118886f..1e0823836 100644 --- a/src/video_core/renderer_opengl/gl_texture_cache.cpp +++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp @@ -233,6 +233,8 @@ void ApplySwizzle(GLuint handle, PixelFormat format, std::arraydevice, info.format, info.type)) { flags |= ImageFlagBits::Converted; flags |= ImageFlagBits::CostlyLoad; - gl_internal_format = IsPixelFormatSRGB(info.format) ? GL_SRGB8_ALPHA8 : GL_RGBA8; + + const bool is_srgb = IsPixelFormatSRGB(info.format); + gl_internal_format = is_srgb ? GL_SRGB8_ALPHA8 : GL_RGBA8; gl_format = GL_RGBA; gl_type = GL_UNSIGNED_INT_8_8_8_8_REV; + + if (IsPixelFormatASTC(info.format)) { + gl_internal_format = SelectAstcFormat(info.format, is_srgb); + gl_format = GL_NONE; + } } else { const auto& tuple = MaxwellToGL::GetFormatTuple(info.format); gl_internal_format = tuple.internal_format; @@ -1130,7 +1152,12 @@ ImageView::ImageView(TextureCacheRuntime& runtime, const VideoCommon::ImageViewI views{runtime.null_image_views} { const Device& device = runtime.device; if (True(image.flags & ImageFlagBits::Converted)) { - internal_format = IsPixelFormatSRGB(info.format) ? GL_SRGB8_ALPHA8 : GL_RGBA8; + const bool is_srgb = IsPixelFormatSRGB(info.format); + internal_format = is_srgb ? GL_SRGB8_ALPHA8 : GL_RGBA8; + + if (IsPixelFormatASTC(info.format)) { + internal_format = SelectAstcFormat(info.format, is_srgb); + } } else { internal_format = MaxwellToGL::GetFormatTuple(format).internal_format; } -- cgit v1.2.3