diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2021-10-18 22:56:36 +0200 |
---|---|---|
committer | Fernando Sahmkow <fsahmkow27@gmail.com> | 2021-11-16 22:11:31 +0100 |
commit | 3b61de74e6dc7526ffa8f03c21d81e2c3566ce90 (patch) | |
tree | 4f97e24ed00d7e46564e6aa8ecd3c05d6f6525ff /src/video_core/renderer_opengl/gl_texture_cache.cpp | |
parent | Texture Cache: ease the requirements of textures being blacklisted. (diff) | |
download | yuzu-3b61de74e6dc7526ffa8f03c21d81e2c3566ce90.tar yuzu-3b61de74e6dc7526ffa8f03c21d81e2c3566ce90.tar.gz yuzu-3b61de74e6dc7526ffa8f03c21d81e2c3566ce90.tar.bz2 yuzu-3b61de74e6dc7526ffa8f03c21d81e2c3566ce90.tar.lz yuzu-3b61de74e6dc7526ffa8f03c21d81e2c3566ce90.tar.xz yuzu-3b61de74e6dc7526ffa8f03c21d81e2c3566ce90.tar.zst yuzu-3b61de74e6dc7526ffa8f03c21d81e2c3566ce90.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/renderer_opengl/gl_texture_cache.cpp | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cpp index 34d3723e5..a6e9eb60b 100644 --- a/src/video_core/renderer_opengl/gl_texture_cache.cpp +++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp @@ -697,7 +697,7 @@ void Image::UploadMemory(const ImageBufferMap& map, std::span<const VideoCommon::BufferImageCopy> copies) { const bool is_rescaled = True(flags & ImageFlagBits::Rescaled); if (is_rescaled) { - ScaleDown(); + ScaleDown(true); } glBindBuffer(GL_PIXEL_UNPACK_BUFFER, map.buffer); glFlushMappedBufferRange(GL_PIXEL_UNPACK_BUFFER, map.offset, unswizzled_size_bytes); @@ -725,6 +725,10 @@ void Image::UploadMemory(const ImageBufferMap& map, void Image::DownloadMemory(ImageBufferMap& map, std::span<const VideoCommon::BufferImageCopy> copies) { + const bool is_rescaled = True(flags & ImageFlagBits::Rescaled); + if (is_rescaled) { + ScaleDown(); + } glMemoryBarrier(GL_PIXEL_BUFFER_BARRIER_BIT); // TODO: Move this to its own API glBindBuffer(GL_PIXEL_PACK_BUFFER, map.buffer); glPixelStorei(GL_PACK_ALIGNMENT, 1); @@ -743,6 +747,9 @@ void Image::DownloadMemory(ImageBufferMap& map, } CopyImageToBuffer(copy, map.offset); } + if (is_rescaled) { + ScaleUp(true); + } } GLuint Image::StorageHandle() noexcept { @@ -979,7 +986,7 @@ bool Image::Scale(bool up_scale) { return true; } -bool Image::ScaleUp() { +bool Image::ScaleUp(bool ignore) { if (True(flags & ImageFlagBits::Rescaled)) { return false; } @@ -997,7 +1004,11 @@ bool Image::ScaleUp() { flags &= ~ImageFlagBits::Rescaled; return false; } - scale_count++; + has_scaled = true; + if (ignore) { + current_texture = upscaled_backup.handle; + return true; + } if (!Scale()) { flags &= ~ImageFlagBits::Rescaled; return false; @@ -1005,7 +1016,7 @@ bool Image::ScaleUp() { return true; } -bool Image::ScaleDown() { +bool Image::ScaleDown(bool ignore) { if (False(flags & ImageFlagBits::Rescaled)) { return false; } @@ -1013,7 +1024,10 @@ bool Image::ScaleDown() { if (!runtime->resolution.active) { return false; } - scale_count++; + if (ignore) { + current_texture = texture.handle; + return true; + } if (!Scale(false)) { flags &= ~ImageFlagBits::Rescaled; return false; |