summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar ameerj2023-05-28 13:14:51 -0400
committerGravatar ameerj2023-05-28 13:14:51 -0400
commitea2e155b0b95620e1cc9cc7112315f0cc80b6343 (patch)
treedf95a5dfb5596d33672ce8e6a71d15de833cbaa3 /src
parentMerge pull request #10414 from liamwhite/anv-push-descriptor (diff)
downloadyuzu-ea2e155b0b95620e1cc9cc7112315f0cc80b6343.tar.gz
yuzu-ea2e155b0b95620e1cc9cc7112315f0cc80b6343.tar.xz
yuzu-ea2e155b0b95620e1cc9cc7112315f0cc80b6343.zip
gl_texture_cache: Fix ASTC CPU decoding with compression disabled
gl_format was incorrectly being overwritten when compression was disabled
Diffstat (limited to 'src')
-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 {