summaryrefslogtreecommitdiff
path: root/src/video_core/surface.cpp
diff options
context:
space:
mode:
authorGravatar Matías Locatti2024-02-20 23:19:27 -0300
committerGravatar GitHub2024-02-20 23:19:27 -0300
commite0c17a21138ba4379a5c77b40a7d3fd7414ca605 (patch)
tree798f8678677cabd7c9048ed06022997a804a1aa5 /src/video_core/surface.cpp
parentMerge pull request #13091 from t895/device-renaming (diff)
parenttexture_cache: tweak iteration tracking change (diff)
downloadyuzu-e0c17a21138ba4379a5c77b40a7d3fd7414ca605.tar.gz
yuzu-e0c17a21138ba4379a5c77b40a7d3fd7414ca605.tar.xz
yuzu-e0c17a21138ba4379a5c77b40a7d3fd7414ca605.zip
Merge pull request #10529 from liamwhite/critical-spacing
caches: make critical reclamation less eager and possible in more cases
Diffstat (limited to 'src/video_core/surface.cpp')
-rw-r--r--src/video_core/surface.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/video_core/surface.cpp b/src/video_core/surface.cpp
index 5b3c7aa5a..9055b1b92 100644
--- a/src/video_core/surface.cpp
+++ b/src/video_core/surface.cpp
@@ -3,6 +3,7 @@
3 3
4#include "common/common_types.h" 4#include "common/common_types.h"
5#include "common/math_util.h" 5#include "common/math_util.h"
6#include "common/settings.h"
6#include "video_core/surface.h" 7#include "video_core/surface.h"
7 8
8namespace VideoCore::Surface { 9namespace VideoCore::Surface {
@@ -400,11 +401,20 @@ std::pair<u32, u32> GetASTCBlockSize(PixelFormat format) {
400 return {DefaultBlockWidth(format), DefaultBlockHeight(format)}; 401 return {DefaultBlockWidth(format), DefaultBlockHeight(format)};
401} 402}
402 403
403u64 EstimatedDecompressedSize(u64 base_size, PixelFormat format) { 404u64 TranscodedAstcSize(u64 base_size, PixelFormat format) {
404 constexpr u64 RGBA8_PIXEL_SIZE = 4; 405 constexpr u64 RGBA8_PIXEL_SIZE = 4;
405 const u64 base_block_size = static_cast<u64>(DefaultBlockWidth(format)) * 406 const u64 base_block_size = static_cast<u64>(DefaultBlockWidth(format)) *
406 static_cast<u64>(DefaultBlockHeight(format)) * RGBA8_PIXEL_SIZE; 407 static_cast<u64>(DefaultBlockHeight(format)) * RGBA8_PIXEL_SIZE;
407 return (base_size * base_block_size) / BytesPerBlock(format); 408 const u64 uncompressed_size = (base_size * base_block_size) / BytesPerBlock(format);
409
410 switch (Settings::values.astc_recompression.GetValue()) {
411 case Settings::AstcRecompression::Bc1:
412 return uncompressed_size / 8;
413 case Settings::AstcRecompression::Bc3:
414 return uncompressed_size / 4;
415 default:
416 return uncompressed_size;
417 }
408} 418}
409 419
410} // namespace VideoCore::Surface 420} // namespace VideoCore::Surface