當前位置: 首頁>>代碼示例>>C#>>正文


C# Factory.GetAdapterCount方法代碼示例

本文整理匯總了C#中System.Factory.GetAdapterCount方法的典型用法代碼示例。如果您正苦於以下問題:C# Factory.GetAdapterCount方法的具體用法?C# Factory.GetAdapterCount怎麽用?C# Factory.GetAdapterCount使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Factory的用法示例。


在下文中一共展示了Factory.GetAdapterCount方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Initialize

        public static void Initialize( out Factory dxgiFactory, out SlimDX.Direct3D11.Device d3d11Device )
        {
            dxgiFactory = new Factory();

            Adapter adapter = null;
            long videoMemory = 0;

            for ( var i = 0; i < dxgiFactory.GetAdapterCount(); i++ )
            {
                var tmpAdapter = dxgiFactory.GetAdapter( i );

                if ( tmpAdapter.Description.DedicatedVideoMemory > videoMemory )
                {
                    adapter = tmpAdapter;
                    videoMemory = tmpAdapter.Description.DedicatedVideoMemory;
                }
            }

            d3d11Device = null;

            try
            {
                d3d11Device = Constants.DEBUG_D3D11_DEVICE
                                  ? new SlimDX.Direct3D11.Device( adapter,
                                                                  DeviceCreationFlags.Debug,
                                                                  new[] { FeatureLevel.Level_11_0, FeatureLevel.Level_10_1, FeatureLevel.Level_10_0 } )
                                  : new SlimDX.Direct3D11.Device( adapter,
                                                                  DeviceCreationFlags.None,
                                                                  new[] { FeatureLevel.Level_11_0, FeatureLevel.Level_10_1, FeatureLevel.Level_10_0 } );
            }
            catch ( Exception e )
            {
                Console.WriteLine( "\nError: Couldn't create Direct3D 11 device (exception: " + e.Source + ", " + e.Message + ").\n" );
            }
        }
開發者ID:Rhoana,項目名稱:Mojo,代碼行數:35,代碼來源:D3D11.cs

示例2: PrintAdapters

        private static void PrintAdapters(Factory factory) {
            var adapterCount = factory.GetAdapterCount();

            for (var adapterIndex = 0; adapterIndex < adapterCount; ++adapterIndex) {
                using (var adapter = factory.GetAdapter(adapterIndex)) {

                    Console.WriteLine("Adapter Index: {0}", adapterIndex);

                    foreach (var descProperty in adapter.Description.GetType().GetProperties()) {
                        Console.WriteLine("    {0}: {1}", ParseName(descProperty.Name), descProperty.GetValue(adapter.Description, null));
                    }

                    PrintAdapterOutputs(adapter);
                    PrintDeviceInformation(adapter);
                }
            }
        }
開發者ID:zhandb,項目名稱:slimdx,代碼行數:17,代碼來源:Program.cs


注:本文中的System.Factory.GetAdapterCount方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。