Beispiel #1
0
        /// <summary>
        ///   Initializes all adapters with the specified factory.
        /// </summary>
        internal static void InitializeInternal()
        {
            staticCollector.Dispose();

#if DIRECTX11_1
            using (var factory = new Factory1())
                NativeFactory = factory.QueryInterface <Factory2>();
#else
            NativeFactory = new Factory1();
#endif

            staticCollector.Add(NativeFactory);

            int countAdapters = NativeFactory.GetAdapterCount1();
            var adapterList   = new List <GraphicsAdapter>();
            for (int i = 0; i < countAdapters; i++)
            {
                var adapter = new GraphicsAdapter(NativeFactory, i);
                staticCollector.Add(adapter);
                adapterList.Add(adapter);
            }

            defaultAdapter = adapterList.Count > 0 ? adapterList[0] : null;
            adapters       = adapterList.ToArray();
        }
        /// <summary>
        /// Initializes all adapters with the specified factory.
        /// </summary>
        internal static void InitializeInternal()
        {
            staticCollector.Dispose();

#if DIRECTX11_1
            using (var factory = new Factory1())
                NativeFactory = factory.QueryInterface <Factory2>();
#elif SILICONSTUDIO_PLATFORM_UWP
            // Maybe this will become default code for everybody if we switch to DX 11.1/11.2 SharpDX dll?
            NativeFactory = new Factory2();
#else
            NativeFactory = new Factory1();
#endif

            staticCollector.Add(NativeFactory);

            int countAdapters = NativeFactory.GetAdapterCount1();
            var adapterList   = new List <GraphicsAdapter>();
            for (int i = 0; i < countAdapters; i++)
            {
                var adapter = new GraphicsAdapter(NativeFactory, i);
                staticCollector.Add(adapter);
                adapterList.Add(adapter);
            }

            defaultAdapter = adapterList.Count > 0 ? adapterList[0] : null;
            adapters       = adapterList.ToArray();
        }
        /// <summary>
        /// Initializes static members of the <see cref="GraphicsAdapter" /> class.
        /// </summary>
        static GraphicsAdapter()
        {
#if DIRECTX11_1
            using (var factory = new Factory1())
                Initialize(factory.QueryInterface <Factory2>());
#else
            Initialize();
#endif
        }
        /// <summary>
        /// Initializes static members of the <see cref="GraphicsAdapter" /> class.
        /// </summary>
        static GraphicsAdapter()
        {
#if DIRECTX11_1
            using (var factory = new Factory1())
                Initialize(factory.QueryInterface<Factory2>());
#else
            Initialize();
#endif
        }
Beispiel #5
0
        /// <summary>
        /// Initializes the GraphicsAdapter. On Desktop and WinRT, this is done statically.
        /// </summary>
        public static void Initialize()
        {
            if (Adapters == null)
            {
#if DIRECTX11_1
                using (var factory = new Factory1()) Initialize(factory.QueryInterface <Factory2>());
#else
                Initialize(new Factory1());
#endif
            }
        }
Beispiel #6
0
        /// <summary>
        /// Initializes the GraphicsAdapter. On Desktop and WinRT, this is done statically.
        /// </summary>
        public static void Initialize()
        {
            lock (staticLock)
            {
                if (!isInitialized)
                {
#if DIRECTX11_1
                    using (var factory = new Factory1()) Initialize(factory.QueryInterface <Factory2>());
#else
                    Initialize(new Factory1());
#endif
                    isInitialized = true;
                }
            }
        }
Beispiel #7
0
 /// <summary>
 /// Gets desktop mode description
 /// </summary>
 /// <returns>Returns current desktop mode description</returns>
 private static OutputDescription1 GetDesktopMode()
 {
     using (var factory = new Factory1())
         using (var factory5 = factory.QueryInterface <Factory5>())
         {
             using (var adapter = factory5.GetAdapter1(0))
                 using (var adapter4 = adapter.QueryInterface <Adapter4>())
                 {
                     using (var adapterOutput = adapter4.GetOutput(0))
                         using (var adapterOutput6 = adapterOutput.QueryInterface <Output6>())
                         {
                             return(adapterOutput6.Description1);
                         }
                 }
         }
 }