hajimehoshi / ebiten

Ebitengine - A dead simple 2D game engine for Go
https://ebitengine.org
Apache License 2.0
10.39k stars 633 forks source link

internal/graphicsdriver/directx: implement a 'mailbox' way when vsync is off #2824

Open hajimehoshi opened 8 months ago

hajimehoshi commented 8 months ago

Operating System

What feature would you like to be added?

Now DirectX allows tearing when vsync is off.

The mailbox way is one of a presentation way using triple buffers. This reduces input latency without tearings.

With DirectX, apparently interval = 0 + flag = 0 for DXGI swapchain seems fine. The challenging part is how to fix the current implementation, especially for DirectX 12.

Why is this needed?

In order to enable low-latency rendering without tearing

hajimehoshi commented 8 months ago

https://github.com/hajimehoshi/ebiten/blob/1db0abc4ee5bda7e9d03d7f4c8b37421b667d128/internal/graphicsdriver/directx/graphics12_windows.go#L754-L763

I thought CurrentBackBufferIndex worked, but apparently Xbox requires another care... 🤔