예제 #1
0
 public D3D12GraphicsContext(int winWidth, int winHeight)
 {
     if (!D3D12.IsSupported(Vortice.Direct3D.FeatureLevel.Level_12_0))
     {
         throw new InvalidOperationException("Direct3D12 is not supported on current OS");
     }
 }
        /// <summary>
        /// Checks if given DirectX12 backend is supported.
        /// </summary>
        /// <returns>True if supported, false otherwise.</returns>
        public static bool IsSupported()
        {
            if (s_isSupported.HasValue)
            {
                return(s_isSupported.Value);
            }

            if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                s_isSupported = false;
                return(false);
            }

            if (CreateDXGIFactory1(out IDXGIFactory1 tempDXGIFactory1).Failure)
            {
                s_isSupported = false;
                return(false);
            }

            var adapters = tempDXGIFactory1.EnumAdapters1();

            for (var i = 0; i < adapters.Length; i++)
            {
                var adapter = adapters[i];
                var desc    = adapter.Description1;

                // Don't select the Basic Render Driver adapter.
                if ((desc.Flags & AdapterFlags.Software) != AdapterFlags.None)
                {
                    continue;
                }

                if (D3D12.IsSupported(adapter, FeatureLevel.Level_11_0))
                {
                    s_isSupported = true;
                    return(true);
                }
            }

            s_isSupported = true;
            return(true);
        }
 public static bool IsSupported()
 {
     return(D3D12.IsSupported(FeatureLevel.Level_11_0));
 }
예제 #4
0
 public static bool IsSupported() => D3D12.IsSupported(FeatureLevel.Level_12_0);
예제 #5
0
 public bool IsSupported() => D3D12.IsSupported(Vortice.Direct3D.FeatureLevel.Level_12_0);