Show More
Commit Description:
Optimize PreserveCounts and only recalculate when needed....
Commit Description:
Optimize PreserveCounts and only recalculate when needed. Previously would recalculate preservecounts every Update call (~1 per frame), which isn't necessary when there's no tick. Might be some room to tweak, like doing these updates only when preserves change. Some measurements: This takes about 30ms versus the .25 ms with no preserve (then like .0002ms). When the map is filled up with preserve, about 35ms and 9ms. With a handful of cells, it's more like 0.8ms (before JIT optimizes most of it away).
File last commit:
Show/Diff file:
Action:
FNA/src/Graphics/PresentationParameters.cs
129 lines | 2.3 KiB | text/x-csharp | CSharpLexer
#region License
/* FNA - XNA4 Reimplementation for Desktop Platforms
* Copyright 2009-2020 Ethan Lee and the MonoGame Team
*
* Released under the Microsoft Public License.
* See LICENSE for details.
*/
#endregion
#region Using Statements
using System;
#endregion
namespace Microsoft.Xna.Framework.Graphics
{
[Serializable]
public class PresentationParameters
{
#region Public Properties
public SurfaceFormat BackBufferFormat
{
get;
set;
}
public int BackBufferHeight
{
get;
set;
}
public int BackBufferWidth
{
get;
set;
}
public Rectangle Bounds
{
get
{
return new Rectangle(0, 0, BackBufferWidth, BackBufferHeight);
}
}
public IntPtr DeviceWindowHandle
{
get;
set;
}
public DepthFormat DepthStencilFormat
{
get;
set;
}
public bool IsFullScreen
{
get;
set;
}
public int MultiSampleCount
{
get;
set;
}
public PresentInterval PresentationInterval
{
get;
set;
}
public DisplayOrientation DisplayOrientation
{
get;
set;
}
public RenderTargetUsage RenderTargetUsage
{
get;
set;
}
#endregion
#region Public Constructors
public PresentationParameters()
{
BackBufferFormat = SurfaceFormat.Color;
BackBufferWidth = GraphicsDeviceManager.DefaultBackBufferWidth;
BackBufferHeight = GraphicsDeviceManager.DefaultBackBufferHeight;
DeviceWindowHandle = IntPtr.Zero;
IsFullScreen = false; // FIXME: Is this the default?
DepthStencilFormat = DepthFormat.None;
MultiSampleCount = 0;
PresentationInterval = PresentInterval.Default;
DisplayOrientation = DisplayOrientation.Default;
RenderTargetUsage = RenderTargetUsage.DiscardContents;
}
#endregion
#region Public Methods
public PresentationParameters Clone()
{
PresentationParameters clone = new PresentationParameters();
clone.BackBufferFormat = BackBufferFormat;
clone.BackBufferHeight = BackBufferHeight;
clone.BackBufferWidth = BackBufferWidth;
clone.DeviceWindowHandle = DeviceWindowHandle;
clone.IsFullScreen = IsFullScreen;
clone.DepthStencilFormat = DepthStencilFormat;
clone.MultiSampleCount = MultiSampleCount;
clone.PresentationInterval = PresentationInterval;
clone.DisplayOrientation = DisplayOrientation;
clone.RenderTargetUsage = RenderTargetUsage;
return clone;
}
#endregion
}
}