Skip to content

Commit 5cd7260

Browse files
vkd3d: Remove multi-blits for present interval.
It's dumb and breaks horribly in some games that use it for esoteric frame pacing reasons. We should use timer instead as a fallback in lieu of proper display timing support. We'll get a similar effect using DXVK's SetTargetFrameRate. That is updated accordingly with present interval. Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
1 parent e93a49b commit 5cd7260

File tree

1 file changed

+4
-20
lines changed

1 file changed

+4
-20
lines changed

libs/vkd3d/swapchain.c

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2490,8 +2490,6 @@ static void dxgi_vk_swap_chain_present_callback(void *chain_)
24902490
const struct dxgi_vk_swap_chain_present_request *next_request;
24912491
struct dxgi_vk_swap_chain *chain = chain_;
24922492
uint64_t next_present_count;
2493-
uint32_t present_count;
2494-
uint32_t i;
24952493

24962494
next_present_count = chain->present.present_count + 1;
24972495
next_request = &chain->request_ring[next_present_count % ARRAY_SIZE(chain->request_ring)];
@@ -2508,26 +2506,12 @@ static void dxgi_vk_swap_chain_present_callback(void *chain_)
25082506
/* If no QueuePresentKHRs successfully commits a present ID, we'll fallback to a normal queue signal. */
25092507
chain->present.present_id_valid = false;
25102508

2511-
/* There is currently no present timing in Vulkan we can rely on, so just duplicate blit them as needed.
2512-
* This happens on a thread, so the blocking should not be a significant problem.
2513-
* TODO: Propose VK_EXT_present_interval. */
2514-
present_count = max(1u, chain->request.swap_interval);
2515-
2516-
/* If we hit the legacy way of synchronizing with swapchain, blitting multiple times would be horrible.
2517-
* Also if low latency mode is enabled only do a single present iteration to avoid falling off the application
2518-
* provided frame id path. */
2519-
if (!chain->wait_thread.supports_present_wait || chain->present.low_latency_state.mode)
2520-
present_count = 1;
2521-
2522-
for (i = 0; i < present_count; i++)
2523-
{
2524-
/* A present iteration may or may not render to backbuffer. We'll apply best effort here.
2525-
* Forward progress must be ensured, so if we cannot get anything on-screen in a reasonable amount of retries, ignore it. */
2526-
dxgi_vk_swap_chain_present_iteration(chain, next_present_count, 0);
2527-
}
2509+
/* A present iteration may or may not render to backbuffer. We'll apply best effort here.
2510+
* Forward progress must be ensured, so if we cannot get anything on-screen in a reasonable amount of retries, ignore it. */
2511+
dxgi_vk_swap_chain_present_iteration(chain, next_present_count, 0);
25282512

25292513
/* When this is signalled, lets main thread know that it's safe to free user buffers.
2530-
* Signal this just once on the outside since we might have retries, swap_interval > 1, etc, which complicates command buffer recycling. */
2514+
* Signal this just once on the outside since we might have retries, which complicates command buffer recycling. */
25312515
dxgi_vk_swap_chain_present_signal_blit_semaphore(chain, next_present_count);
25322516

25332517
/* Signal latency fence. */

0 commit comments

Comments
 (0)