Fix DXGI_CREATE_FACTORY_DEBUG use in Release mode

このコミットが含まれているのは:
Sergio Pedri committed 2021-11-20 12:16:28 +01:00
1 親 00f77b0bda
コミット abbd064bd6
2ファイル変更
+9 -6

検索条件に一致するファイルはありません

+4 -3
ファイルの表示
@@ -2,6 +2,7 @@
using System.Diagnostics;
using System.Threading;
using ComputeSharp.Core.Extensions;
using ComputeSharp.Graphics.Helpers;
using ComputeSharp.Interop;
using ComputeSharp.WinUI.Helpers;
using TerraFX.Interop.DirectX;
@@ -186,9 +187,9 @@ public sealed partial class ComputeShaderPanel
}
// Create the swap chain to display frames
using (ComPtr<IDXGIFactory2> dxgiFactory2 = default)
using (ComPtr<IDXGIFactory6> dxgiFactory6 = default)
{
DirectX.CreateDXGIFactory2(DXGI.DXGI_CREATE_FACTORY_DEBUG, Win32.__uuidof<IDXGIFactory2>(), (void**)dxgiFactory2.GetAddressOf()).Assert();
DeviceHelper.CreateDXGIFactory6(dxgiFactory6.GetAddressOf());
DXGI_SWAP_CHAIN_DESC1 dxgiSwapChainDesc1 = default;
dxgiSwapChainDesc1.AlphaMode = DXGI_ALPHA_MODE.DXGI_ALPHA_MODE_IGNORE;
@@ -205,7 +206,7 @@ public sealed partial class ComputeShaderPanel
using ComPtr<IDXGISwapChain1> dxgiSwapChain1 = default;
dxgiFactory2.Get()->CreateSwapChainForComposition(
dxgiFactory6.Get()->CreateSwapChainForComposition(
(IUnknown*)this.d3D12CommandQueue.Get(),
&dxgiSwapChainDesc1,
null,
+5 -3
ファイルの表示
@@ -1,5 +1,4 @@
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using ComputeSharp.Core.Extensions;
using TerraFX.Interop.DirectX;
@@ -31,11 +30,13 @@ internal static partial class DeviceHelper
/// Creates a new <see cref="IDXGIFactory6"/> instance to be used to enumerate devices.
/// </summary>
/// <param name="dxgiFactory6">The resulting <see cref="IDXGIFactory6"/> instance.</param>
private static unsafe void CreateDXGIFactory6(IDXGIFactory6** dxgiFactory6)
internal static unsafe void CreateDXGIFactory6(IDXGIFactory6** dxgiFactory6)
{
using ComPtr<IDXGIFactory4> dxgiFactory4 = default;
#if DEBUG
EnableDebugMode();
#endif
DirectX.CreateDXGIFactory2(IDXGIFactoryCreationFlags, Windows.__uuidof<IDXGIFactory4>(), dxgiFactory4.GetVoidAddressOf()).Assert();
@@ -58,10 +59,10 @@ internal static partial class DeviceHelper
return;
}
#if DEBUG
/// <summary>
/// Enables the debug layer for DirectX APIs.
/// </summary>
[Conditional("DEBUG")]
private static unsafe void EnableDebugMode()
{
using ComPtr<ID3D12Debug> d3D12Debug = default;
@@ -77,6 +78,7 @@ internal static partial class DeviceHelper
d3D12Debug1.Get()->SetEnableSynchronizedCommandQueueValidation(Windows.TRUE);
}
}
#endif
/// <summary>
/// A custom <see cref="IDXGIFactory6"/> fallback implementation to use on systems with no support for it.