Checks if raw performance of rendering lines and sprites is good. Fast GPU recommended. Please
note that the test here simulate how the rendering classes work, you can get worse values if
you draw many small batches and cause overhead the Rendering namespace optimizes already.
View code on GitHub
Inheritance Hierarchy
DeltaEngine.Platforms TestWithMocksOrVisually
DeltaEngine.Graphics.Tests DrawingPerformanceTests
Namespace: DeltaEngine.Graphics.Tests
Assembly: DeltaEngine.Graphics.Tests (in DeltaEngine.Graphics.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The DrawingPerformanceTests type exposes the following members.
Constructors
Name | Description | |
---|---|---|
DrawingPerformanceTests | Initializes a new instance of the DrawingPerformanceTests class |
Methods
Name | Description | |
---|---|---|
AdvanceTimeAndUpdateEntities | (Inherited from TestWithMocksOrVisually.) | |
Draw30000LinesPerFrame |
Proof that 30k lines can be rendered with up to 3000fps in a small window, fast GPU. Even
1000fps means that 30 million lines are drawn each second. More than 30k lines are possible
with multiple draw calls, but causes multiple CircularBuffer flushes and thus not faster.
View code on GitHub | |
DrawImagesWithOneMillionPolygonsPerFrame |
Draws 100*100 small images (=10000 images =20000 polygons) 50 times a frame to reach 1 million
polygons drawn per frame. Can reach 100fps or more, which means 100 million polygons per second.
View code on GitHub | |
InitializeResolver | (Inherited from TestWithMocksOrVisually.) | |
RegisterMock T | (Inherited from TestWithMocksOrVisually.) | |
Resolve T | (Inherited from TestWithMocksOrVisually.) | |
RunAfterFirstFrame | (Inherited from TestWithMocksOrVisually.) | |
RunTestAndDisposeResolverWhenDone | (Inherited from TestWithMocksOrVisually.) |
Properties
Name | Description | |
---|---|---|
IsMockResolver | (Inherited from TestWithMocksOrVisually.) |
Examples
/// <summary> /// Proof that 30k lines can be rendered with up to 3000fps in a small window, fast GPU. Even /// 1000fps means that 30 million lines are drawn each second. More than 30k lines are possible /// with multiple draw calls, but causes multiple CircularBuffer flushes and thus not faster. /// </summary> [Test, Category("Slow")] public void Draw30000LinesPerFrame() { var manyLines = new DrawingTests.Line(Vector2D.Zero, new Vector2D(1280, 720), Color.Red); const int NumberOfRandomLines = 30000; var vertices = new VertexPosition2DColor[2 * NumberOfRandomLines]; var random = Randomizer.Current; var viewport = Resolve<Window>().ViewportPixelSize; for (int i = 0; i < NumberOfRandomLines; i++) { var startPoint = new Vector2D(random.Get(0, viewport.Width), random.Get(0, viewport.Height)); var endPoint = startPoint + new Vector2D(random.Get(-50, 50), random.Get(-50, 50)); vertices[i * 2 + 0] = new VertexPosition2DColor(startPoint, Color.GetRandomColor()); vertices[i * 2 + 1] = new VertexPosition2DColor(endPoint, Color.GetRandomColor()); } manyLines.Set(vertices); }
/// <summary> /// Draws 100*100 small images (=10000 images =20000 polygons) 50 times a frame to reach 1 million /// polygons drawn per frame. Can reach 100fps or more, which means 100 million polygons per second. /// </summary> [Test, Category("Slow")] public void DrawImagesWithOneMillionPolygonsPerFrame() { var verticesAndIndices = CreateVerticesAndIndices(); verticesAndIndices.OnDraw<RenderOneMillionPolygons>(); }
See Also