diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h
index d32f228e2..8f54408a1 100644
--- a/src/video_core/buffer_cache/buffer_cache.h
+++ b/src/video_core/buffer_cache/buffer_cache.h
@@ -43,7 +43,7 @@ BufferCache
::BufferCache(Tegra::MaxwellDeviceMemoryManager& device_memory_, R
if (configured_limit_mb > 0) {
vram_limit_bytes = static_cast(configured_limit_mb) * 1_MiB;
} else {
- vram_limit_bytes = static_cast(device_local_memory * 0.80);
+ vram_limit_bytes = static_cast(static_cast(device_local_memory) * 0.80);
}
// Adjust thresholds based on GC aggressiveness setting
@@ -74,8 +74,8 @@ BufferCache::BufferCache(Tegra::MaxwellDeviceMemoryManager& device_memory_, R
break;
}
- minimum_memory = static_cast(vram_limit_bytes * expected_ratio);
- critical_memory = static_cast(vram_limit_bytes * critical_ratio);
+ minimum_memory = static_cast(static_cast(vram_limit_bytes) * expected_ratio);
+ critical_memory = static_cast(static_cast(vram_limit_bytes) * critical_ratio);
LOG_INFO(Render_Vulkan,
"Buffer cache VRAM initialized: limit={}MB, minimum={}MB, critical={}MB",
@@ -95,7 +95,7 @@ void BufferCache::RunGarbageCollector() {
}
const bool aggressive_gc = total_used_memory >= critical_memory;
- const bool emergency_gc = total_used_memory >= static_cast(vram_limit_bytes * BUFFER_VRAM_CRITICAL_THRESHOLD);
+ const bool emergency_gc = total_used_memory >= static_cast(static_cast(vram_limit_bytes) * BUFFER_VRAM_CRITICAL_THRESHOLD);
// FIXED: VRAM leak prevention - Get eviction frames from settings
const u64 eviction_frames = Settings::values.buffer_eviction_frames.GetValue();
@@ -207,7 +207,7 @@ void BufferCache::TickFrame() {
const auto gc_level = Settings::values.gc_aggressiveness.GetValue();
const bool should_gc = gc_level != Settings::GCAggressiveness::Off &&
(total_used_memory >= minimum_memory ||
- total_used_memory >= static_cast(vram_limit_bytes * BUFFER_VRAM_WARNING_THRESHOLD));
+ total_used_memory >= static_cast(static_cast(vram_limit_bytes) * BUFFER_VRAM_WARNING_THRESHOLD));
if (should_gc) {
RunGarbageCollector();