fixed calculation, ui look and behavior, and compile errors
This commit is contained in:
parent
418709c80a
commit
de5f61f8c7
10 changed files with 62 additions and 34 deletions
|
@ -238,8 +238,8 @@ void RestoreGlobalState(bool is_powered_on) {
|
|||
values.bg_green.SetGlobal(true);
|
||||
values.bg_blue.SetGlobal(true);
|
||||
values.enable_compute_pipelines.SetGlobal(true);
|
||||
values.use_vram_percentage(true);
|
||||
values.vram_percentage(25);
|
||||
values.use_vram_percentage.SetGlobal(true);
|
||||
values.vram_percentage.SetGlobal(true);
|
||||
|
||||
// System
|
||||
values.language_index.SetGlobal(true);
|
||||
|
|
|
@ -487,7 +487,7 @@ struct Values {
|
|||
SwitchableSetting<u8> bg_green{0, "bg_green"};
|
||||
SwitchableSetting<u8> bg_blue{0, "bg_blue"};
|
||||
|
||||
SwitchableSetting<bool, true> use_vram_percentage{true, "use_vram_percentage"};
|
||||
SwitchableSetting<bool> use_vram_percentage{true, "use_vram_percentage"};
|
||||
SwitchableSetting<u8, true> vram_percentage{25, 10, 90, "vram_percentage"};
|
||||
|
||||
// System
|
||||
|
@ -615,4 +615,6 @@ void UpdateRescalingInfo();
|
|||
// Restore the global state of all applicable settings in the Values struct
|
||||
void RestoreGlobalState(bool is_powered_on);
|
||||
|
||||
u64 RAM_Percent_to_Byte(u8 percent);
|
||||
|
||||
} // namespace Settings
|
||||
|
|
|
@ -142,7 +142,7 @@ BufferCacheRuntime::BufferCacheRuntime(const Device& device_)
|
|||
|
||||
u64 BufferCacheRuntime::GetDeviceMemoryUsage() const {
|
||||
if (device.CanReportMemoryUsage()) {
|
||||
return device_access_memory - device.GetCurrentDedicatedVideoMemory();
|
||||
return device.GetTotalDedicatedVideoMemory() - device.GetCurrentDedicatedVideoMemory();
|
||||
}
|
||||
return 2_GiB;
|
||||
}
|
||||
|
|
|
@ -289,10 +289,16 @@ u64 Device::GetTotalDedicatedVideoMemory() const {
|
|||
// this should report the correct size of the VRAM, on integrated devices it shows the size of
|
||||
// the UMA Framebuffer
|
||||
glGetIntegerv(GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX, &tot_avail_mem_kb);
|
||||
// LOG_INFO(Render_OpenGL, "total VRAM: {} GB", tot_avail_mem_kb / f64{1_MiB});
|
||||
f64 percent = Settings::values.vram_percentage.GetValue();
|
||||
u64 vram = Settings::RAM_Percent_to_Byte(percent);
|
||||
return static_cast<u64>(tot_avail_mem_kb) * 1_KiB + vram;
|
||||
|
||||
if (Settings::values.use_vram_percentage.GetValue()) {
|
||||
u8 percent = Settings::values.vram_percentage.GetValue();
|
||||
return Settings::RAM_Percent_to_Byte(percent);
|
||||
}
|
||||
else {
|
||||
// this is according to both former settings in the gl_buffer_cache
|
||||
// and gl_texture_cache, regarding device_access_memory
|
||||
return static_cast<u64>(tot_avail_mem_kb) * 1_KiB + 512_MiB;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -300,7 +306,6 @@ u64 Device::GetCurrentDedicatedVideoMemory() const {
|
|||
GLint cur_avail_mem_kb = 0;
|
||||
// this should report the currently available video memory
|
||||
glGetIntegerv(GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX, &cur_avail_mem_kb);
|
||||
// LOG_INFO(Render_OpenGL, "current VRAM: {} GB", cur_avail_mem_kb / f64{1_MiB});
|
||||
return static_cast<u64>(cur_avail_mem_kb) * 1_KiB;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,8 @@ public:
|
|||
|
||||
[[nodiscard]] std::string GetVendorName() const;
|
||||
|
||||
u64 GetTotalDedicatedVideoMemory() const;
|
||||
|
||||
u64 GetCurrentDedicatedVideoMemory() const;
|
||||
|
||||
u32 GetMaxUniformBuffers(Shader::Stage stage) const noexcept {
|
||||
|
|
|
@ -568,7 +568,7 @@ ImageBufferMap TextureCacheRuntime::DownloadStagingBuffer(size_t size) {
|
|||
|
||||
u64 TextureCacheRuntime::GetDeviceMemoryUsage() const {
|
||||
if (device.CanReportMemoryUsage()) {
|
||||
return device_access_memory - device.GetCurrentDedicatedVideoMemory();
|
||||
return device.GetTotalDedicatedVideoMemory() - device.GetCurrentDedicatedVideoMemory();
|
||||
}
|
||||
return 2_GiB;
|
||||
}
|
||||
|
|
|
@ -1041,8 +1041,9 @@ void Device::CollectPhysicalMemoryInfo() {
|
|||
}
|
||||
const u8 percent = Settings::values.vram_percentage.GetValue();
|
||||
const s64 available_memory = static_cast<s64>(device_access_memory - device_initial_usage);
|
||||
const s64 limit = Settings::values.use_vram_percentage.GetValue() ? Settings::RAM_Percent_to_Byte(percent) : 4_GiB;
|
||||
device_access_memory = static_cast<u64>(std::max<s64>(
|
||||
std::min<s64>(available_memory - 8_GiB, 4_GiB), std::min<s64>(local_memory, Settings::RAM_Percent_to_Byte(percent)));
|
||||
std::min<s64>(available_memory - 8_GiB, 4_GiB), std::min<s64>(local_memory, limit)));
|
||||
}
|
||||
|
||||
void Device::CollectToolingInfo() {
|
||||
|
|
|
@ -757,6 +757,8 @@ void Config::ReadRendererValues() {
|
|||
ReadGlobalSetting(Settings::values.bg_red);
|
||||
ReadGlobalSetting(Settings::values.bg_green);
|
||||
ReadGlobalSetting(Settings::values.bg_blue);
|
||||
ReadGlobalSetting(Settings::values.use_vram_percentage);
|
||||
ReadGlobalSetting(Settings::values.vram_percentage);
|
||||
|
||||
if (global) {
|
||||
Settings::values.vsync_mode.SetValue(static_cast<Settings::VSyncMode>(
|
||||
|
@ -1412,6 +1414,8 @@ void Config::SaveRendererValues() {
|
|||
WriteGlobalSetting(Settings::values.bg_red);
|
||||
WriteGlobalSetting(Settings::values.bg_green);
|
||||
WriteGlobalSetting(Settings::values.bg_blue);
|
||||
WriteGlobalSetting(Settings::values.use_vram_percentage);
|
||||
WriteGlobalSetting(Settings::values.vram_percentage);
|
||||
|
||||
if (global) {
|
||||
WriteSetting(QString::fromStdString(Settings::values.vsync_mode.GetLabel()),
|
||||
|
|
|
@ -31,6 +31,7 @@ void ConfigureGraphicsAdvanced::SetConfiguration() {
|
|||
ui->use_asynchronous_shaders->setEnabled(runtime_lock);
|
||||
ui->anisotropic_filtering_combobox->setEnabled(runtime_lock);
|
||||
ui->enable_compute_pipelines_checkbox->setEnabled(runtime_lock);
|
||||
ui->use_vram_percentage->setEnabled(runtime_lock);
|
||||
|
||||
ui->async_present->setChecked(Settings::values.async_presentation.GetValue());
|
||||
ui->renderer_force_max_clock->setChecked(Settings::values.renderer_force_max_clock.GetValue());
|
||||
|
@ -43,7 +44,15 @@ void ConfigureGraphicsAdvanced::SetConfiguration() {
|
|||
ui->enable_compute_pipelines_checkbox->setChecked(
|
||||
Settings::values.enable_compute_pipelines.GetValue());
|
||||
ui->use_vram_percentage->setChecked(Settings::values.use_vram_percentage.GetValue());
|
||||
ui->vram_percentage->setVisible(Settings::values.use_vram_percentage.GetValue());
|
||||
|
||||
if (Settings::IsConfiguringGlobal()) {
|
||||
ui->vram_percentage->setEnabled(Settings::values.use_vram_percentage.GetValue() && runtime_lock);
|
||||
} else {
|
||||
ui->vram_percentage->setEnabled(Settings::values.use_vram_percentage.GetValue() &&
|
||||
use_vram_percentage != ConfigurationShared::CheckState::Global && runtime_lock);
|
||||
}
|
||||
|
||||
ui->vram_percentage->setValue(Settings::values.vram_percentage.GetValue());
|
||||
|
||||
|
||||
if (Settings::IsConfiguringGlobal()) {
|
||||
|
@ -65,6 +74,7 @@ void ConfigureGraphicsAdvanced::SetConfiguration() {
|
|||
!Settings::values.max_anisotropy.UsingGlobal());
|
||||
ConfigurationShared::SetHighlight(ui->label_astc_recompression,
|
||||
!Settings::values.astc_recompression.UsingGlobal());
|
||||
ConfigurationShared::SetHighlight(ui->vram_percentage, !Settings::values.vram_percentage.UsingGlobal());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -97,9 +107,7 @@ void ConfigureGraphicsAdvanced::ApplyConfiguration() {
|
|||
ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_vram_percentage,
|
||||
ui->use_vram_percentage,
|
||||
use_vram_percentage);
|
||||
ConfigurationShared::ApplyPerGameSetting(&Settings::values.vram_percentage,
|
||||
ui->vram_percentage,
|
||||
vram_percentage);
|
||||
Settings::values.vram_percentage.SetValue(ui->vram_percentage->value());
|
||||
}
|
||||
|
||||
void ConfigureGraphicsAdvanced::changeEvent(QEvent* event) {
|
||||
|
@ -170,9 +178,11 @@ void ConfigureGraphicsAdvanced::SetupPerGameUI() {
|
|||
ConfigurationShared::SetColoredTristate(ui->use_vram_percentage,
|
||||
Settings::values.use_vram_percentage,
|
||||
use_vram_percentage);
|
||||
ConfigurationShared::SetColoredTristate(ui->vram_percentage,
|
||||
Settings::values.vram_percentage,
|
||||
vram_percentage);
|
||||
|
||||
connect(ui->use_vram_percentage, &QCheckBox::clicked, ui->vram_percentage, [this]() {
|
||||
ui->vram_percentage->setEnabled(ui->use_vram_percentage->isChecked() &&
|
||||
(use_vram_percentage != ConfigurationShared::CheckState::Global));
|
||||
});
|
||||
}
|
||||
|
||||
void ConfigureGraphicsAdvanced::ExposeComputeOption() {
|
||||
|
|
|
@ -247,14 +247,19 @@ Compute pipelines are always enabled on all other drivers.</string>
|
|||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="use_vram_percentage">
|
||||
<property name="toolTip">
|
||||
<string>Assign the given percentage of the total shared RAM as VRAM</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Assign RAM percentage as VRAM (Integrated devices only)</string>
|
||||
</property>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_vram">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="use_vram_percentage">
|
||||
<property name="toolTip">
|
||||
<string>Assign the given % of the total shared RAM as VRAM</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Assign % of RAM as VRAM (Integrated devices only)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -265,7 +270,7 @@ Compute pipelines are always enabled on all other drivers.</string>
|
|||
<property name="minimum">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<property name="maximum">
|
||||
<number>90</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
|
@ -274,13 +279,12 @@ Compute pipelines are always enabled on all other drivers.</string>
|
|||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
|
|
Loading…
Add table
Reference in a new issue