View Full Version : Win10, OpenGL, and Full-Screen Exclusive Replacement

Dark Photon
10-13-2017, 10:09 PM
Before I spend any more time digging, I thought I'd just ask.

From what I can gather, "Full-Screen Exclusive Mode" is no more in D3D12 and Win10. It's been replaced with:

Windowed Flip (iFlip Immediate)
aka Independent Flip with True Immediate Present
aka Independent Flip Swap Chains with True Immediate Presentation (via Waitable Object Swap Chains)

I've got several questions:

Is this your understanding?
Can OpenGL apps make use of iFlip Immediate mode? How? (MS's info says D3D12 only)
If not, what's the best alternative to synchronize with GPU scan-out, bypass as much DWM overhead as possible, and minimize display latency?

If you can answer any of these, or even provide some related info about them (even speculative), I'd appreciate it!

(If you're scratching your head at this post or are interested in more background, here's a pretty good video: DirectX 12: Presentation Modes In Windows 10 (https://www.youtube.com/watch?v=E3wTajGZOsA&list=PLeHvwXyqearWT_NT7CiGm_kEiKabWNPKw&index=7).)

03-08-2018, 09:18 PM
Just curious if you made any progress?

Dark Photon
03-09-2018, 06:48 AM
The priority on this issue hasn't been very high, so no I haven't done much with this.

One correction: I think "iFlip" (Independent Flip) is more the analog to Full-Screen Exclusive (FSE) with SwapInterval(1) (VSync), whereas "iFlip Immediate" is more like FSE with SwapInterval(0) (i.e. no VSync). That's what I gather from what I've seen since anyway.

Also, I've recent found out that NVidia has a graphics API interop sample that shows how to render with one API and present with another API. Supported APIs are GL, DX11, DX12, and Vulkan, with all permutations of render API -> present API supported (except DX11 <-> DX12; no point I guess). So with this it looks like you can render with GL and present with DX12. That said, I haven't actually spent anytime profiling this, so I'm not sure what kind of overhead we're talking about from doing this.

The DX12 present client shows presenting with DXGI_SWAP_EFFECT_FLIP_DISCARD, but if I understand correctly using either this or FLIP_SEQUENTIAL should support iFlip when all the conditions are fullfilled. Also, I see no references to DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING and DXGI_PRESENT_ALLOW_TEARING, so it appears it'll only support iFlip (VSync) and not iFlip Immediate (no VSync), but that's probably an easy add when needed.

Related to the link I posted above with Jesse Natalie (Microsoft) talking about these presentation modes, this thread (https://www.gamedev.net/forums/topic/681243-directx-12-multi-threading-low-latency-presentation/) is a worthwhile read (SoldierOfLight is Jesse).

If there truly isn't a much simpler way for an OpenGL application to get Full-Screen Exclusive equivalent capability in Win10 (cutting DWM/compositing overhead/latency completely out-of-the-loop), then I really hope NVidia or one of the vendors will write a nice, clean WGL extension to abstract all this DXGI/D3D12 complexity and let OpenGL apps create a truly maximum performance hardware accelerated window (with associated swap chain) that'll yield iFlip/iFlip immediate support on Win10+. Failing that, perhaps GLFW/etc. will provide a nice GL wrapper for doing this.

06-13-2018, 08:16 AM
Hi Dark Photon, could you share the link to the NVidia interop sample, please?

Dark Photon
06-14-2018, 06:54 AM
I haven't seen it available online (doesn't mean it's not there though). I'd suggest posting a request for it on https://devtalk.nvidia.com/. Just ask for a pointer to some Interop code that shows how to interoperate between DX11, DX12, OpenGL, and Vulkan.