diff options
| author | 2023-05-20 17:15:36 -0400 | |
|---|---|---|
| committer | 2023-05-23 12:54:40 -0400 | |
| commit | 415c78b87c008f0d963679ea9bc06c8aa566b506 (patch) | |
| tree | 11e6a5d2211a99660a48678059c703e849c06da3 /src/video_core/renderer_opengl | |
| parent | Merge pull request #10392 from danilaml/update-cubeb-again (diff) | |
| download | yuzu-415c78b87c008f0d963679ea9bc06c8aa566b506.tar.gz yuzu-415c78b87c008f0d963679ea9bc06c8aa566b506.tar.xz yuzu-415c78b87c008f0d963679ea9bc06c8aa566b506.zip | |
textures: add BC1 and BC3 compressors and recompression setting
Diffstat (limited to 'src/video_core/renderer_opengl')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_texture_cache.cpp | 31 |
1 files changed, 29 insertions, 2 deletions
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::array<SwizzleSource, 4 | |||
| 233 | const VideoCommon::ImageInfo& info) { | 233 | const VideoCommon::ImageInfo& info) { |
| 234 | if (IsPixelFormatASTC(info.format) && info.size.depth == 1 && !runtime.HasNativeASTC()) { | 234 | if (IsPixelFormatASTC(info.format) && info.size.depth == 1 && !runtime.HasNativeASTC()) { |
| 235 | return Settings::values.accelerate_astc.GetValue() && | 235 | return Settings::values.accelerate_astc.GetValue() && |
| 236 | Settings::values.astc_recompression.GetValue() == | ||
| 237 | Settings::AstcRecompression::Uncompressed && | ||
| 236 | !Settings::values.async_astc.GetValue(); | 238 | !Settings::values.async_astc.GetValue(); |
| 237 | } | 239 | } |
| 238 | // Disable other accelerated uploads for now as they don't implement swizzled uploads | 240 | // Disable other accelerated uploads for now as they don't implement swizzled uploads |
| @@ -437,6 +439,19 @@ OGLTexture MakeImage(const VideoCommon::ImageInfo& info, GLenum gl_internal_form | |||
| 437 | return GL_R32UI; | 439 | return GL_R32UI; |
| 438 | } | 440 | } |
| 439 | 441 | ||
| 442 | [[nodiscard]] GLenum SelectAstcFormat(PixelFormat format, bool is_srgb) { | ||
| 443 | switch (Settings::values.astc_recompression.GetValue()) { | ||
| 444 | case Settings::AstcRecompression::Bc1: | ||
| 445 | return is_srgb ? GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT : GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; | ||
| 446 | break; | ||
| 447 | case Settings::AstcRecompression::Bc3: | ||
| 448 | return is_srgb ? GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT : GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; | ||
| 449 | break; | ||
| 450 | default: | ||
| 451 | return is_srgb ? GL_SRGB8_ALPHA8 : GL_RGBA8; | ||
| 452 | } | ||
| 453 | } | ||
| 454 | |||
| 440 | } // Anonymous namespace | 455 | } // Anonymous namespace |
| 441 | 456 | ||
| 442 | ImageBufferMap::~ImageBufferMap() { | 457 | ImageBufferMap::~ImageBufferMap() { |
| @@ -739,9 +754,16 @@ Image::Image(TextureCacheRuntime& runtime_, const VideoCommon::ImageInfo& info_, | |||
| 739 | if (IsConverted(runtime->device, info.format, info.type)) { | 754 | if (IsConverted(runtime->device, info.format, info.type)) { |
| 740 | flags |= ImageFlagBits::Converted; | 755 | flags |= ImageFlagBits::Converted; |
| 741 | flags |= ImageFlagBits::CostlyLoad; | 756 | flags |= ImageFlagBits::CostlyLoad; |
| 742 | gl_internal_format = IsPixelFormatSRGB(info.format) ? GL_SRGB8_ALPHA8 : GL_RGBA8; | 757 | |
| 758 | const bool is_srgb = IsPixelFormatSRGB(info.format); | ||
| 759 | gl_internal_format = is_srgb ? GL_SRGB8_ALPHA8 : GL_RGBA8; | ||
| 743 | gl_format = GL_RGBA; | 760 | gl_format = GL_RGBA; |
| 744 | gl_type = GL_UNSIGNED_INT_8_8_8_8_REV; | 761 | gl_type = GL_UNSIGNED_INT_8_8_8_8_REV; |
| 762 | |||
| 763 | if (IsPixelFormatASTC(info.format)) { | ||
| 764 | gl_internal_format = SelectAstcFormat(info.format, is_srgb); | ||
| 765 | gl_format = GL_NONE; | ||
| 766 | } | ||
| 745 | } else { | 767 | } else { |
| 746 | const auto& tuple = MaxwellToGL::GetFormatTuple(info.format); | 768 | const auto& tuple = MaxwellToGL::GetFormatTuple(info.format); |
| 747 | gl_internal_format = tuple.internal_format; | 769 | gl_internal_format = tuple.internal_format; |
| @@ -1130,7 +1152,12 @@ ImageView::ImageView(TextureCacheRuntime& runtime, const VideoCommon::ImageViewI | |||
| 1130 | views{runtime.null_image_views} { | 1152 | views{runtime.null_image_views} { |
| 1131 | const Device& device = runtime.device; | 1153 | const Device& device = runtime.device; |
| 1132 | if (True(image.flags & ImageFlagBits::Converted)) { | 1154 | if (True(image.flags & ImageFlagBits::Converted)) { |
| 1133 | internal_format = IsPixelFormatSRGB(info.format) ? GL_SRGB8_ALPHA8 : GL_RGBA8; | 1155 | const bool is_srgb = IsPixelFormatSRGB(info.format); |
| 1156 | internal_format = is_srgb ? GL_SRGB8_ALPHA8 : GL_RGBA8; | ||
| 1157 | |||
| 1158 | if (IsPixelFormatASTC(info.format)) { | ||
| 1159 | internal_format = SelectAstcFormat(info.format, is_srgb); | ||
| 1160 | } | ||
| 1134 | } else { | 1161 | } else { |
| 1135 | internal_format = MaxwellToGL::GetFormatTuple(format).internal_format; | 1162 | internal_format = MaxwellToGL::GetFormatTuple(format).internal_format; |
| 1136 | } | 1163 | } |