DiligentGraphics / DiligentEngine

A modern cross-platform low-level graphics library and rendering framework
http://diligentgraphics.com/diligent-engine/
Apache License 2.0
3.63k stars 331 forks source link

Multiple swap chains: Cannot "convert" secondary to primary #315

Closed hals1010 closed 1 month ago

hals1010 commented 1 month ago

I'm using multiple child windows with a swap chain for each - the spec states that you have to have exactly one primary swap chain.

Problem is that I can't "convert" one of the secondary swap chains to a primary when the initial window (using the primary swap chain) is closed.

I've tried to delete and re-create one of the secondary swap chains, but this does not seem to work (at least under D3D12, I'll get an "access denied").

So, would it be possible to add a method to ISwapChain that allows me to set (or clear) the IsPrimary flag? Or is there an "offical" way to do this?

Thanks, Jörn

TheMostDiligent commented 1 month ago

the spec states that you have to have exactly one primary swap chain.

It should say that you may have a primary swap change for convenience, but don't have to. It is totally correct to have no primary swap chains, which looks like exactly your use case. What a primary swap chain does is calling pImmediateCtx->FinishFrame(); and pDevice->ReleaseStaleResources();. You should manually do this when your logical frame ends.

hals1010 commented 1 month ago

Thanks a lot!