Skipped devices without SM6 support
このコミットが含まれているのは:
1 親
c80a558162
コミット
a4c0090855
3ファイル変更
+79
-16
検索条件に一致するファイルはありません
@@ -582,5 +582,22 @@ namespace ComputeSharp.Graphics.Extensions
|
||||
|
||||
return (d3D12FeatureDataFormatSupport.Support1 & d3D12FormatSupport1) == d3D12FormatSupport1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks whether or not a given shader model is supported.
|
||||
/// </summary>
|
||||
/// <param name="d3D12Device">The target <see cref="ID3D12Device"/> to use to check features for.</param>
|
||||
/// <param name="d3DShaderModel">The <see cref="D3D_SHADER_MODEL"/> value to check support for.</param>
|
||||
/// <returns>Whether or not the input device supports the requested shader model.</returns>
|
||||
[Pure]
|
||||
public static unsafe bool IsShaderModelSupported(this ref ID3D12Device d3D12Device, D3D_SHADER_MODEL d3DShaderModel)
|
||||
{
|
||||
D3D12_FEATURE_DATA_SHADER_MODEL d3D12ShaderModel = default;
|
||||
d3D12ShaderModel.HighestShaderModel = d3DShaderModel;
|
||||
|
||||
d3D12Device.CheckFeatureSupport(D3D12_FEATURE_SHADER_MODEL, &d3D12ShaderModel, (uint)sizeof(D3D12_FEATURE_DATA_SHADER_MODEL)).Assert();
|
||||
|
||||
return d3D12ShaderModel.HighestShaderModel == d3DShaderModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,13 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using ComputeSharp.Core.Extensions;
|
||||
using ComputeSharp.Graphics.Extensions;
|
||||
using ComputeSharp.Interop;
|
||||
using TerraFX.Interop;
|
||||
using FX = TerraFX.Interop.Windows;
|
||||
using HRESULT = System.Int32;
|
||||
using static TerraFX.Interop.D3D_FEATURE_LEVEL;
|
||||
using static TerraFX.Interop.D3D_SHADER_MODEL;
|
||||
|
||||
namespace ComputeSharp.Graphics.Helpers
|
||||
{
|
||||
@@ -126,7 +129,7 @@ namespace ComputeSharp.Graphics.Helpers
|
||||
|
||||
HRESULT createDeviceResult = FX.D3D12CreateDevice(
|
||||
dxgiAdapter1.AsIUnknown().Get(),
|
||||
D3D_FEATURE_LEVEL.D3D_FEATURE_LEVEL_11_0,
|
||||
D3D_FEATURE_LEVEL_11_0,
|
||||
FX.__uuidof<ID3D12Device>(),
|
||||
null);
|
||||
|
||||
@@ -137,7 +140,7 @@ namespace ComputeSharp.Graphics.Helpers
|
||||
|
||||
FX.D3D12CreateDevice(
|
||||
dxgiAdapter1.AsIUnknown().Get(),
|
||||
D3D_FEATURE_LEVEL.D3D_FEATURE_LEVEL_11_0,
|
||||
D3D_FEATURE_LEVEL_11_0,
|
||||
FX.__uuidof<ID3D12Device>(),
|
||||
d3D12Device.GetVoidAddressOf()).Assert();
|
||||
|
||||
@@ -167,7 +170,7 @@ namespace ComputeSharp.Graphics.Helpers
|
||||
|
||||
HRESULT createDeviceResult = FX.D3D12CreateDevice(
|
||||
dxgiAdapter1.AsIUnknown().Get(),
|
||||
D3D_FEATURE_LEVEL.D3D_FEATURE_LEVEL_11_0,
|
||||
D3D_FEATURE_LEVEL_11_0,
|
||||
FX.__uuidof<ID3D12Device>(),
|
||||
null);
|
||||
|
||||
@@ -178,13 +181,16 @@ namespace ComputeSharp.Graphics.Helpers
|
||||
|
||||
FX.D3D12CreateDevice(
|
||||
dxgiAdapter1.AsIUnknown().Get(),
|
||||
D3D_FEATURE_LEVEL.D3D_FEATURE_LEVEL_11_0,
|
||||
D3D_FEATURE_LEVEL_11_0,
|
||||
FX.__uuidof<ID3D12Device>(),
|
||||
d3D12Device.GetVoidAddressOf()).Assert();
|
||||
|
||||
this.graphicsDevice = GetOrCreateDevice(d3D12Device.Get(), (IDXGIAdapter*)dxgiAdapter1.Get(), &dxgiDescription1);
|
||||
if (d3D12Device.Get()->IsShaderModelSupported(D3D_SHADER_MODEL_6_0))
|
||||
{
|
||||
this.graphicsDevice = GetOrCreateDevice(d3D12Device.Get(), (IDXGIAdapter*)dxgiAdapter1.Get(), &dxgiDescription1);
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,10 +2,13 @@
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.Contracts;
|
||||
using ComputeSharp.Core.Extensions;
|
||||
using ComputeSharp.Graphics.Extensions;
|
||||
using Microsoft.Toolkit.Diagnostics;
|
||||
using TerraFX.Interop;
|
||||
using FX = TerraFX.Interop.Windows;
|
||||
using HRESULT = System.Int32;
|
||||
using static TerraFX.Interop.D3D_FEATURE_LEVEL;
|
||||
using static TerraFX.Interop.D3D_SHADER_MODEL;
|
||||
|
||||
namespace ComputeSharp.Graphics.Helpers
|
||||
{
|
||||
@@ -98,17 +101,54 @@ namespace ComputeSharp.Graphics.Helpers
|
||||
continue;
|
||||
}
|
||||
|
||||
HRESULT createDeviceResult = FX.D3D12CreateDevice(
|
||||
dxgiAdapter1.AsIUnknown().Get(),
|
||||
D3D_FEATURE_LEVEL.D3D_FEATURE_LEVEL_11_0,
|
||||
FX.__uuidof<ID3D12Device>(),
|
||||
(void**)d3D12Device);
|
||||
|
||||
if (FX.SUCCEEDED(createDeviceResult))
|
||||
// Explicit paths for when a device is being retrieved or not, with special handling
|
||||
// for the additional check that is required for the SM6 level. This can't be checked
|
||||
// without creating a device first, so the path for when the target device pointer is
|
||||
// null is useful to do an initial filtering using D3D12CreateDevice to avoid creating
|
||||
// a device for adapters that would've failed at the FL11 check already.
|
||||
if (d3D12Device == null)
|
||||
{
|
||||
dxgiAdapter1.CopyTo(dxgiAdapter);
|
||||
HRESULT createDeviceResult = FX.D3D12CreateDevice(
|
||||
dxgiAdapter1.AsIUnknown().Get(),
|
||||
D3D_FEATURE_LEVEL_11_0,
|
||||
FX.__uuidof<ID3D12Device>(),
|
||||
null);
|
||||
|
||||
return true;
|
||||
if (FX.SUCCEEDED(createDeviceResult))
|
||||
{
|
||||
using ComPtr<ID3D12Device> d3D12DeviceCandidate = default;
|
||||
|
||||
createDeviceResult = FX.D3D12CreateDevice(
|
||||
dxgiAdapter1.AsIUnknown().Get(),
|
||||
D3D_FEATURE_LEVEL_11_0,
|
||||
FX.__uuidof<ID3D12Device>(),
|
||||
d3D12DeviceCandidate.GetVoidAddressOf());
|
||||
|
||||
if (FX.SUCCEEDED(createDeviceResult) &&
|
||||
d3D12DeviceCandidate.Get()->IsShaderModelSupported(D3D_SHADER_MODEL_6_0))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
using ComPtr<ID3D12Device> d3D12DeviceCandidate = default;
|
||||
|
||||
HRESULT createDeviceResult = FX.D3D12CreateDevice(
|
||||
dxgiAdapter1.AsIUnknown().Get(),
|
||||
D3D_FEATURE_LEVEL_11_0,
|
||||
FX.__uuidof<ID3D12Device>(),
|
||||
d3D12DeviceCandidate.GetVoidAddressOf());
|
||||
|
||||
if (FX.SUCCEEDED(createDeviceResult) &&
|
||||
d3D12DeviceCandidate.Get()->IsShaderModelSupported(D3D_SHADER_MODEL_6_0))
|
||||
{
|
||||
d3D12DeviceCandidate.CopyTo(d3D12Device);
|
||||
dxgiAdapter1.CopyTo(dxgiAdapter);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -136,7 +176,7 @@ namespace ComputeSharp.Graphics.Helpers
|
||||
|
||||
HRESULT createDeviceResult = FX.D3D12CreateDevice(
|
||||
dxgiAdapter1.AsIUnknown().Get(),
|
||||
D3D_FEATURE_LEVEL.D3D_FEATURE_LEVEL_11_0,
|
||||
D3D_FEATURE_LEVEL_11_0,
|
||||
FX.__uuidof<ID3D12Device>(),
|
||||
(void**)d3D12Device);
|
||||
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする