0

https://1drv.ms/u/s!AkVRV9eGJ20rgTu13uTcNkhp0eZb?e=lwMe70

That links takes you to my OneDrive where you can download my Visual Studio 2022 solution and project (it is a .7z file of 17.7KB), it only has code to display a win32 window and little more. I also included an image that tells you my DirectX specs that the DirectX Diagnostic Tool reports. The image is the following image:

My DirectX specs

The problem is what the title says, I would like you to see if you can compile it without problems, I am afraid that it may be failing because I can't use Direct3D 11.1 (is Direct3D 11.1 a requirement? I can't find information about it), but then I tried creating the D3D device with the D3D11_CREATE_DEVICE_PREVENT_ALTERING_LAYER_SETTINGS_FROM_REGISTRY creation flag (https://learn.microsoft.com/en-us/windows/win32/api/d3d11/ne-d3d11-d3d11_create_device_flag) just to test if I can use Direct3D 11.1 (because that flag is not supported until Direct3D 11.1) and the creation succeeded... so I don't know anymore...

Simon Mourier
  • 132,049
  • 21
  • 248
  • 298
Zeleska
  • 107
  • 10
  • @PaulSanders Of course it returns non-zero, it returns 0x887A0001 (DXGI_ERROR_INVALID_CALL). You clearly haven't even seen the code. And why do you assume that I haven't put effort in trying to understand what is happening? – Zeleska May 11 '22 at 00:46
  • 4
    When you program with DirectX make sure you enable the "debug layer" in dev. See https://learn.microsoft.com/en-us/windows/win32/direct3d11/using-the-debug-layer-to-test-apps and https://walbourn.github.io/direct3d-sdk-debug-layer-tricks/. This will show you why it fails: *"Alpha blended swapchains must be created with CreateSwapChainForComposition, or CreateSwapChainForCoreWindow with the DXGI_SWAP_CHAIN_FLAG_FOREGROUND_LAYER flag."* – Simon Mourier May 11 '22 at 05:42
  • 1
    @zeleska You're right, I apologize, comment deleted. – Paul Sanders May 11 '22 at 08:15
  • @SimonMourier Thank you! And you know, I did read "Using the debug layer to debug apps" before posting this question, and I did activate it with the flag, but I thought that "debug output" meant "throwing exceptions", so I was lost when the debugger was not throwing anything, until a little ago that I came to know what it really is, oh my god..., Again, thank you, if you post your comment as an answer I'll accept it. – Zeleska May 11 '22 at 16:53
  • May be you can get the return result and get the error information by FormatMessageW() – NeNeNe1 Jul 25 '22 at 10:00

1 Answers1

4

When you program with DirectX make sure you always enable the "debug layer" in dev and check the output in Visual Studio's "Output" window (or other debugger output).

Check these links: Using the debug layer to debug apps and Direct3D SDK Debug Layer Tricks for more on this as the way it can be installed has changed over DirectX version and years...

This will show you why it fails:

Alpha blended swapchains must be created with CreateSwapChainForComposition, or CreateSwapChainForCoreWindow with the DXGI_SWAP_CHAIN_FLAG_FOREGROUND_LAYER flag.

Simon Mourier
  • 132,049
  • 21
  • 248
  • 298