diff --git a/OpenRa.Game/Game.cs b/OpenRa.Game/Game.cs index 88c7697972..fecfababe3 100644 --- a/OpenRa.Game/Game.cs +++ b/OpenRa.Game/Game.cs @@ -96,6 +96,7 @@ namespace OpenRa.Game skipMakeAnims = false; PerfHistory.items["render"].hasNormalTick = false; + PerfHistory.items["batches"].hasNormalTick = false; chrome = new Chrome(renderer); } @@ -203,6 +204,7 @@ namespace OpenRa.Game } PerfHistory.items["render"].Tick(); + PerfHistory.items["batches"].Tick(); } public static bool IsCellBuildable(int2 a, UnitMovementType umt) diff --git a/OpenRa.Game/Graphics/Renderer.cs b/OpenRa.Game/Graphics/Renderer.cs index 35b62a2202..e22fd3de4d 100644 --- a/OpenRa.Game/Graphics/Renderer.cs +++ b/OpenRa.Game/Graphics/Renderer.cs @@ -3,6 +3,7 @@ using System.Drawing; using System.Windows.Forms; using Ijw.DirectX; using OpenRa.FileFormats; +using OpenRa.Game.Support; namespace OpenRa.Game.Graphics { @@ -70,14 +71,16 @@ namespace OpenRa.Game.Graphics Range vertexRange, Range indexRange, Texture texture, PrimitiveType type, Shader shader) where T : struct { - shader.SetValue( "DiffuseTexture", texture ); + shader.SetValue("DiffuseTexture", texture); shader.Commit(); - vertices.Bind( 0 ); + vertices.Bind(0); indices.Bind(); - device.DrawIndexedPrimitives( type, - vertexRange, indexRange ); + device.DrawIndexedPrimitives(type, + vertexRange, indexRange); + + PerfHistory.Increment("batches", 1); } public void DrawBatch(FvfVertexBuffer vertices, IndexBuffer indices, @@ -92,6 +95,8 @@ namespace OpenRa.Game.Graphics device.DrawIndexedPrimitives(type, vertexPool, numPrimitives); + + PerfHistory.Increment("batches", 1); } public void DrawText(string text, int2 pos, Color c)