diff --git a/gfx/common/d3d11_common.h b/gfx/common/d3d11_common.h index 22b3a5921d..41aea89345 100644 --- a/gfx/common/d3d11_common.h +++ b/gfx/common/d3d11_common.h @@ -197,6 +197,7 @@ typedef struct float clearcolor[4]; unsigned swap_interval; bool vsync; + bool wait_for_vblank; bool resize_chain; bool keep_aspect; bool resize_viewport; diff --git a/gfx/common/d3d12_common.h b/gfx/common/d3d12_common.h index 3fb7da1d88..c2b2de7e66 100644 --- a/gfx/common/d3d12_common.h +++ b/gfx/common/d3d12_common.h @@ -183,6 +183,7 @@ typedef struct float clearcolor[4]; int frame_index; bool vsync; + bool wait_for_vblank; unsigned swap_interval; #ifdef HAVE_DXGI_HDR enum dxgi_swapchain_bit_depth bit_depth; diff --git a/gfx/drivers/d3d11.c b/gfx/drivers/d3d11.c index 522a94d9f2..516c48f621 100644 --- a/gfx/drivers/d3d11.c +++ b/gfx/drivers/d3d11.c @@ -1070,6 +1070,14 @@ static bool d3d11_init_swapchain(d3d11_video_t* d3d11, UINT max_latency = settings->uints.video_max_frame_latency; UINT cur_latency = 0; + if (max_latency == 0) + { + d3d11->wait_for_vblank = true; + max_latency = 1; + } + else + d3d11->wait_for_vblank = false; + DXGISetMaximumFrameLatency(d3d11->swapChain, max_latency); DXGIGetMaximumFrameLatency(d3d11->swapChain, &cur_latency); RARCH_LOG("[D3D11]: Requesting %u maximum frame latency, using %u.\n", max_latency, cur_latency); @@ -1816,6 +1824,7 @@ static bool d3d11_gfx_frame( d3d11_video_t* d3d11 = (d3d11_video_t*)data; D3D11DeviceContext context = d3d11->context; bool vsync = d3d11->vsync; + bool wait_for_vblank = d3d11->wait_for_vblank; unsigned present_flags = (vsync || !d3d11->has_allow_tearing) ? 0 : DXGI_PRESENT_ALLOW_TEARING; const char *stat_text = video_info->stat_text; unsigned video_width = video_info->width; @@ -2375,7 +2384,7 @@ static bool d3d11_gfx_frame( DXGIPresent(d3d11->swapChain, d3d11->swap_interval, present_flags); - if (vsync) + if (vsync && wait_for_vblank) { IDXGIOutput *pOutput; DXGIGetContainingOutput(d3d11->swapChain, &pOutput); diff --git a/gfx/drivers/d3d12.c b/gfx/drivers/d3d12.c index 7c202dec87..da678818cf 100644 --- a/gfx/drivers/d3d12.c +++ b/gfx/drivers/d3d12.c @@ -1278,6 +1278,14 @@ static bool d3d12_init_swapchain(d3d12_video_t* d3d12, UINT max_latency = settings->uints.video_max_frame_latency; UINT cur_latency = 0; + if (max_latency == 0) + { + d3d12->chain.wait_for_vblank = true; + max_latency = 1; + } + else + d3d12->chain.wait_for_vblank = false; + DXGISetMaximumFrameLatency(d3d12->chain.handle, max_latency); DXGIGetMaximumFrameLatency(d3d12->chain.handle, &cur_latency); RARCH_LOG("[D3D12]: Requesting %u maximum frame latency, using %u.\n", max_latency, cur_latency); @@ -2024,6 +2032,7 @@ static bool d3d12_gfx_frame( d3d12_texture_t* texture = NULL; d3d12_video_t* d3d12 = (d3d12_video_t*)data; bool vsync = d3d12->chain.vsync; + bool wait_for_vblank = d3d12->chain.wait_for_vblank; unsigned sync_interval = (vsync) ? d3d12->chain.swap_interval : 0; unsigned present_flags = (vsync) ? 0 : DXGI_PRESENT_ALLOW_TEARING; const char *stat_text = video_info->stat_text; @@ -2660,7 +2669,7 @@ static bool d3d12_gfx_frame( #endif DXGIPresent(d3d12->chain.handle, sync_interval, present_flags); - if (vsync) + if (vsync && wait_for_vblank) { IDXGIOutput *pOutput; DXGIGetContainingOutput(d3d12->chain.handle, &pOutput); diff --git a/menu/menu_setting.c b/menu/menu_setting.c index d8f34be41e..f9de71c059 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -12545,7 +12545,7 @@ static bool setting_append_list( general_write_handler, general_read_handler); (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; - (*list)[list_info->index - 1].offset_by = 1; + (*list)[list_info->index - 1].offset_by = 0; menu_settings_list_current_add_range(list, list_info, (*list)[list_info->index - 1].offset_by, 3, 1, true, true); SETTINGS_DATA_LIST_CURRENT_ADD_FLAGS(list, list_info, SD_FLAG_CMD_APPLY_AUTO); MENU_SETTINGS_LIST_CURRENT_ADD_CMD(list, list_info, CMD_EVENT_REINIT);