public bool SupportedFeature() { FeatureDataD3D12Options1 Options1 = NativeDevice.CheckFeatureSupport <FeatureDataD3D12Options1>(Vortice.Direct3D12.Feature.Options1); FeatureDataD3D12Options2 Options2 = NativeDevice.CheckFeatureSupport <FeatureDataD3D12Options2>(Vortice.Direct3D12.Feature.Options2); FeatureDataD3D12Options3 Options3 = NativeDevice.CheckFeatureSupport <FeatureDataD3D12Options3>(Vortice.Direct3D12.Feature.Options3); FeatureDataD3D12Options4 Options4 = NativeDevice.CheckFeatureSupport <FeatureDataD3D12Options4>(Vortice.Direct3D12.Feature.Options4); FeatureDataD3D12Options5 Options5 = NativeDevice.CheckFeatureSupport <FeatureDataD3D12Options5>(Vortice.Direct3D12.Feature.Options5); FeatureDataD3D12Options6 Options6 = NativeDevice.CheckFeatureSupport <FeatureDataD3D12Options6>(Vortice.Direct3D12.Feature.Options6); FeatureDataD3D12Options7 Options7 = NativeDevice.CheckFeatureSupport <FeatureDataD3D12Options7>(Vortice.Direct3D12.Feature.Options7); FeatureDataD3D12Options8 Options8 = NativeDevice.CheckFeatureSupport <FeatureDataD3D12Options8>(Vortice.Direct3D12.Feature.D3D12Options8); FeatureDataD3D12Options9 Options9 = NativeDevice.CheckFeatureSupport <FeatureDataD3D12Options9>(Vortice.Direct3D12.Feature.D3D12Options9); FeatureDataD3D12Options10 Options10 = NativeDevice.CheckFeatureSupport <FeatureDataD3D12Options10>(Vortice.Direct3D12.Feature.D3D12Options10); Console.WriteLine($"Int64ShaderOps {Options1.Int64ShaderOps}"); Console.WriteLine($"ProgrammableSamplePositionsTier {Options2.ProgrammableSamplePositionsTier}"); Console.WriteLine($"DepthBoundsTestSupported {Options2.DepthBoundsTestSupported}"); Console.WriteLine($"SamplerFeedbackTier {Options7.SamplerFeedbackTier}"); Console.WriteLine($"MeshShaderTier {Options7.MeshShaderTier}"); Console.WriteLine($"UnalignedBlockTexturesSupported {Options8.UnalignedBlockTexturesSupported}"); Console.WriteLine($"MeshShaderPipelineStatsSupported {Options9.MeshShaderPipelineStatsSupported}"); Console.WriteLine($"ViewInstancingTier {Options3.ViewInstancingTier}"); Console.WriteLine($"VariableShadingRateTier {Options6.VariableShadingRateTier}"); Console.WriteLine($"MSAA64KBAlignedTextureSupported {Options4.MSAA64KBAlignedTextureSupported}"); Console.WriteLine($"Native16BitShaderOpsSupported {Options4.Native16BitShaderOpsSupported}"); Console.WriteLine($"Ray {Options5.RaytracingTier}"); Console.WriteLine($"SRVOnlyTiledResourceTier3 {Options5.SRVOnlyTiledResourceTier3}"); Console.WriteLine($"VariableRateShadingSumCombinerSupported {Options10.VariableRateShadingSumCombinerSupported}"); return(true); }
public ID3D12Device5 CreateDevice(IDXGIFactory4 pDxgiFactory) { // Find the HW adapter IDXGIAdapter1 pAdapter; var adapters = pDxgiFactory.EnumAdapters1(); for (uint i = 0; i < adapters.Length; i++) { pAdapter = adapters[i]; AdapterDescription1 desc = pAdapter.Description1; // Skip SW adapters if (desc.Flags.HasFlag(AdapterFlags.Software)) { continue; } #if DEBUG if (D3D12.D3D12GetDebugInterface <ID3D12Debug>(out var pDx12Debug).Success) { pDx12Debug.EnableDebugLayer(); } #endif var res = D3D12.D3D12CreateDevice(pAdapter, Vortice.Direct3D.FeatureLevel.Level_12_0, out ID3D12Device pDevice); FeatureDataD3D12Options5 features5 = pDevice.CheckFeatureSupport <FeatureDataD3D12Options5>(Vortice.Direct3D12.Feature.Options5); if (features5.RaytracingTier == RaytracingTier.NotSupported) { throw new NotSupportedException("Raytracing is not supported on this device.Make sure your GPU supports DXR(such as Nvidia's Volta or Turing RTX) and you're on the latest drivers.The DXR fallback layer is not supported."); } return(pDevice.QueryInterface <ID3D12Device5>()); } return(null); }
private ID3D12Device5 CreateDevice(IDXGIFactory4 factory4) { var adapters = factory4.EnumAdapters1(); for (int i = 0; i < adapters.Length; i++) { var desc = adapters[i].Description1; if (desc.Flags.HasFlag(AdapterFlags.Software)) { continue; } var res = D3D12CreateDevice(adapters[i], Vortice.DirectX.Direct3D.FeatureLevel.Level_12_1, out var dev); FeatureDataD3D12Options5 opt5 = dev.CheckFeatureSupport <FeatureDataD3D12Options5>(Vortice.Direct3D12.Feature.Options5); if (opt5.RaytracingTier != RaytracingTier.Tier1_0) { throw new NotSupportedException("Raytracing not supported"); } return(dev.QueryInterface <ID3D12Device5>()); } return(null); }