private void CheckMultiSampleType(int adapter, MultiSampleType multiSampleType, DeviceType devType, Format format) { if (Manager.CheckDeviceMultiSampleType(adapter, devType, format, true, multiSampleType)) { availableTypes.Add(multiSampleType); } }
private RenderTarget2D CreateRenderTarget(GraphicsDevice device, int numberLevels, SurfaceFormat surface) { MultiSampleType type = device.PresentationParameters.MultiSampleType; // If the card can't use the surface format if (!GraphicsAdapter.DefaultAdapter.CheckDeviceFormat( DeviceType.Hardware, GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Format, TextureUsage.None, QueryUsages.None, ResourceType.RenderTarget, surface)) { // Fall back to current display format surface = device.DisplayMode.Format; } // Or it can't accept that surface format // with the current AA settings else if (!GraphicsAdapter.DefaultAdapter.CheckDeviceMultiSampleType( DeviceType.Hardware, surface, device.PresentationParameters.IsFullScreen, type)) { // Fall back to no antialiasing type = MultiSampleType.None; } // Create our render target return(new RenderTarget2D(device, 80, 210, numberLevels, surface, type, 0)); }
public c000081(Game p0, GraphicsDeviceManager p1) { this.f0000b5 = TextureFilter.Point; this.f00000a = false; this.f000051 = Color.Black; this.f0000b6 = FormBorderStyle.Fixed3D; this.f0000a1 = false; this.f0000b5 = TextureFilter.Linear; this.f00000b = 800; this.f00000f = 600; this.f000057 = false; this.f0000b7 = MultiSampleType.TwoSamples; if (p1 != null) { this.f000056 = p1.IsFullScreen; } this.m000001(); if (p0 != null) { this.m000004(p0.Window.ClientBounds.Width); this.m00004b(p0.Window.ClientBounds.Height); } if ((p1 != null) && !p1.GraphicsDevice.CreationParameters.Adapter.CheckDeviceMultiSampleType(DeviceType.Hardware, SurfaceFormat.Color, this.m000008(), this.m0000ed())) { this.m0000ee(MultiSampleType.None); } this.m000003(); }
public RenderTarget2D( GraphicsDevice graphicsDevice, int width, int height, int numberLevels, SurfaceFormat format, MultiSampleType multiSampleType, int multiSampleQuality) : this(graphicsDevice, width, height, numberLevels > 1, format, DepthFormat.Unknown, 0, RenderTargetUsage.PreserveContents) { }
/// <summary>Called when the multisample type changes</summary> private void OnMultisampleTypeChanged(object sender, System.EventArgs e) { ComboBox cb = sender as ComboBox; MultiSampleType mst = (MultiSampleType)cb.GetSelectedData(); globalSettings.presentParams.MultiSample = mst; EnumDeviceSettingsCombo combo = GetCurrentDeviceSettingsCombo(); int maxQuality = 0; for (int i = 0; i < combo.multiSampleTypeList.Count; i++) { MultiSampleType msType = (MultiSampleType)combo.multiSampleTypeList[i]; if (msType == mst) { maxQuality = (int)combo.multiSampleQualityList[i]; } } // We have the max quality now, add to our list multiSampleQualityCombo.Clear(); for (int i = 0; i < maxQuality; i++) { if (!multiSampleQualityCombo.ContainsItem(i.ToString())) { multiSampleQualityCombo.AddItem(i.ToString(), i); } } multiSampleQualityCombo.SetSelectedByData(globalSettings.presentParams.MultiSampleQuality); OnMultisampleQualityChanged(multiSampleQualityCombo, e); }
internal void SetGraphicsDevice(GraphicsDevice graphics) { //calculate a system wide unique id for the graphics device #if XBOX360 this.graphicsId = 999; #else this.graphicsId = System.Diagnostics.Process.GetCurrentProcess().Id; #endif this.screenFormat = graphics.PresentationParameters.BackBufferFormat; this.depthFormat = graphics.PresentationParameters.EnableAutoDepthStencil ? graphics.PresentationParameters.AutoDepthStencilFormat : DepthFormat.Unknown; screenMultisample = graphics.PresentationParameters.MultiSampleType; if (graphics != this.graphics) { graphicsIndex++; } this.graphicsId ^= graphicsIndex << 16; this.graphicsId ^= (int)(DateTime.Now.Ticks & 0xFFFF); //directly accessing graphics.DepthStencilBuffer will memory leak.. so it's only used here this.defaultDepthStencil = graphics.DepthStencilBuffer; this.initalised = true; this.graphics = graphics; this.windowWidth = graphics.PresentationParameters.BackBufferWidth; this.windowHeight = graphics.PresentationParameters.BackBufferHeight; }
internal void SetWindowSizeAndFormat(int width, int height, SurfaceFormat format, DepthFormat depthFormat) { this.windowWidth = width; this.windowHeight = height; this.screenFormat = format; this.depthFormat = depthFormat; screenMultisample = MultiSampleType.None; }
private void updateLocals() { fullscreen = deviceManager.IsFullScreen; refreshrate = deviceManager.GraphicsDevice.DisplayMode.RefreshRate; screenWidth = deviceManager.GraphicsDevice.DisplayMode.Width; screenHeight = deviceManager.GraphicsDevice.DisplayMode.Height; //multiSampleQuality = deviceManager.GraphicsDevice.PresentationParameters.MultiSampleQuality; multiSampleType = deviceManager.GraphicsDevice.PresentationParameters.MultiSampleType; vsync = deviceManager.SynchronizeWithVerticalRetrace; }
public OutputRequirements(MultiSampleType aa, DeviceType dType, Format format, bool windowed, DepthFormat depthFormat, bool hardwareTnL, Version vs) { this.antiAliasing = aa; this.devType = dType; this.format = format; this.windowed = windowed; this.depthFormat = depthFormat; this.hardwareTnL = hardwareTnL; this.vs = vs; }
public GraphicsDeviceSettings(int adapter, bool windowed, DeviceType devType, Format devFormat, MultiSampleType multisample, DepthFormat depthFormat, CreateFlags createFlags) { this.adapter = adapter; this.windowed = windowed; this.devType = devType; this.devFormat = devFormat; this.multisample = multisample; this.depthFormat = depthFormat; this.createFlags = createFlags; }
public GeneralShadingDesc(GeneralShadingDesc toClone) { this.antiAliasing = toClone.antiAliasing; this.wireframe = toClone.wireframe; this.bgColor = toClone.bgColor; this.bgImg = toClone.bgImg; this.bgImgSize = toClone.bgImgSize; this.shadingMode = toClone.shadingMode; this.backgroundImgFilename = toClone.backgroundImgFilename; this.backgroundImgAlign = toClone.backgroundImgAlign; }
public bool CheckDeviceMultiSampleType( DeviceType deviceType, SurfaceFormat surfaceFormat, bool isFullScreen, MultiSampleType sampleType, out int qualityLevels) { //GG TODO qualityLevels = 0; return(false); }
public GraphicsDeviceRequirements(MultiSampleType sample, DeviceType devType, /* Format format,*/ bool windowed, DepthFormat depthFormat, bool hardwareTnL, Version vs) { multisample = sample; this.devType = devType; //this.format = format; this.windowed = windowed; depthFormats[0] = depthFormat; this.hardwareTnL = hardwareTnL; this.vs = vs; }
public OutputSettings(int adapter, bool windowed, DeviceType devType, Format devFormat, MultiSampleType antiAliasing, DepthFormat depthFormat, CreateFlags createFlags) { this.adapter = adapter; this.windowed = windowed; this.devType = devType; this.devFormat = devFormat; this.antiAliasing = antiAliasing; this.depthFormat = depthFormat; this.createFlags = createFlags; }
private void AddDevices(GraphicsAdapter adapter, DeviceType deviceType, DisplayMode mode, GraphicsDeviceInformation baseDeviceInfo, List <GraphicsDeviceInformation> foundDevices) { for (int i = 0; i < ValidBackBufferFormats.Length; i++) { SurfaceFormat backBufferFormat = ValidBackBufferFormats[i]; if (adapter.CheckDeviceType(deviceType, mode.Format, backBufferFormat, IsFullScreen)) { GraphicsDeviceInformation item = baseDeviceInfo.Clone(); if (IsFullScreen) { item.PresentationParameters.BackBufferWidth = mode.Width; item.PresentationParameters.BackBufferHeight = mode.Height; item.PresentationParameters.FullScreenRefreshRateInHz = mode.RefreshRate; } else if (useResizedBackBuffer) { item.PresentationParameters.BackBufferWidth = resizedBackBufferWidth; item.PresentationParameters.BackBufferHeight = resizedBackBufferHeight; } else { item.PresentationParameters.BackBufferWidth = PreferredBackBufferWidth; item.PresentationParameters.BackBufferHeight = PreferredBackBufferHeight; } item.PresentationParameters.BackBufferFormat = backBufferFormat; item.PresentationParameters.AutoDepthStencilFormat = PreferredDepthStencilFormat; if (PreferMultiSampling) { for (int j = 0; j < multiSampleTypes.Length; j++) { int qualityLevels = 0; MultiSampleType sampleType = multiSampleTypes[j]; if ( adapter.CheckDeviceMultiSampleType(deviceType, backBufferFormat, IsFullScreen, sampleType, out qualityLevels)) { GraphicsDeviceInformation information2 = item.Clone(); information2.PresentationParameters.MultiSampleType = sampleType; if (!foundDevices.Contains(information2)) { foundDevices.Add(information2); } break; } } } else if (!foundDevices.Contains(item)) { foundDevices.Add(item); } } } }
/// <summary> /// Create a ManagedDepthStencilBuffer. /// </summary> /// <param name="game">The game.</param> /// <param name="surfaceToScreenRatio">The surface to screen ratio.</param> /// <param name="format">The format of the stencil buffer.</param> /// <param name="msType">The multi-sampling type of the texture produced by the render target.</param> /// <param name="msQuality">The multi-sampling quality of the texture produced by the render target.</param> public ManagedDepthStencilBuffer(XiGame game, float surfaceToScreenRatio, DepthFormat format, MultiSampleType msType, int msQuality) { XiHelper.ArgumentNullCheck(game); this.game = game; this.format = format; this.msType = msType; this.msQuality = msQuality; game.GraphicsDevice.DeviceReset += device_DeviceReset; SurfaceToScreenRatio = surfaceToScreenRatio; }
private static GraphicsDeviceRequirements CheckReqs(int adapter, GraphicsDeviceRequirements minReqs, GraphicsDeviceRequirements maxReqs) { DeviceType devType = minReqs.DeviceType; if (Manager.CheckDeviceType(adapter, maxReqs.DeviceType, minReqs.DisplayFormat, minReqs.RenderTargetFormats[0], maxReqs.Windowed)) { devType = maxReqs.DeviceType; } Format[] rtFormats = minReqs.RenderTargetFormats; bool useMax = true; foreach (Format format in maxReqs.RenderTargetFormats) { if (!Manager.CheckDeviceType(adapter, devType, minReqs.DisplayFormat, format, minReqs.Windowed)) { useMax = false; break; } } if (useMax) { rtFormats = maxReqs.RenderTargetFormats; } MultiSampleType ms = minReqs.MultiSample; if (Manager.CheckDeviceMultiSampleType(adapter, devType, rtFormats[0], minReqs.Windowed, maxReqs.MultiSample)) { ms = maxReqs.MultiSample; } Caps caps = Manager.GetDeviceCaps(adapter, devType); bool pure = minReqs.Pure; if (maxReqs.Pure && caps.DeviceCaps.SupportsPureDevice) { pure = true; } bool tnl = minReqs.HardwareTnL; if (maxReqs.HardwareTnL && caps.DeviceCaps.SupportsHardwareTransformAndLight) { tnl = true; } return(new GraphicsDeviceRequirements(ms, devType, rtFormats, minReqs.NumRenderTargets, minReqs.Windowed, minReqs.DepthFormats, pure, tnl)); }
public GraphicsDevice3DOutputDescription(int adapter, bool windowed, DeviceType type, Format format, MultiSampleType multiSample, DepthFormat depthFormat, CreateFlags createFlags) { this.adapter = adapter; this.windowed = windowed; this.type = type; this.format = format; this.multiSample = multiSample; this.depthFormat = depthFormat; this.createFlags = createFlags; }
public RenderTarget2D( GraphicsDevice graphicsDevice, int width, int height, int numberLevels, SurfaceFormat format, MultiSampleType multiSampleType, int multiSampleQuality, RenderTargetUsage usage) { throw new NotImplementedException(); }
////////////////////////////////////////////////////////////////////////////////////////////////////// static public void GetAppropriateMultiSampleType(out MultiSampleType type, out int quality) { type = MultiSampleType.None; quality = 0; int result; if (Manager.CheckDeviceMultiSampleType(0, DeviceType.Hardware, Format.A8R8G8B8, true, MultiSampleType.NonMaskable, out result, out quality)) { type = MultiSampleType.NonMaskable; } }
///<summary>Inverse of ToString(). String to DirectXDeviceFormat.</summary> public DirectXDeviceFormat(string directXFormat){ if(directXFormat.IndexOf(';')<0){ //Invalid format. return; } string[] settings=directXFormat.Split(new char[] {';'}); adapter=Manager.Adapters[PIn.Int(settings[0])]; deviceType=(DeviceType)Enum.Parse(typeof(DeviceType),settings[1]); createFlags=(CreateFlags)PIn.Int(settings[2]); depthStencilFormat=(DepthFormat)Enum.Parse(typeof(DepthFormat),settings[3]); backBufferFormat=(Format)Enum.Parse(typeof(Format),settings[4]); maxMultiSampleType=(MultiSampleType)Enum.Parse(typeof(MultiSampleType),settings[5]); }
/// <summary> /// Initialize depth buffer format and multisampling /// </summary> /// <param name="setPreferredDepthStencilFormat">Set preferred depth /// stencil format</param> public static void InitializeDepthBufferFormatAndMultisampling( DepthFormat setPreferredDepthStencilFormat) { backBufferDepthFormat = setPreferredDepthStencilFormat; remMultiSampleType = BaseGame.Device.PresentationParameters.MultiSampleType; if (remMultiSampleType == MultiSampleType.NonMaskable) { remMultiSampleType = MultiSampleType.None; } remMultiSampleQuality = BaseGame.Device.PresentationParameters.MultiSampleQuality; remDepthBuffer = BaseGame.Device.DepthStencilBuffer; } // InitializeDepthBufferFormatAndMultisampling(setPreferredDepthStenci)
public GraphicsDeviceRequirements(MultiSampleType sample, DeviceType devType,/* Format format,*/ Format[] renderTargetFormats, int numRenderTargets, bool windowed, DepthFormat[] depthFormats, bool pure, bool tnl) { multisample = sample; this.devType = devType; //this.format = format; rtFormats = renderTargetFormats; this.windowed = windowed; numRTs = numRenderTargets; this.depthFormats = depthFormats; hardwareTnL = tnl; this.pure = pure; }
/// <summary> /// Sets the passed MultiSampleType if supported by the current HW /// </summary> /// <param name="multisampleType">The type you want to set</param> protected void SetMultiSampleIfAvail(MultiSampleType multisampleType) { int result = 0; int qualityLevels = 0; if (IsDeviceMultiSampleOK(multisampleType, presentParams.AutoDepthStencilFormat, presentParams.BackBufferFormat, out result, out qualityLevels)) { if (result == (int)ResultCode.Success) { presentParams.MultiSample = multisampleType; presentParams.MultiSampleQuality = qualityLevels - 1; } } }
public D3DRenderWindow(Driver driver, bool isSwapChain) { this.driver = driver; this.isSwapChain = isSwapChain; fsaaType = MultiSampleType.None; fsaaQuality = 0; isFullScreen = false; isSwapChain = false; isExternal = false; windowHandle = null; isActive = false; displayFrequency = 0; }
public RenderTarget2D(GraphicsDevice graphicsDevice, int width, int height, int numberLevels, SurfaceFormat format, MultiSampleType multiSampleType, int multiSampleQuality, RenderTargetUsage usage) { this.graphicsDevice = graphicsDevice; this.width = width; this.height = height; this.multiSampleType = multiSampleType; this.multiSampleQuality = multiSampleQuality; this.renderTargetUsage = usage; this.numLevels = numberLevels; texture = new Texture2D(graphicsDevice, width, height, numberLevels, TextureUsage.None, format); initGL(); }
public GraphicsDevice3DRequirements(MultiSampleType multiSample, DeviceType deviceType, Format[] rtFormats, int numRTs, bool windowed, DepthFormat[] depthFormats, bool pure, bool hardwareTnL, Version vs, Version ps, Format displayFormat) { this.multiSample = multiSample; this.deviceType = deviceType; this.rtFormats = rtFormats; this.numRTs = numRTs; this.windowed = windowed; this.depthFormats = depthFormats; this.pure = pure; this.hardwareTnL = hardwareTnL; this.vs = vs; this.ps = ps; this.displayFormat = displayFormat; }
public void Clear() { autoDepthStencilFormat = DepthFormat.Unknown; backBufferCount = 0; backBufferFormat = SurfaceFormat.Unknown; backBufferWidth = 320; backBufferHeight = 480; deviceWindowHandle = IntPtr.Zero; enableAutoDepthStencil = false; fullScreenRefreshRateInHz = 0; // isFullScreen = false; multiSampleQuality = 0; multiSampleType = MultiSampleType.None; swapEffect = SwapEffect.Default; this.DisplayOrientation = DisplayOrientation.Default; }
/// <summary> /// Check if the Multisample Settings are Ok /// </summary> /// <param name="depthFmt"></param> /// <param name="backbufferFmt"></param> /// <param name="multisampleType"></param> /// <param name="result"></param> /// <returns></returns> public static bool IsDeviceMultiSampleOK(MultiSampleType multisampleType, DepthFormat depthFmt, Format backbufferFmt, out int result, out int qualityLevels) { AdapterInformation ai = Manager.Adapters.Default; // Verify that the render target surface supports the given multisample type if ((backbufferFmt == Format.Unknown) || (Manager.CheckDeviceMultiSampleType(ai.Adapter, DeviceType.Hardware, backbufferFmt, false, multisampleType, out result, out qualityLevels))) { // Verify that the depth stencil surface supports the given multisample type if (Manager.CheckDeviceMultiSampleType(ai.Adapter, DeviceType.Hardware, (Format)depthFmt, false, multisampleType, out result, out qualityLevels)) { return(true); // if both calls succeed } } return(false); // if either call fails. NOTE: HRESULT passed back in result }
protected IntermediateTexture GetIntermediateTexture( int width, int height, SurfaceFormat format, MultiSampleType msType, int msQuality) { width = Math.Max(1, width); height = Math.Max(1, height); // Look for a matching rendertarget in the cache var match = _intermediateTextures.FirstOrDefault( t => !t.InUse && height == t.RenderTarget.Height && format == t.RenderTarget.Format && width == t.RenderTarget.Width && msType == t.RenderTarget.MultiSampleType && msQuality == t.RenderTarget.MultiSampleQuality); if (match != null) { match.InUse = true; return(match); } // We didn't find one, let's make one var newTexture = new IntermediateTexture { RenderTarget = new RenderTarget2D( _graphicsDevice, width, height, 1, format, msType, msQuality, RenderTargetUsage.DiscardContents) }; _intermediateTextures.Add(newTexture); newTexture.InUse = true; return(newTexture); }
public void Clear() { autoDepthStencilFormat = DepthFormat.Unknown; backBufferCount = 0; backBufferFormat = SurfaceFormat.Unknown; backBufferHeight = 0; backBufferWidth = 0; deviceWindowHandle = IntPtr.Zero; enableAutoDepthStencil = false; fullScreenRefreshRateInHz = 0; isFullScreen = false; multiSampleQuality = 0; multiSampleType = MultiSampleType.None; presentationInterval = PresentInterval.Default; presentOptions = PresentOptions.None; swapEffect = SwapEffect.Default; }
/// <summary> /// Create a ManagedRenderTarget2D. /// </summary> /// <param name="game">The game.</param> /// <param name="surfaceToScreenRatio">The surface to screen ratio.</param> /// <param name="levelCount">The number of mip-map levels of the texture produced by the render target.</param> /// <param name="format">The format of the render target.</param> /// <param name="msType">The multi-sampling type of the texture produced by the render target.</param> /// <param name="msQuality">The multi-sampling quality of the texture produced by the render target.</param> /// <param name="renderTargetIndex">The render target index.</param> public ManagedRenderTarget2D( XiGame game, float surfaceToScreenRatio, int levelCount, SurfaceFormat format, MultiSampleType msType, int msQuality, int renderTargetIndex) { XiHelper.ArgumentNullCheck(game); this.game = game; this.levelCount = levelCount; this.format = format; this.msType = msType; this.msQuality = msQuality; this.renderTargetIndex = renderTargetIndex; game.GraphicsDevice.DeviceReset += new EventHandler(device_DeviceReset); SurfaceToScreenRatio = surfaceToScreenRatio; }
/// <summary> /// Event handler called by XNA when graphic settings are being prepared. This is where /// we manage what level of antialiasing is set. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void GraphicsDeviceManager_PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e) { try { PresentationParameters pp = GraphicsDevice.PresentationParameters; MultiSampleType preferredType = GetMultiSampleType(Options.Video.AntiAliasing.ToLower()); GraphicsAdapter adapter = e.GraphicsDeviceInformation.Adapter; SurfaceFormat format = adapter.CurrentDisplayMode.Format; int quality = 0; if (adapter.CheckDeviceMultiSampleType(DeviceType.Hardware, format, !Options.Video.Windowed, preferredType, out quality)) { // The MultiSampleQuality value is specific to graphic drivers and it's not clear what // exactly it does. Setting it to zero is the best option. pp.MultiSampleQuality = 0; pp.MultiSampleType = preferredType; } else if (adapter.CheckDeviceMultiSampleType(DeviceType.Hardware, format, !Options.Video.Windowed, MultiSampleType.TwoSamples, out quality)) { // The MultiSampleQuality value is specific to graphic drivers and it's not clear what // exactly it does. Setting it to zero is the best option. pp.MultiSampleQuality = 0; pp.MultiSampleType = MultiSampleType.TwoSamples; Console.DebugPrint("[WARNING] Preferred AA {0} is not supported by the current hardware, " + "defaulting to 2x.", Options.Video.AntiAliasing); } else { pp.MultiSampleQuality = 0; pp.MultiSampleType = MultiSampleType.None; Console.DebugPrint("[WARNING] AA is not supported by this hardware; using 0 samples."); } } catch (Exception ex) { System.Console.Error.WriteLine(ex); } }
public void Clear() { autoDepthStencilFormat = DepthFormat.None; backBufferCount = 0; backBufferFormat = SurfaceFormat.Color; backBufferWidth = (int)(UIScreen.MainScreen.Bounds.Width * UIScreen.MainScreen.Scale); backBufferHeight = (int)(UIScreen.MainScreen.Bounds.Height * UIScreen.MainScreen.Scale); deviceWindowHandle = IntPtr.Zero; enableAutoDepthStencil = false; fullScreenRefreshRateInHz = 0; isFullScreen = UIApplication.SharedApplication.StatusBarHidden; depthStencilFormat = DepthFormat.None; multiSampleCount = 0; multiSampleQuality = 0; multiSampleType = MultiSampleType.None; swapEffect = SwapEffect.Default; this.DisplayOrientation = DisplayOrientation.Default; }
// Methods static GraphicsDeviceManager() { MultiSampleType[] typeArray2 = new MultiSampleType[0x11]; typeArray2[0] = MultiSampleType.NonMaskable; typeArray2[1] = MultiSampleType.SixteenSamples; typeArray2[2] = MultiSampleType.FifteenSamples; typeArray2[3] = MultiSampleType.FourteenSamples; typeArray2[4] = MultiSampleType.ThirteenSamples; typeArray2[5] = MultiSampleType.TwelveSamples; typeArray2[6] = MultiSampleType.ElevenSamples; typeArray2[7] = MultiSampleType.TenSamples; typeArray2[8] = MultiSampleType.NineSamples; typeArray2[9] = MultiSampleType.EightSamples; typeArray2[10] = MultiSampleType.SevenSamples; typeArray2[11] = MultiSampleType.SixSamples; typeArray2[12] = MultiSampleType.FiveSamples; typeArray2[13] = MultiSampleType.FourSamples; typeArray2[14] = MultiSampleType.ThreeSamples; typeArray2[15] = MultiSampleType.TwoSamples; multiSampleTypes = typeArray2; depthFormatsWithStencil = new DepthFormat[] { DepthFormat.Depth24Stencil8, DepthFormat.Depth24Stencil4, DepthFormat.Depth24Stencil8Single, DepthFormat.Depth15Stencil1 }; depthFormatsWithoutStencil = new DepthFormat[] { DepthFormat.Depth24, DepthFormat.Depth32, DepthFormat.Depth16 }; }
/// <summary> /// Creates a new <see cref="DepthStencilMultiSampleConflict"/> instance with defined field values. /// </summary> /// <param name="depthStencilFormat">The <see cref="DepthFormat"/> involved in the conflict.</param> /// <param name="multiSampleType">The <see cref="MultiSampleType"/> involved in the conflict.</param> public DepthStencilMultiSampleConflict(DepthFormat depthStencilFormat, MultiSampleType multiSampleType) { this.depthStencilFormat = depthStencilFormat; this.multiSampleType = multiSampleType; }
/// <summary> /// Event handler for when the Language menu entry is selected. /// </summary> void multisamplingtypeMenuEntrySelected(object sender, PlayerIndexEventArgs e) { int level = (int)multisamplingType; if (level == 0 || level == 1 || level == 2 || level == 4 || level == 8 || level == 16) { // ok multisample } else { multisamplingType = 0; } if (multisamplingType == 0) multisamplingType++; else multisamplingType = (MultiSampleType)((int)multisamplingType * 2); if (multisamplingType > MultiSampleType.SixteenSamples) multisamplingType = 0; SurfaceFormat format = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Format; // Check for 4xAA if (GraphicsAdapter.DefaultAdapter.CheckDeviceMultiSampleType(DeviceType.Hardware, format, false, multisamplingType)) { // it supports!!!! } else { multisamplingType = 0; } if (multisamplingType == 0) DefaultSettings.MultiSampleAntiAlias = false; else DefaultSettings.MultiSampleAntiAlias = true; DefaultSettings.MultiSamplingLevel = multisamplingType; DefaultSettings.Save(); SetMenuEntryText(); }
private static bool IsDeviceMultiSampleOK(AdapterInformation adapter,DeviceType deviceType,DepthFormat depthFormat, Format backbufferFormat,MultiSampleType multisampleType,bool windowed) { int qualityLevels=0; int result=0; //Verify that the render target surface supports the given multisample type if(Manager.CheckDeviceMultiSampleType(adapter.Adapter,deviceType,backbufferFormat,windowed,multisampleType,out result,out qualityLevels)) { //Verify that the depth stencil surface supports the given multisample type if(Manager.CheckDeviceMultiSampleType(adapter.Adapter,deviceType,(Format)depthFormat,windowed,multisampleType,out result,out qualityLevels)) { return (result==((int)ResultCode.Success)); } } return false; }
public DepthStencilBuffer(GraphicsDevice graphicsDevice, int width, int height, DepthFormat format, MultiSampleType multiSampleType, int multiSampleQuality) { _format = format; }
public bool CheckDeviceMultiSampleType( DeviceType deviceType, SurfaceFormat surfaceFormat, bool isFullScreen, MultiSampleType sampleType, out int qualityLevels) { //GG TODO qualityLevels = 0; return false; }
/// <summary> /// /// </summary> /// <param name="name"></param> /// <param name="width"></param> /// <param name="height"></param> /// <param name="colorDepth"></param> /// <param name="isFullScreen"></param> /// <param name="left"></param> /// <param name="top"></param> /// <param name="depthBuffer"></param>height /// <param name="miscParams"></param> public override void Create(string name, int width, int height, bool isFullScreen, params object[] miscParams) { Control parentWindow = null; Control externalWindow = null; fsaaType = MultiSampleType.None; fsaaQuality = 0; isVSync = false; string title = name; int colorDepth = 32; int left = -1; int top = -1; bool depthBuffer = true; // Parameters that would have been set in the params list, but are not used // border, outerSize useNVPerfHUD = false; multiThreaded = false; Debug.Assert(miscParams.Length % 2 == 0); int index = 0; while (index < miscParams.Length) { string key = (string)miscParams[index++]; object value = miscParams[index++]; switch (key) { case "left": left = (int)value; break; case "top": top = (int)value; break; case "title": title = (string)value; break; case "parentWindow": parentWindow = (Control)value; break; case "externalWindow": externalWindow = (Control)value; break; case "vsync": isVSync = (bool)value; break; case "displayFrequency": displayFrequency = (int)value; break; case "colorDepth": case "colourDepth": colorDepth = (int)value; break; case "depthBuffer": depthBuffer = (bool)value; break; case "FSAA": fsaaType = (MultiSampleType)value; break; case "FSAAQuality": fsaaQuality = (int)value; break; case "useNVPerfHUD": useNVPerfHUD = (bool)value; break; case "multiThreaded": multiThreaded = (bool)value; break; case "initialLoadBitmap": initialLoadBitmap = (string)value; break; case "border": case "outerDimensions": default: log.Warn("Option not yet implemented"); break; } } if (windowHandle != null) Destroy(); if (externalWindow == null) { this.width = width; this.height = height; this.top = top; this.left = left; FormBorderStyle borderStyle = FormBorderStyle.None; FormWindowState windowState = FormWindowState.Normal; if (!isFullScreen) { // If RenderSystem.AllowResize is true, put a // resize border on the window. borderStyle = (Root.Instance.RenderSystem.AllowResize ? FormBorderStyle.Sizable : FormBorderStyle.FixedSingle); windowState = FormWindowState.Normal; } else { borderStyle = FormBorderStyle.None; windowState = FormWindowState.Maximized; this.top = 0; this.left = 0; } isExternal = false; form = new DefaultForm(!isFullScreen, initialLoadBitmap); // Set these two to false, or else windows get created // with different dimensions that requesting in Width // and Height! log.InfoFormat("Initial form settings: AutoSize: {0}; AutoScale: {1}", form.AutoSize, form.AutoScaleMode); form.AutoSize = false; form.AutoScaleMode = AutoScaleMode.None; form.ClientSize = new System.Drawing.Size(width, height); // TODO: I should support the maximize box once I get resize working // form.MaximizeBox = true; form.MaximizeBox = false; form.MinimizeBox = true; form.Top = this.top; form.Left = this.left; form.FormBorderStyle = borderStyle; form.WindowState = windowState; form.Text = title; form.StartPosition = FormStartPosition.CenterScreen; form.BringToFront(); if (isFullScreen) { form.TopMost = true; form.TopLevel = true; form.Width = width; form.Height = height; } // form.Target.Visible = false; form.Show(); // set the default form's renderwindow so it can access it internally form.RenderWindow = this; form.Activate(); windowHandle = form.Target; } else { windowHandle = externalWindow; isExternal = true; this.top = windowHandle.Top; this.left = windowHandle.Left; System.Drawing.Rectangle rect = windowHandle.ClientRectangle; this.width = rect.Width; this.height = rect.Height; } windowHandle.Resize += this.OnExternalWindowEvent; windowHandle.Move += this.OnExternalWindowEvent; this.name = name; this.isDepthBuffered = depthBuffer; this.isFullScreen = isFullScreen; this.colorDepth = colorDepth; CreateD3DResources(); isActive = true; // FIXME: These lines were not in Ogre, but are in Axiom. //D3D.Device device = driver.Device; // device.DeviceReset += new EventHandler(OnResetDevice); //this.OnResetDevice(device, null); }
public RenderTarget2D(GraphicsDevice graphicsDevice, int width, int height, int numberLevels, SurfaceFormat format, MultiSampleType multiSampleType, int multiSampleQuality, RenderTargetUsage usage) { Init(graphicsDevice, width, height, format); GraphicsDevice._allRenderTargets.Add(this); }
public void m0000ee(MultiSampleType p0) { this.f0000b7 = p0; this.m000047(); }
/// <summary> /// Initialize depth buffer format and multisampling /// </summary> /// <param name="setPreferredDepthStencilFormat">Set preferred depth /// stencil format</param> public static void InitializeDepthBufferFormatAndMultisampling( DepthFormat setPreferredDepthStencilFormat) { backBufferDepthFormat = setPreferredDepthStencilFormat; remMultiSampleType = BaseGame.Device.PresentationParameters.MultiSampleType; if (remMultiSampleType == MultiSampleType.NonMaskable) remMultiSampleType = MultiSampleType.None; remMultiSampleQuality = BaseGame.Device.PresentationParameters.MultiSampleQuality; remDepthBuffer = BaseGame.Device.DepthStencilBuffer; }
public RenderTarget2D ( GraphicsDevice graphicsDevice, int width, int height, int numberLevels, SurfaceFormat format, MultiSampleType multiSampleType, int multiSampleQuality, RenderTargetUsage usage ) { throw new NotImplementedException(); }
/****************************************************************************************/ /// <summary> /// (Void) Apply Anti-aliasing to lower jagged edges appearing on 3D content. /// </summary> /// <param name="bChoice">(Bool) Whether we have MSAA enabled or not.</param> /// <param name="mstLevel">(MultiSampleType) The amount of MSAA we are applying.</param> public void AntiAliasing(bool bChoice, MultiSampleType mstLevel) { Core.Graphics.PreferMultiSampling = bChoice; Core.Graphics.GraphicsDevice.PresentationParameters.MultiSampleType = mstLevel; Core.Graphics.GraphicsDevice.PresentationParameters.MultiSampleQuality = 0; _DeviceChanged = true; }
public bool CheckDeviceMultiSampleType(DeviceType deviceType, SurfaceFormat surfaceFormat, bool isFullScreen, MultiSampleType sampleType, out int qualityLevels) { throw new NotImplementedException(); }
public static int GetMultiSampleNumberForType(MultiSampleType multiSampleType){ if(multiSampleType==MultiSampleType.TwoSamples){ return 2; }else if(multiSampleType==MultiSampleType.ThreeSamples){ return 3; } else if(multiSampleType==MultiSampleType.FourSamples) { return 4; } else if(multiSampleType==MultiSampleType.FiveSamples) { return 5; } else if(multiSampleType==MultiSampleType.SixSamples) { return 6; } else if(multiSampleType==MultiSampleType.SevenSamples) { return 7; } else if(multiSampleType==MultiSampleType.EightSamples) { return 8; } else if(multiSampleType==MultiSampleType.NineSamples) { return 9; } else if(multiSampleType==MultiSampleType.TenSamples) { return 10; } else if(multiSampleType==MultiSampleType.ElevenSamples) { return 11; } else if(multiSampleType==MultiSampleType.TwelveSamples) { return 12; } else if(multiSampleType==MultiSampleType.ThirteenSamples) { return 13; } else if(multiSampleType==MultiSampleType.FourteenSamples) { return 14; } else if(multiSampleType==MultiSampleType.FifteenSamples) { return 15; } else if(multiSampleType==MultiSampleType.SixteenSamples) { return 16; } return 0; }
/// <summary> /// Initialize /// </summary> protected override void Initialize() { #if !XBOX360 // Add screenshot capturer. Works only on windows platform. // Note: Don't do this in constructor, // we need the correct window name for screenshots! this.Components.Add(new ScreenshotCapturer(this)); #endif // Remember device device = graphics.GraphicsDevice; // Remember resolution width = graphics.GraphicsDevice.Viewport.Width; height = graphics.GraphicsDevice.Viewport.Height; backBufferDepthFormat = graphics.PreferredDepthStencilFormat; remMultiSampleType = device.PresentationParameters.MultiSampleType; //if (remMultiSampleType == MultiSampleType.NonMaskable) // remMultiSampleType = MultiSampleType.None; remMultiSampleQuality = device.PresentationParameters.MultiSampleQuality; remDepthBuffer = device.DepthStencilBuffer; // Update resolution if it changes and restore device after it was lost Window.ClientSizeChanged += new EventHandler(Window_ClientSizeChanged); graphics.DeviceReset += new EventHandler(graphics_DeviceReset); graphics_DeviceReset(null, EventArgs.Empty); // Create matrices for our shaders, this makes it much easier to manage // all the required matrices and we have to do this ourselfs since there // is no fixed function support and theirfore no Device.Transform class. WorldMatrix = Matrix.Identity; aspectRatio = (float)width / (float)height; ProjectionMatrix = Matrix.CreatePerspectiveFieldOfView( FieldOfView, aspectRatio, NearPlane, FarPlane); // ViewMatrix is updated in camera class ViewMatrix = Matrix.CreateLookAt( new Vector3(0, 0, 15), Vector3.Zero, Vector3.Up); // Init global manager classes, which will be used all over the place ^^ lineManager2D = new LineManager2D(); //lineManager3D = new LineManager3D(); ui = new UIRenderer(); // Create font and numbers font font = new TextureFont(); // Make sure we can use PS1 or PS2, see UsePS and UsePS20 if (device.GraphicsDeviceCapabilities.PixelShaderVersion.Major >= 2 && GameSettings.Default.PerformanceSettings < 2) GameSettings.Default.PerformanceSettings = 2; else if ( device.GraphicsDeviceCapabilities.PixelShaderVersion.Major >= 1 && GameSettings.Default.PerformanceSettings < 1) GameSettings.Default.PerformanceSettings = 1; // Init post screen glow glowShader = //new PostScreenMenu(); new PostScreenGlow(); // Init effect manager effectManager = new EffectManager(); // Init light position LightDirection = new Vector3(2, -7, 5); base.Initialize(); device.RenderState.DepthBufferEnable = true; // Always create depth buffer from now on RenderToTexture.alwaysCreateRenderTargetDepthBuffer = true; } // Initialize()