android: config: Expose VSync as a configurable setting.

This commit is contained in:
bunnei 2023-05-24 22:12:32 -07:00
parent f0ed20c8a2
commit b4725332a2
5 changed files with 44 additions and 9 deletions

View file

@ -73,6 +73,11 @@ enum class IntSetting(
Settings.SECTION_RENDERER,
2
),
RENDERER_VSYNC(
"use_vsync",
Settings.SECTION_RENDERER,
0
),
RENDERER_SCALING_FILTER(
"scaling_filter",
Settings.SECTION_RENDERER,
@ -115,7 +120,8 @@ enum class IntSetting(
RENDERER_ASYNCHRONOUS_SHADERS,
RENDERER_DEBUG,
RENDERER_BACKEND,
RENDERER_RESOLUTION
RENDERER_RESOLUTION,
RENDERER_VSYNC
)
fun from(key: String): IntSetting? = IntSetting.values().firstOrNull { it.key == key }

View file

@ -249,6 +249,17 @@ class SettingsFragmentPresenter(private val fragmentView: SettingsFragmentView)
IntSetting.RENDERER_RESOLUTION.defaultValue
)
)
add(
SingleChoiceSetting(
IntSetting.RENDERER_VSYNC,
R.string.renderer_vsync,
0,
R.array.rendererVSyncNames,
R.array.rendererVSyncValues,
IntSetting.RENDERER_VSYNC.key,
IntSetting.RENDERER_VSYNC.defaultValue
)
)
add(
SingleChoiceSetting(
IntSetting.RENDERER_SCALING_FILTER,

View file

@ -210,27 +210,24 @@ void Config::ReadValues() {
ReadSetting("Renderer", Settings::values.speed_limit);
ReadSetting("Renderer", Settings::values.use_disk_shader_cache);
ReadSetting("Renderer", Settings::values.use_asynchronous_gpu_emulation);
ReadSetting("Renderer", Settings::values.vsync_mode);
ReadSetting("Renderer", Settings::values.shader_backend);
ReadSetting("Renderer", Settings::values.use_asynchronous_shaders);
ReadSetting("Renderer", Settings::values.nvdec_emulation);
ReadSetting("Renderer", Settings::values.use_fast_gpu_time);
ReadSetting("Renderer", Settings::values.use_vulkan_driver_pipeline_cache);
ReadSetting("Renderer", Settings::values.bg_red);
ReadSetting("Renderer", Settings::values.bg_green);
ReadSetting("Renderer", Settings::values.bg_blue);
// Use GPU accuracy normal by default on Android
Settings::values.gpu_accuracy = static_cast<Settings::GPUAccuracy>(config->GetInteger(
"Renderer", "gpu_accuracy", static_cast<u32>(Settings::GPUAccuracy::Normal)));
// Use Mailbox VSync by default on Android
Settings::values.vsync_mode = static_cast<Settings::VSyncMode>(config->GetInteger(
"Renderer", "use_vsync", static_cast<u32>(Settings::VSyncMode::Mailbox)));
// Use GPU default anisotropic filtering on Android
Settings::values.max_anisotropy = config->GetInteger("Renderer", "max_anisotropy", 1);
ReadSetting("Renderer", Settings::values.bg_red);
ReadSetting("Renderer", Settings::values.bg_green);
ReadSetting("Renderer", Settings::values.bg_blue);
// Disable ASTC compute by default on Android
Settings::values.accelerate_astc = config->GetBoolean("Renderer", "accelerate_astc", false);

View file

@ -96,6 +96,13 @@
<item>@string/resolution_four</item>
</string-array>
<string-array name="rendererVSyncNames">
<item>@string/renderer_vsync_immediate</item>
<item>@string/renderer_vsync_mailbox</item>
<item>@string/renderer_vsync_fifo</item>
<item>@string/renderer_vsync_fifo_relaxed</item>
</string-array>
<integer-array name="rendererResolutionValues">
<item>0</item>
<item>1</item>
@ -105,6 +112,13 @@
<item>5</item>
</integer-array>
<integer-array name="rendererVSyncValues">
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
</integer-array>
<string-array name="rendererAspectRatioNames">
<item>@string/ratio_default</item>
<item>@string/ratio_force_four_three</item>

View file

@ -122,6 +122,7 @@
<string name="renderer_api">API</string>
<string name="renderer_accuracy">Accuracy level</string>
<string name="renderer_resolution">Resolution</string>
<string name="renderer_vsync">VSync mode</string>
<string name="renderer_aspect_ratio">Aspect Ratio</string>
<string name="renderer_scaling_filter">Window Adapting Filter</string>
<string name="renderer_anti_aliasing">Anti-Aliasing Method</string>
@ -259,6 +260,12 @@
<string name="resolution_three">3X (2160p/3240p) (Slow)</string>
<string name="resolution_four">4X (2880p/4320p) (Slow)</string>
<!-- Renderer VSync -->
<string name="renderer_vsync_immediate">Immediate (Off)</string>
<string name="renderer_vsync_mailbox">Mailbox</string>
<string name="renderer_vsync_fifo">FIFO (On)</string>
<string name="renderer_vsync_fifo_relaxed">FIFO Relaxed</string>
<!-- Scaling Filters -->
<string name="scaling_filter_nearest_neighbor">Nearest Neighbor</string>
<string name="scaling_filter_bilinear">Bilinear</string>