Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I make sure VK_PRESENT_MODE_IMMEDIATE_KHR is used? #2273

Open
dougg0k opened this issue Jan 7, 2025 · 8 comments
Open

How can I make sure VK_PRESENT_MODE_IMMEDIATE_KHR is used? #2273

dougg0k opened this issue Jan 7, 2025 · 8 comments

Comments

@dougg0k
Copy link

dougg0k commented Jan 7, 2025

Hi,

How can I enable VK_PRESENT_MODE_IMMEDIATE_KHR (aka, tearing enabled) and make sure it's being used?

https://registry.khronos.org/vulkan/specs/latest/man/html/VkPresentModeKHR.html

With Nvidia.

Is it related to VKD3D_SWAPCHAIN_LATENCY_FRAMES set to 1?


With 2 frame latency where CPU and GPU are decently subscribed, the present wait event will come in with VBlank-alignment
Does this mean if I set to 1, there would be no vblank? If I understood incorrectly, what would?

It seem to make sense, as it is following similarly to gpu drivers, where priority are not input latency.

 /* 3 frames is the default in the API, so that's what we should report to application if asks. */
        chain->frame_latency = DEFAULT_FRAME_LATENCY;

Nvm, I think I found it.

present_mode = chain->request.swap_interval > 0 ? VK_PRESENT_MODE_FIFO_KHR : VK_PRESENT_MODE_IMMEDIATE_KHR;

So, 0 would be the one to be immediate. As long as 0 does not go back to default 3, like in does in gpu driver setting.

Unless the request->swap_interval = SyncInterval; has nothing to do with VKD3D_SWAPCHAIN_LATENCY_FRAMES.

If not, what does?


I wonder if VKD3D_SWAPCHAIN_IMAGES has anything related to low latency? Maybe it should be tested with 0 or 1.

Maybe it's similar to backbuffer from dxvk doitsujin/dxvk#1636 (comment)

Is it?

@dougg0k dougg0k closed this as completed Jan 7, 2025
@dougg0k dougg0k reopened this Jan 7, 2025
@HansKristian-Work
Copy link
Owner

What is the goal here? You want to force a game that is using vsync to not be vsynced?

@dougg0k
Copy link
Author

dougg0k commented Jan 8, 2025

Lower latency, and sure, that also.

Most of the time, they have the option to disable vsync. But this is the idea of possibly making sure that the sync layer is always in the immediate. And if can reduce even further by other changes, that also.

@HansKristian-Work
Copy link
Owner

I'd expect the dxvk option to force period to 0. Maybe that's not hooked up for the interop DXGI swapchain. Maybe a question for @doitsujin.

@dougg0k
Copy link
Author

dougg0k commented Jan 8, 2025

But isnt vkd3d for dx12, while dxvk for dx11? I want to know for dx12.

Does dxvk still has an effect on dx12?

@HansKristian-Work
Copy link
Owner

Yes. DXVK's DXGI implementation is used for D3D12 too. It forwards calls to vkd3d-proton.

@dougg0k
Copy link
Author

dougg0k commented Jan 8, 2025

I see.

But can you tell what VKD3D_SWAPCHAIN_LATENCY_FRAMES and VKD3D_SWAPCHAIN_IMAGES have in relation to latency in all this?

@HansKristian-Work
Copy link
Owner

VKD3D_SWAPCHAIN_LATENCY_FRAMES is used for latency limiting on Present. It's mostly relevant for FIFO modes, but I suppose it can be useful for IMMEDIATE too, but it would make sure that CPU cannot run too far ahead of GPU. It's basically a DIY NV Reflex in that case.

@dougg0k
Copy link
Author

dougg0k commented Jan 13, 2025

@HansKristian-Work What would be the ideal value for lowest latency with VKD3D_SWAPCHAIN_LATENCY_FRAMES in immediate?

Also, what is VKD3D_SWAPCHAIN_IMAGES and is it related to back buffers? If not, what is it's relation to latency?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants