mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +02:00
Added 'drawcallsbatched' field to the table returned by love.graphics.getStats.
It has the number of draw calls that were saved by auto-batching. --HG-- branch : minor
This commit is contained in:
@@ -112,6 +112,7 @@ Graphics::Graphics()
|
||||
, streamBufferState()
|
||||
, projectionMatrix()
|
||||
, canvasSwitchCount(0)
|
||||
, drawCallsBatched(0)
|
||||
, capabilities()
|
||||
{
|
||||
transformStack.reserve(16);
|
||||
@@ -879,6 +880,9 @@ Graphics::StreamVertexData Graphics::requestStreamDraw(const StreamDrawRequest &
|
||||
}
|
||||
}
|
||||
|
||||
if (state.vertexCount > 0)
|
||||
drawCallsBatched++;
|
||||
|
||||
state.vertexCount += req.vertexCount;
|
||||
state.indexCount += reqIndexCount;
|
||||
|
||||
@@ -1273,6 +1277,7 @@ Graphics::Stats Graphics::getStats() const
|
||||
stats.drawCalls++;
|
||||
|
||||
stats.canvasSwitches = canvasSwitchCount;
|
||||
stats.drawCallsBatched = drawCallsBatched;
|
||||
stats.canvases = Canvas::canvasCount;
|
||||
stats.images = Image::imageCount;
|
||||
stats.fonts = Font::fontCount;
|
||||
|
||||
@@ -216,6 +216,7 @@ public:
|
||||
struct Stats
|
||||
{
|
||||
int drawCalls;
|
||||
int drawCallsBatched;
|
||||
int canvasSwitches;
|
||||
int shaderSwitches;
|
||||
int canvases;
|
||||
@@ -900,6 +901,7 @@ protected:
|
||||
std::vector<Canvas *> temporaryCanvases;
|
||||
|
||||
int canvasSwitchCount;
|
||||
int drawCallsBatched;
|
||||
|
||||
Capabilities capabilities;
|
||||
|
||||
|
||||
@@ -1010,6 +1010,7 @@ void Graphics::present(void *screenshotCallbackData)
|
||||
gl.stats.drawCalls = 0;
|
||||
gl.stats.shaderSwitches = 0;
|
||||
canvasSwitchCount = 0;
|
||||
drawCallsBatched = 0;
|
||||
}
|
||||
|
||||
void Graphics::setScissor(const Rect &rect)
|
||||
|
||||
@@ -2073,6 +2073,9 @@ int w_getStats(lua_State *L)
|
||||
lua_pushinteger(L, stats.drawCalls);
|
||||
lua_setfield(L, -2, "drawcalls");
|
||||
|
||||
lua_pushinteger(L, stats.drawCallsBatched);
|
||||
lua_setfield(L, -2, "drawcallsbatched");
|
||||
|
||||
lua_pushinteger(L, stats.canvasSwitches);
|
||||
lua_setfield(L, -2, "canvasswitches");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user