mirror of
https://github.com/yuzu-mirror/yuzu.git
synced 2024-12-26 06:54:16 +01:00
vulkan_device: don't use fixed cap for memory limits
This commit is contained in:
parent
5361027ef0
commit
56810541f0
@ -384,6 +384,12 @@ struct Values {
|
|||||||
AstcRecompression::Bc3,
|
AstcRecompression::Bc3,
|
||||||
"astc_recompression",
|
"astc_recompression",
|
||||||
Category::RendererAdvanced};
|
Category::RendererAdvanced};
|
||||||
|
SwitchableSetting<VramUsageMode, true> vram_usage_mode{linkage,
|
||||||
|
VramUsageMode::Conservative,
|
||||||
|
VramUsageMode::Conservative,
|
||||||
|
VramUsageMode::Aggressive,
|
||||||
|
"vram_usage_mode",
|
||||||
|
Category::RendererAdvanced};
|
||||||
SwitchableSetting<bool> async_presentation{linkage,
|
SwitchableSetting<bool> async_presentation{linkage,
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
true,
|
true,
|
||||||
|
@ -122,6 +122,8 @@ ENUM(AstcRecompression, Uncompressed, Bc1, Bc3);
|
|||||||
|
|
||||||
ENUM(VSyncMode, Immediate, Mailbox, Fifo, FifoRelaxed);
|
ENUM(VSyncMode, Immediate, Mailbox, Fifo, FifoRelaxed);
|
||||||
|
|
||||||
|
ENUM(VramUsageMode, Conservative, Aggressive);
|
||||||
|
|
||||||
ENUM(RendererBackend, OpenGL, Vulkan, Null);
|
ENUM(RendererBackend, OpenGL, Vulkan, Null);
|
||||||
|
|
||||||
ENUM(ShaderBackend, Glsl, Glasm, SpirV);
|
ENUM(ShaderBackend, Glsl, Glasm, SpirV);
|
||||||
|
@ -1297,10 +1297,6 @@ u64 Device::GetDeviceMemoryUsage() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Device::CollectPhysicalMemoryInfo() {
|
void Device::CollectPhysicalMemoryInfo() {
|
||||||
// Account for resolution scaling in memory limits
|
|
||||||
const size_t normal_memory = 6_GiB;
|
|
||||||
const size_t scaler_memory = 1_GiB * Settings::values.resolution_info.ScaleUp(1);
|
|
||||||
|
|
||||||
// Calculate limits using memory budget
|
// Calculate limits using memory budget
|
||||||
VkPhysicalDeviceMemoryBudgetPropertiesEXT budget{};
|
VkPhysicalDeviceMemoryBudgetPropertiesEXT budget{};
|
||||||
budget.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_BUDGET_PROPERTIES_EXT;
|
budget.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_BUDGET_PROPERTIES_EXT;
|
||||||
@ -1331,7 +1327,15 @@ void Device::CollectPhysicalMemoryInfo() {
|
|||||||
if (!is_integrated) {
|
if (!is_integrated) {
|
||||||
const u64 reserve_memory = std::min<u64>(device_access_memory / 8, 1_GiB);
|
const u64 reserve_memory = std::min<u64>(device_access_memory / 8, 1_GiB);
|
||||||
device_access_memory -= reserve_memory;
|
device_access_memory -= reserve_memory;
|
||||||
device_access_memory = std::min<u64>(device_access_memory, normal_memory + scaler_memory);
|
|
||||||
|
if (Settings::values.vram_usage_mode.GetValue() != Settings::VramUsageMode::Aggressive) {
|
||||||
|
// Account for resolution scaling in memory limits
|
||||||
|
const size_t normal_memory = 6_GiB;
|
||||||
|
const size_t scaler_memory = 1_GiB * Settings::values.resolution_info.ScaleUp(1);
|
||||||
|
device_access_memory =
|
||||||
|
std::min<u64>(device_access_memory, normal_memory + scaler_memory);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const s64 available_memory = static_cast<s64>(device_access_memory - device_initial_usage);
|
const s64 available_memory = static_cast<s64>(device_access_memory - device_initial_usage);
|
||||||
|
@ -164,6 +164,11 @@ std::unique_ptr<TranslationMap> InitializeTranslations(QWidget* parent) {
|
|||||||
"the emulator to decompress to an intermediate format any card supports, RGBA8.\n"
|
"the emulator to decompress to an intermediate format any card supports, RGBA8.\n"
|
||||||
"This option recompresses RGBA8 to either the BC1 or BC3 format, saving VRAM but "
|
"This option recompresses RGBA8 to either the BC1 or BC3 format, saving VRAM but "
|
||||||
"negatively affecting image quality."));
|
"negatively affecting image quality."));
|
||||||
|
INSERT(Settings, vram_usage_mode, tr("VRAM Usage Mode:"),
|
||||||
|
tr("Selects whether the emulator should prefer to conserve memory or make maximum usage "
|
||||||
|
"of available video memory for performance. Has no effect on integrated graphics. "
|
||||||
|
"Aggressive mode may severely impact the performance of other applications such as "
|
||||||
|
"recording software."));
|
||||||
INSERT(
|
INSERT(
|
||||||
Settings, vsync_mode, tr("VSync Mode:"),
|
Settings, vsync_mode, tr("VSync Mode:"),
|
||||||
tr("FIFO (VSync) does not drop frames or exhibit tearing but is limited by the screen "
|
tr("FIFO (VSync) does not drop frames or exhibit tearing but is limited by the screen "
|
||||||
@ -315,6 +320,11 @@ std::unique_ptr<ComboboxTranslationMap> ComboboxEnumeration(QWidget* parent) {
|
|||||||
PAIR(AstcRecompression, Bc1, tr("BC1 (Low quality)")),
|
PAIR(AstcRecompression, Bc1, tr("BC1 (Low quality)")),
|
||||||
PAIR(AstcRecompression, Bc3, tr("BC3 (Medium quality)")),
|
PAIR(AstcRecompression, Bc3, tr("BC3 (Medium quality)")),
|
||||||
}});
|
}});
|
||||||
|
translations->insert({Settings::EnumMetadata<Settings::VramUsageMode>::Index(),
|
||||||
|
{
|
||||||
|
PAIR(VramUsageMode, Conservative, tr("Conservative")),
|
||||||
|
PAIR(VramUsageMode, Aggressive, tr("Aggressive")),
|
||||||
|
}});
|
||||||
translations->insert({Settings::EnumMetadata<Settings::RendererBackend>::Index(),
|
translations->insert({Settings::EnumMetadata<Settings::RendererBackend>::Index(),
|
||||||
{
|
{
|
||||||
#ifdef HAS_OPENGL
|
#ifdef HAS_OPENGL
|
||||||
|
Loading…
Reference in New Issue
Block a user