diff --git a/code/client/cl_scrn.cpp b/code/client/cl_scrn.cpp index 42a055e..a0d038d 100644 --- a/code/client/cl_scrn.cpp +++ b/code/client/cl_scrn.cpp @@ -415,6 +415,8 @@ static void SCR_PerformanceCounters() SCR_DrawString( x, y, cw, ch, va("Base Tris: %i", pc3D[RB_INDICES] / 3), qfalse ); y += ch; SCR_DrawString( x, y, cw, ch, va("Base Surfs: %i", pc3D[RB_SURFACES]), qfalse ); y += ch; SCR_DrawString( x, y, cw, ch, va("B Batches: %i", pc3D[RB_BATCHES]), qfalse ); y += ch; + SCR_DrawString( x, y, cw, ch, va("Shdr Chges: %i", pc3D[RB_SHADER_CHANGES]), qfalse ); y += ch; + SCR_DrawString( x, y, cw, ch, va("Draw Calls: %i", pc3D[RB_DRAW_CALLS]), qfalse ); y += ch; SCR_DrawString( x, y, cw, ch, va("Lit Verts: %i", pc3D[RB_LIT_VERTICES]), qfalse ); y += ch; SCR_DrawString( x, y, cw, ch, va("Lit Tris: %i", pc3D[RB_LIT_INDICES] / 3), qfalse ); y += ch; diff --git a/code/renderer/tr_backend_d3d11.cpp b/code/renderer/tr_backend_d3d11.cpp index 838e178..70ede57 100644 --- a/code/renderer/tr_backend_d3d11.cpp +++ b/code/renderer/tr_backend_d3d11.cpp @@ -825,6 +825,7 @@ static void DrawIndexed(int indexCount) { d3ds.context->DrawIndexed(indexCount, d3d.indexBuffer.readIndex, d3d.vertexBuffers[VB_POSITION].readIndex); } + backEnd.pc3D[RB_DRAW_CALLS]++; } static void ApplyPipeline(PipelineId index) @@ -891,6 +892,7 @@ static void ApplyPipeline(PipelineId index) d3ds.context->VSSetShader(pipeline->vertexShader, NULL, 0); d3ds.context->PSSetShader(pipeline->pixelShader, NULL, 0); + backEnd.pc3D[RB_SHADER_CHANGES]++; if(pipeline->vertexBuffer) { @@ -2080,6 +2082,7 @@ static void DrawPostProcess(float vsX, float vsY, float srX, float srY, qbool sc } } d3ds.context->Draw(3, 0); + backEnd.pc3D[RB_DRAW_CALLS]++; } static void GAL_EndFrame() @@ -2684,6 +2687,7 @@ static void ClearViews(qbool shouldClearColor, const FLOAT* clearColor) d3d.clearPSData.color[3] = shouldClearColor ? 1.0f : 0.0f; UploadPendingShaderData(); d3ds.context->Draw(3, 0); + backEnd.pc3D[RB_DRAW_CALLS]++; ApplyPipeline(PID_GENERIC); } } diff --git a/code/renderer/tr_backend_gl2.cpp b/code/renderer/tr_backend_gl2.cpp index 3ff5c23..b3d6f55 100644 --- a/code/renderer/tr_backend_gl2.cpp +++ b/code/renderer/tr_backend_gl2.cpp @@ -70,6 +70,7 @@ static void GL_Program( const GLSL_Program& prog ) if ( prog.p != progCurrent ) { glUseProgram( prog.p ); progCurrent = prog.p; + backEnd.pc3D[ RB_SHADER_CHANGES ]++; } } @@ -78,6 +79,7 @@ static void GL_Program() if ( progCurrent != 0 ) { glUseProgram(0); progCurrent = 0; + backEnd.pc3D[ RB_SHADER_CHANGES ]++; } } @@ -144,6 +146,7 @@ static void DrawDynamicLight() R_BindAnimatedImage( &pStage->bundle ); glDrawElements( GL_TRIANGLES, tess.dlNumIndexes, GL_INDEX_TYPE, tess.dlIndexes ); + backEnd.pc3D[ RB_DRAW_CALLS ]++; glUnlockArraysEXT(); @@ -168,6 +171,7 @@ static qbool GL2_StageIterator_MultitextureStage( int stage ) glTexCoordPointer( 2, GL_FLOAT, 0, tess.svars[stage].texcoordsptr ); glDrawElements( GL_TRIANGLES, tess.numIndexes, GL_INDEX_TYPE, tess.indexes ); + backEnd.pc3D[ RB_DRAW_CALLS ]++; glDisable( GL_TEXTURE_2D ); GL_SelectTexture( 0 ); @@ -215,6 +219,7 @@ static void DrawGeneric() } glDrawElements( GL_TRIANGLES, tess.numIndexes, GL_INDEX_TYPE, tess.indexes ); + backEnd.pc3D[ RB_DRAW_CALLS ]++; } if ( tess.drawFog ) @@ -801,6 +806,7 @@ static void GL2_EndFrame() static void ID_INLINE R_DrawElements( int numIndexes, const unsigned int* indexes ) { glDrawElements( GL_TRIANGLES, numIndexes, GL_INDEX_TYPE, indexes ); + backEnd.pc3D[ RB_DRAW_CALLS ]++; } diff --git a/code/renderer/tr_backend_gl3.cpp b/code/renderer/tr_backend_gl3.cpp index 3a1f8dc..b98a7e4 100644 --- a/code/renderer/tr_backend_gl3.cpp +++ b/code/renderer/tr_backend_gl3.cpp @@ -1160,6 +1160,7 @@ static void ApplyPipeline(PipelineId pipelineId) Pipeline* const pipeline = &gl.pipelines[pipelineId]; glUseProgram(pipeline->program.program); + backEnd.pc3D[RB_SHADER_CHANGES]++; for(int i = 0; i < VB_COUNT; ++i) { @@ -1726,6 +1727,7 @@ static void CreateGeometryBufferStorage(ArrayBuffer* buffer) static void DrawElements(int indexCount) { glDrawElements(GL_TRIANGLES, indexCount, GL_UNSIGNED_INT, (const GLvoid*)(GLintptr)(gl.indexBuffer.readIndex * gl.indexBuffer.itemSize)); + backEnd.pc3D[RB_DRAW_CALLS]++; } static void SetDefaultState() @@ -2168,6 +2170,7 @@ static void GAL_EndFrame() gl.fbReadIndex ^= 1; FBO_Bind(&gl.fbSS[gl.fbReadIndex]); glDrawArrays(GL_TRIANGLES, 0, 3); + backEnd.pc3D[RB_DRAW_CALLS]++; ApplyViewportAndScissor(0, 0, glInfo.winWidth, glInfo.winHeight); FBO_BlitToBackBuffer(); diff --git a/code/renderer/tr_public.h b/code/renderer/tr_public.h index b3f575f..1205f03 100644 --- a/code/renderer/tr_public.h +++ b/code/renderer/tr_public.h @@ -76,6 +76,8 @@ enum { RB_INDICES, RB_SURFACES, RB_BATCHES, + RB_SHADER_CHANGES, // vertex + pixel shader combos, not Q3 shaders + RB_DRAW_CALLS, // dispatched API draw calls RB_LIT_VERTICES, RB_LIT_INDICES,