Sign in to follow this  

D3D10 Alt-Tab

This topic is 1449 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Having some trouble with alt-tabing. When I'm fullscreen and alt-tab, I leave my game, and it dissapears completely. Can't "cycle" to it anymore, and clicking on its icon on the taskbar does nothing. Do I need to process a specific windows message, or is there some device state i could poll?

 

Turning off DXGI with IDXGIFactory::MakeWindowAssociation makes no difference. BTW, I am using sharpDX.

 

p.s. The Sharpdx d3d10 samples also behave similarly, i.e. the game becomes inaccesible when alt tabbing in fullscreen.

Edited by gfxCahd

Share this post


Link to post
Share on other sites

I'll apologize in advance since this may not even apply to the problem you have.

In earlier versions of DirectX you always had to recreate the device after alt-tabbing, since the device would become "lost." That meant releasing every DX resource and calling reset on the device - which would only work if you hadn't leaked any memory.

I'm not sure if that behavior was kept in DX10.

Share this post


Link to post
Share on other sites

Yeah, that behaviour applies in Directx9, where alt-tabing results in losing the device. In Directx10 - 11 the device no longer is lost, so I am thinking its got something to do with DXGI not playing nice with winforms.

Share this post


Link to post
Share on other sites

Check your MakeWindowAssociation call - it may not be correct.  The documentation hints at the correct way, but doesn't state it outright, so it's an easy mistake to make.

 

Basically, if you're creating a new IDXGIFactory and then calling MakeWindowAssociation on it, it would be expected to have no effect.  Instead what you need to do is call GetParent on your swapchain to retrieve the IDXGIFactory that was used to create the swapchain, then make your MakeWindowAssociation call using that factory object (remembering to Release it when done as it will have it's reference count incremented).

Share this post


Link to post
Share on other sites

Yeah, I did it the proper way. Here is the code I use (it's SharpDX/C#, but almost identical to Directx10/c++):

      Factory dxgiFactory = new Factory();
      Adapter dxgiAdapter = dxgiFactory.Adapters[0];
      graphicsDevice = new Device(dxgiAdapter, DeviceCreationFlags.Debug);

      displayMode = new ModeDescription(0, 0, new Rational(60, 1), Format.R8G8B8A8_UNorm);
      var swapDesc = new SwapChainDescription()
      {
        ModeDescription = displayMode,
        SampleDescription = new SampleDescription(1, 0),
        Usage = Usage.RenderTargetOutput,
        BufferCount = 1,
        OutputHandle = myForm.Handle,
        IsWindowed = true,
        SwapEffect = SwapEffect.Discard,
        Flags = SwapChainFlags.AllowModeSwitch
      };
      swapChain = new SwapChain(dxgiFactory, graphicsDevice, swapDesc);
   
      dxgiFactory.MakeWindowAssociation(myForm.Handle, WindowAssociationFlags.IgnoreAll);
Edited by gfxCahd

Share this post


Link to post
Share on other sites

This topic is 1449 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this