Allow frame_queue_size=1 for reduced input lag

This commit is contained in:
Danni 2024-07-28 23:03:13 -04:00
parent 88d9325065
commit c85caa7bb8
3 changed files with 3 additions and 2 deletions

View File

@ -1543,7 +1543,7 @@ ProjectSettings::ProjectSettings() {
GLOBAL_DEF_BASIC("gui/common/snap_controls_to_pixels", true);
GLOBAL_DEF_BASIC("gui/fonts/dynamic_fonts/use_oversampling", true);
GLOBAL_DEF_RST(PropertyInfo(Variant::INT, "rendering/rendering_device/vsync/frame_queue_size", PROPERTY_HINT_RANGE, "2,3,1"), 2);
GLOBAL_DEF_RST(PropertyInfo(Variant::INT, "rendering/rendering_device/vsync/frame_queue_size", PROPERTY_HINT_RANGE, "1,3,1"), 2);
GLOBAL_DEF_RST(PropertyInfo(Variant::INT, "rendering/rendering_device/vsync/swapchain_image_count", PROPERTY_HINT_RANGE, "2,4,1"), 3);
GLOBAL_DEF(PropertyInfo(Variant::INT, "rendering/rendering_device/staging_buffer/block_size_kb", PROPERTY_HINT_RANGE, "4,2048,1,or_greater"), 256);
GLOBAL_DEF(PropertyInfo(Variant::INT, "rendering/rendering_device/staging_buffer/max_size_mb", PROPERTY_HINT_RANGE, "1,1024,1,or_greater"), 128);

View File

@ -2780,6 +2780,7 @@
</member>
<member name="rendering/rendering_device/vsync/frame_queue_size" type="int" setter="" getter="" default="2">
The number of frames to track on the CPU side before stalling to wait for the GPU.
A lower value may improve input latency at the cost of reduced performance in complex scenes, as the driver has to communicate more frequently between the CPU and GPU.
Try the [url=https://darksylinc.github.io/vsync_simulator/]V-Sync Simulator[/url], an interactive interface that simulates presentation to better understand how it is affected by different variables under various conditions.
[b]Note:[/b] This property is only read when the project starts. There is currently no way to change this value at run-time.
</member>

View File

@ -5360,7 +5360,7 @@ Error RenderingDevice::initialize(RenderingContextDriver *p_context, DisplayServ
uint32_t frame_count = 1;
if (main_surface != 0) {
frame_count = MAX(2U, uint32_t(GLOBAL_GET("rendering/rendering_device/vsync/frame_queue_size")));
frame_count = MAX(1U, uint32_t(GLOBAL_GET("rendering/rendering_device/vsync/frame_queue_size")));
}
frame = 0;