/// <summary> /// Creates a new GridTopology /// </summary> /// <param name="gridTopology">A IGridTopology implamented object</param> public GridTopology(IGridTopology gridTopology) { Rows = gridTopology.Rows; Columns = gridTopology.Columns; Displays = gridTopology.Displays.Select(display => new GridTopologyDisplay(display)).ToArray(); SetDisplaySettings(gridTopology.DisplaySettings); ApplyWithBezelCorrectedResolution = gridTopology.ApplyWithBezelCorrectedResolution; ImmersiveGaming = gridTopology.ImmersiveGaming; BaseMosaicPanoramic = gridTopology.BaseMosaicPanoramic; DriverReloadAllowed = gridTopology.DriverReloadAllowed; AcceleratePrimaryDisplay = gridTopology.AcceleratePrimaryDisplay; }
/// <summary> /// Determines the set of available display modes for a given grid topology. /// </summary> /// <param name="gridTopology">The grid topology to use.</param> /// <returns></returns> /// <exception cref="NVIDIAApiException">Status.InvalidArgument: One or more arguments passed in are invalid.</exception> /// <exception cref="NVIDIAApiException">Status.ApiNotInitialized: The NvAPI API needs to be initialized first.</exception> /// <exception cref="NVIDIAApiException">Status.NoImplementation: This entry point not available.</exception> /// <exception cref="NVIDIAApiException">Status.Error: Miscellaneous error occurred.</exception> /// <exception cref="NVIDIANotSupportedException">This operation is not supported.</exception> /// <exception cref="Exception">A delegate callback throws an exception.</exception> public static IDisplaySettings[] EnumDisplayModes(IGridTopology gridTopology) { var mosaicEnumDisplayModes = DelegateFactory.GetDelegate <Delegates.Mosaic.NvAPI_Mosaic_EnumDisplayModes>(); using (var gridTopologyByRef = ValueTypeReference.FromValueType(gridTopology, gridTopology.GetType())) { var totalAvailable = 0u; var status = mosaicEnumDisplayModes(gridTopologyByRef, ValueTypeArray.Null, ref totalAvailable); if (status != Status.Ok) { throw new NVIDIAApiException(status); } if (totalAvailable == 0) { return(new IDisplaySettings[0]); } foreach (var acceptType in mosaicEnumDisplayModes.Accepts(2)) { var counts = totalAvailable; var instance = acceptType.Instantiate <IDisplaySettings>(); using ( var displaySettingByRef = ValueTypeArray.FromArray(instance.Repeat((int)counts).AsEnumerable())) { status = mosaicEnumDisplayModes(gridTopologyByRef, displaySettingByRef, ref counts); if (status == Status.IncompatibleStructureVersion) { continue; } if (status != Status.Ok) { throw new NVIDIAApiException(status); } return(displaySettingByRef.ToArray <IDisplaySettings>((int)counts, acceptType)); } } throw new NVIDIANotSupportedException("This operation is not supported."); } }