コード例 #1
0
ファイル: D3D11.cs プロジェクト: Rhoana/Mojo
        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" );
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: zhandb/slimdx
        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);
                }
            }
        }