/// <summary> /// Initializes a new instance of <see cref="GraphicsOutput" />. /// </summary> /// <param name="adapter">The adapter.</param> /// <param name="outputIndex">Index of the output.</param> /// <exception cref="System.ArgumentNullException">output</exception> /// <exception cref="ArgumentOutOfRangeException">output</exception> internal GraphicsOutput(GraphicsAdapter adapter, DisplayProperties displayProperties, int outputIndex) { if (adapter == null) throw new ArgumentNullException("adapter"); this.outputIndex = outputIndex; this.displayProperties = displayProperties; desktopBounds = new Rectangle(0, 0, (int)displayProperties.PhysicalResolution.Width, (int)displayProperties.PhysicalResolution.Height); }
/// <summary> /// Dispose all statically cached value by this instance. /// </summary> public static void Dispose() { lock (StaticLock) { staticCollector.Dispose(); adapters = null; defaultAdapter = null; isInitialized = false; } }
/// <summary> /// Initializes a new instance of <see cref="GraphicsOutput" />. /// </summary> /// <param name="adapter">The adapter.</param> /// <param name="outputIndex">Index of the output.</param> /// <exception cref="System.ArgumentNullException">output</exception> /// <exception cref="ArgumentOutOfRangeException">output</exception> internal GraphicsOutput(GraphicsAdapter adapter, int outputIndex) { if (adapter == null) throw new ArgumentNullException("adapter"); this.outputIndex = outputIndex; this.adapter = adapter; this.output = adapter.NativeAdapter.GetOutput(outputIndex).DisposeBy(this); outputDescription = output.Description; unsafe { var rectangle = outputDescription.DesktopBounds; desktopBounds = *(Rectangle*)&rectangle; } }
/// <summary> /// Initializes all adapters with the specified factory. /// </summary> internal static void InitializeInternal() { // Create the default instance to enumerate physical devices defaultInstance = new GraphicsAdapterFactoryInstance(false); var nativePhysicalDevices = defaultInstance.NativeInstance.PhysicalDevices; var adapterList = new List<GraphicsAdapter>(); for (int i = 0; i < nativePhysicalDevices.Length; i++) { var adapter = new GraphicsAdapter(nativePhysicalDevices[i], i); staticCollector.Add(adapter); adapterList.Add(adapter); } defaultAdapter = adapterList.Count > 0 ? adapterList[0] : null; adapters = adapterList.ToArray(); staticCollector.Add(new AnonymousDisposable(Cleanup)); }
/// <summary> /// Default constructor to initialize fields that are not explicitly set to avoid warnings at compile time. /// </summary> internal GraphicsOutput() { adapter = null; supportedDisplayModes = null; desktopBounds = Rectangle.Empty; }
/// <summary> /// Initializes this instance. /// </summary> /// <param name="adapter">The graphics adapter.</param> /// <param name="profile">The graphics profile.</param> protected void Initialize(GraphicsAdapter adapter, GraphicsProfile profile, PresentationParameters presentationParameters, object windowHandle) { throw new NotImplementedException(); }
/// <summary> /// Initializes a new instance of the <see cref="GraphicsDevice" /> class. /// </summary> /// <param name="adapter">The adapter.</param> /// <param name="creationFlags">The creation flags.</param> /// <param name="windowHandle">The window handle.</param> /// <param name="graphicsProfiles">The graphics profiles.</param> /// <returns>An instance of <see cref="GraphicsDevice" /></returns> public static GraphicsDevice New(GraphicsAdapter adapter, DeviceCreationFlags creationFlags = DeviceCreationFlags.None, WindowHandle windowHandle = null, params GraphicsProfile[] graphicsProfiles) { return(new GraphicsDevice(adapter ?? GraphicsAdapterFactory.Default, graphicsProfiles, creationFlags, windowHandle)); }