batch count vis

This commit is contained in:
Chris Forbes
2009-11-19 18:22:42 +13:00
parent db965cd22d
commit 1d60fa3343
2 changed files with 11 additions and 4 deletions

View File

@@ -96,6 +96,7 @@ namespace OpenRa.Game
skipMakeAnims = false; skipMakeAnims = false;
PerfHistory.items["render"].hasNormalTick = false; PerfHistory.items["render"].hasNormalTick = false;
PerfHistory.items["batches"].hasNormalTick = false;
chrome = new Chrome(renderer); chrome = new Chrome(renderer);
} }
@@ -203,6 +204,7 @@ namespace OpenRa.Game
} }
PerfHistory.items["render"].Tick(); PerfHistory.items["render"].Tick();
PerfHistory.items["batches"].Tick();
} }
public static bool IsCellBuildable(int2 a, UnitMovementType umt) public static bool IsCellBuildable(int2 a, UnitMovementType umt)

View File

@@ -3,6 +3,7 @@ using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
using Ijw.DirectX; using Ijw.DirectX;
using OpenRa.FileFormats; using OpenRa.FileFormats;
using OpenRa.Game.Support;
namespace OpenRa.Game.Graphics namespace OpenRa.Game.Graphics
{ {
@@ -70,14 +71,16 @@ namespace OpenRa.Game.Graphics
Range<int> vertexRange, Range<int> indexRange, Texture texture, PrimitiveType type, Shader shader) Range<int> vertexRange, Range<int> indexRange, Texture texture, PrimitiveType type, Shader shader)
where T : struct where T : struct
{ {
shader.SetValue( "DiffuseTexture", texture ); shader.SetValue("DiffuseTexture", texture);
shader.Commit(); shader.Commit();
vertices.Bind( 0 ); vertices.Bind(0);
indices.Bind(); indices.Bind();
device.DrawIndexedPrimitives( type, device.DrawIndexedPrimitives(type,
vertexRange, indexRange ); vertexRange, indexRange);
PerfHistory.Increment("batches", 1);
} }
public void DrawBatch<T>(FvfVertexBuffer<T> vertices, IndexBuffer indices, public void DrawBatch<T>(FvfVertexBuffer<T> vertices, IndexBuffer indices,
@@ -92,6 +95,8 @@ namespace OpenRa.Game.Graphics
device.DrawIndexedPrimitives(type, device.DrawIndexedPrimitives(type,
vertexPool, numPrimitives); vertexPool, numPrimitives);
PerfHistory.Increment("batches", 1);
} }
public void DrawText(string text, int2 pos, Color c) public void DrawText(string text, int2 pos, Color c)