summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar liamwhite2023-05-28 13:18:31 -0400
committerGravatar GitHub2023-05-28 13:18:31 -0400
commit381caf4c00f5d5a611acdc9165a4929ddeb6c195 (patch)
tree9960005e3446f6a92dad61f5e43544c495abc95e /src
parentMerge pull request #10280 from danilaml/cmake-bin-dir (diff)
parentgl_texture_cache: Fix ASTC CPU decoding with compression disabled (diff)
downloadyuzu-381caf4c00f5d5a611acdc9165a4929ddeb6c195.tar.gz
yuzu-381caf4c00f5d5a611acdc9165a4929ddeb6c195.tar.xz
yuzu-381caf4c00f5d5a611acdc9165a4929ddeb6c195.zip
Merge pull request #10483 from ameerj/gl-cpu-astc
gl_texture_cache: Fix ASTC CPU decoding with compression disabled
Diffstat (limited to '')
-rw-r--r--src/video_core/renderer_opengl/gl_texture_cache.cpp9
1 files changed, 7 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 1e0823836..56d0ff869 100644
--- a/src/video_core/renderer_opengl/gl_texture_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp
@@ -439,6 +439,11 @@ OGLTexture MakeImage(const VideoCommon::ImageInfo& info, GLenum gl_internal_form
439 return GL_R32UI; 439 return GL_R32UI;
440} 440}
441 441
442[[nodiscard]] bool IsAstcRecompressionEnabled() {
443 return Settings::values.astc_recompression.GetValue() !=
444 Settings::AstcRecompression::Uncompressed;
445}
446
442[[nodiscard]] GLenum SelectAstcFormat(PixelFormat format, bool is_srgb) { 447[[nodiscard]] GLenum SelectAstcFormat(PixelFormat format, bool is_srgb) {
443 switch (Settings::values.astc_recompression.GetValue()) { 448 switch (Settings::values.astc_recompression.GetValue()) {
444 case Settings::AstcRecompression::Bc1: 449 case Settings::AstcRecompression::Bc1:
@@ -760,7 +765,7 @@ Image::Image(TextureCacheRuntime& runtime_, const VideoCommon::ImageInfo& info_,
760 gl_format = GL_RGBA; 765 gl_format = GL_RGBA;
761 gl_type = GL_UNSIGNED_INT_8_8_8_8_REV; 766 gl_type = GL_UNSIGNED_INT_8_8_8_8_REV;
762 767
763 if (IsPixelFormatASTC(info.format)) { 768 if (IsPixelFormatASTC(info.format) && IsAstcRecompressionEnabled()) {
764 gl_internal_format = SelectAstcFormat(info.format, is_srgb); 769 gl_internal_format = SelectAstcFormat(info.format, is_srgb);
765 gl_format = GL_NONE; 770 gl_format = GL_NONE;
766 } 771 }
@@ -1155,7 +1160,7 @@ ImageView::ImageView(TextureCacheRuntime& runtime, const VideoCommon::ImageViewI
1155 const bool is_srgb = IsPixelFormatSRGB(info.format); 1160 const bool is_srgb = IsPixelFormatSRGB(info.format);
1156 internal_format = is_srgb ? GL_SRGB8_ALPHA8 : GL_RGBA8; 1161 internal_format = is_srgb ? GL_SRGB8_ALPHA8 : GL_RGBA8;
1157 1162
1158 if (IsPixelFormatASTC(info.format)) { 1163 if (IsPixelFormatASTC(info.format) && IsAstcRecompressionEnabled()) {
1159 internal_format = SelectAstcFormat(info.format, is_srgb); 1164 internal_format = SelectAstcFormat(info.format, is_srgb);
1160 } 1165 }
1161 } else { 1166 } else {