Universal Windows Platform (UWP)
A Microsoft platform for building and publishing apps for Windows desktop devices.
2,968 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I'm using TerraFX DirectX wrapper in a Desktop.WinUI project / .Net 5.
I've enabled the debug layer with the following code.
cs
ID3D11Device* CreateD3DDevice(out ID3D11DeviceContext* pImmediateContext)
{
ID3D11Device* d3dDevice;
ID3D11DeviceContext* immediateContext;
D3D11_CREATE_DEVICE_FLAG flags = 0;
// direct2d compat
flags |= D3D11_CREATE_DEVICE_FLAG.D3D11_CREATE_DEVICE_BGRA_SUPPORT;
#if (DEBUG)
// debug layer
flags |= D3D11_CREATE_DEVICE_FLAG.D3D11_CREATE_DEVICE_DEBUG;
#endif
var featureLevel = D3D_FEATURE_LEVEL_11_1;
ThrowIfFailed(nameof(D3D11CreateDevice), D3D11CreateDevice(
(IDXGIAdapter*)DxgiAdapter,
D3D_DRIVER_TYPE_HARDWARE,
Software: IntPtr.Zero,
Flags: (uint)flags,
&featureLevel,
FeatureLevels: 1,
D3D11_SDK_VERSION,
&d3dDevice,
pFeatureLevel: null,
&immediateContext));
pImmediateContext = immediateContext;
return d3dDevice;
}
This works for one project - samples that are available for TerraFX, but it doesn't work in my own project built from the Desktop.WinUI project template in VS.
PS. No DirectX Tags available for these forums? You need to look through your tags, they need some work.
I needed to also set
cs
uint dxgiFactoryFlags = (uint)DXGI_CREATE_FACTORY_DEBUG;