2

I have been programming on DirectX12 since last year, and I've experienced DX10 and 11. There is something bizarre I found in my application DX12 and i am not able to find why or a solution. I cannot show my original code, but it's ok, because it happens in any simply DX12 sample.

We can use directly the Triangle Sample (provided by DirectX12 officials) for example. I integrate it without modifying anything basic in a MFC SDI application, and until now everything works fine. But after I change the Swap Chain format to DXGI_FORMAT_R16G16B16A16_FLOAT, the application produces flickers when other windows or apps are staying/moving on the top of it but without entirely covering it. You can find here the video I made (sorry for the quality) to show the flickering, and also here the visual c++ 2015 mfc sample.

I tried something like changing erasebackground method, but still can't find a solution... Is this a programming level problem? but in which level, MFC, DirectX12, or DXGI? Or is this a os or hardware level problem??

I have already give the whole project vc++, so i suppose I can jump the step of giving the "Minimal, Complete, and Verifiable example". I dont show the code, because I dont know which part of code may be the cause of the problem, and also I am not sure if it is coding problem. And I would like to mention that the problem arises only when I replace the DXGI_FORMAT_R8G8B8A8_UNORM by DXGI_FORMAT_R16G16B16A16_FLOAT. And by the way, the flickering does not happen with DirectX11 if i do the same "integration to MFC" thing.

PS. There is no error or warning when debugging in VC2015.

PS. the same thing happens when I integrate the sample (by making it dll) into an C# Winforms apps.

dingding
  • 21
  • 2
  • Have you tried enabling the [debug layer](https://msdn.microsoft.com/en-us/library/windows/desktop/jj200584.aspx)? – IInspectable Aug 03 '16 at 22:19
  • Are you creating your windows with the `WS_EX_NOREDIRECTIONBITMAP` extended window style? – IInspectable Aug 03 '16 at 22:47
  • @IInspectable oh yes, of course. It makes no sense to debug the d3d apps without enabling the debug layer. And the Triangle sample I showed here is quite standard ( well I suppose that Microsoft people will not get their tutorial code wrong.) – dingding Aug 03 '16 at 22:59
  • @IInspectable No I didn't use the WS_EX_NOREDIRECTIONBITMAP. In fact I don't know what it is used for. But i don't create any window, I just use the MFC SDI main window (hwnd) to associate with/create the swap chain. – dingding Aug 03 '16 at 23:07
  • That window style essentially ends the overdraw battle, by not allocating a composition surface for the native HWND. When I get home, I'll find you an article, explaining how to set this up. – IInspectable Aug 03 '16 at 23:24
  • [Windows with C++ : High-Performance Window Layering Using the Windows Composition Engine](https://msdn.microsoft.com/magazine/dn745861.aspx). You don't need the Direct2D stuff, but this article should get you going. – IInspectable Aug 04 '16 at 00:58
  • @IInspectable Thanks for the interesting article. But I doubt if it is the solution. Because I don't have the flickers when I use a traditional CreateWindow function (it is how the original Triangle Sample creates the window, and it does not have flickers when using DXGI_FORMAT_R16G16B16A16_FLOAT). So the problem happens only in the mfc SDI/MDI project , I tried to change the window style, and create swap chain in composition method, but it seems not easy to change the extended style WS_EX_NOREDIRECTIONBITMAP in the xxView.cpp in SDI. – dingding Aug 12 '16 at 14:28

0 Answers0