added new stats to r_speeds 1 (shader changes, draw calls)

This commit is contained in:
myT 2020-11-05 03:50:58 +01:00
parent f4e8e81ab5
commit b1df6ac8f7
5 changed files with 17 additions and 0 deletions

View file

@ -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 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("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("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 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; SCR_DrawString( x, y, cw, ch, va("Lit Tris: %i", pc3D[RB_LIT_INDICES] / 3), qfalse ); y += ch;

View file

@ -825,6 +825,7 @@ static void DrawIndexed(int indexCount)
{ {
d3ds.context->DrawIndexed(indexCount, d3d.indexBuffer.readIndex, d3d.vertexBuffers[VB_POSITION].readIndex); d3ds.context->DrawIndexed(indexCount, d3d.indexBuffer.readIndex, d3d.vertexBuffers[VB_POSITION].readIndex);
} }
backEnd.pc3D[RB_DRAW_CALLS]++;
} }
static void ApplyPipeline(PipelineId index) static void ApplyPipeline(PipelineId index)
@ -891,6 +892,7 @@ static void ApplyPipeline(PipelineId index)
d3ds.context->VSSetShader(pipeline->vertexShader, NULL, 0); d3ds.context->VSSetShader(pipeline->vertexShader, NULL, 0);
d3ds.context->PSSetShader(pipeline->pixelShader, NULL, 0); d3ds.context->PSSetShader(pipeline->pixelShader, NULL, 0);
backEnd.pc3D[RB_SHADER_CHANGES]++;
if(pipeline->vertexBuffer) 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); d3ds.context->Draw(3, 0);
backEnd.pc3D[RB_DRAW_CALLS]++;
} }
static void GAL_EndFrame() 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; d3d.clearPSData.color[3] = shouldClearColor ? 1.0f : 0.0f;
UploadPendingShaderData(); UploadPendingShaderData();
d3ds.context->Draw(3, 0); d3ds.context->Draw(3, 0);
backEnd.pc3D[RB_DRAW_CALLS]++;
ApplyPipeline(PID_GENERIC); ApplyPipeline(PID_GENERIC);
} }
} }

View file

@ -70,6 +70,7 @@ static void GL_Program( const GLSL_Program& prog )
if ( prog.p != progCurrent ) { if ( prog.p != progCurrent ) {
glUseProgram( prog.p ); glUseProgram( prog.p );
progCurrent = prog.p; progCurrent = prog.p;
backEnd.pc3D[ RB_SHADER_CHANGES ]++;
} }
} }
@ -78,6 +79,7 @@ static void GL_Program()
if ( progCurrent != 0 ) { if ( progCurrent != 0 ) {
glUseProgram(0); glUseProgram(0);
progCurrent = 0; progCurrent = 0;
backEnd.pc3D[ RB_SHADER_CHANGES ]++;
} }
} }
@ -144,6 +146,7 @@ static void DrawDynamicLight()
R_BindAnimatedImage( &pStage->bundle ); R_BindAnimatedImage( &pStage->bundle );
glDrawElements( GL_TRIANGLES, tess.dlNumIndexes, GL_INDEX_TYPE, tess.dlIndexes ); glDrawElements( GL_TRIANGLES, tess.dlNumIndexes, GL_INDEX_TYPE, tess.dlIndexes );
backEnd.pc3D[ RB_DRAW_CALLS ]++;
glUnlockArraysEXT(); glUnlockArraysEXT();
@ -168,6 +171,7 @@ static qbool GL2_StageIterator_MultitextureStage( int stage )
glTexCoordPointer( 2, GL_FLOAT, 0, tess.svars[stage].texcoordsptr ); glTexCoordPointer( 2, GL_FLOAT, 0, tess.svars[stage].texcoordsptr );
glDrawElements( GL_TRIANGLES, tess.numIndexes, GL_INDEX_TYPE, tess.indexes ); glDrawElements( GL_TRIANGLES, tess.numIndexes, GL_INDEX_TYPE, tess.indexes );
backEnd.pc3D[ RB_DRAW_CALLS ]++;
glDisable( GL_TEXTURE_2D ); glDisable( GL_TEXTURE_2D );
GL_SelectTexture( 0 ); GL_SelectTexture( 0 );
@ -215,6 +219,7 @@ static void DrawGeneric()
} }
glDrawElements( GL_TRIANGLES, tess.numIndexes, GL_INDEX_TYPE, tess.indexes ); glDrawElements( GL_TRIANGLES, tess.numIndexes, GL_INDEX_TYPE, tess.indexes );
backEnd.pc3D[ RB_DRAW_CALLS ]++;
} }
if ( tess.drawFog ) if ( tess.drawFog )
@ -801,6 +806,7 @@ static void GL2_EndFrame()
static void ID_INLINE R_DrawElements( int numIndexes, const unsigned int* indexes ) static void ID_INLINE R_DrawElements( int numIndexes, const unsigned int* indexes )
{ {
glDrawElements( GL_TRIANGLES, numIndexes, GL_INDEX_TYPE, indexes ); glDrawElements( GL_TRIANGLES, numIndexes, GL_INDEX_TYPE, indexes );
backEnd.pc3D[ RB_DRAW_CALLS ]++;
} }

View file

@ -1160,6 +1160,7 @@ static void ApplyPipeline(PipelineId pipelineId)
Pipeline* const pipeline = &gl.pipelines[pipelineId]; Pipeline* const pipeline = &gl.pipelines[pipelineId];
glUseProgram(pipeline->program.program); glUseProgram(pipeline->program.program);
backEnd.pc3D[RB_SHADER_CHANGES]++;
for(int i = 0; i < VB_COUNT; ++i) for(int i = 0; i < VB_COUNT; ++i)
{ {
@ -1726,6 +1727,7 @@ static void CreateGeometryBufferStorage(ArrayBuffer* buffer)
static void DrawElements(int indexCount) static void DrawElements(int indexCount)
{ {
glDrawElements(GL_TRIANGLES, indexCount, GL_UNSIGNED_INT, (const GLvoid*)(GLintptr)(gl.indexBuffer.readIndex * gl.indexBuffer.itemSize)); glDrawElements(GL_TRIANGLES, indexCount, GL_UNSIGNED_INT, (const GLvoid*)(GLintptr)(gl.indexBuffer.readIndex * gl.indexBuffer.itemSize));
backEnd.pc3D[RB_DRAW_CALLS]++;
} }
static void SetDefaultState() static void SetDefaultState()
@ -2168,6 +2170,7 @@ static void GAL_EndFrame()
gl.fbReadIndex ^= 1; gl.fbReadIndex ^= 1;
FBO_Bind(&gl.fbSS[gl.fbReadIndex]); FBO_Bind(&gl.fbSS[gl.fbReadIndex]);
glDrawArrays(GL_TRIANGLES, 0, 3); glDrawArrays(GL_TRIANGLES, 0, 3);
backEnd.pc3D[RB_DRAW_CALLS]++;
ApplyViewportAndScissor(0, 0, glInfo.winWidth, glInfo.winHeight); ApplyViewportAndScissor(0, 0, glInfo.winWidth, glInfo.winHeight);
FBO_BlitToBackBuffer(); FBO_BlitToBackBuffer();

View file

@ -76,6 +76,8 @@ enum {
RB_INDICES, RB_INDICES,
RB_SURFACES, RB_SURFACES,
RB_BATCHES, RB_BATCHES,
RB_SHADER_CHANGES, // vertex + pixel shader combos, not Q3 shaders
RB_DRAW_CALLS, // dispatched API draw calls
RB_LIT_VERTICES, RB_LIT_VERTICES,
RB_LIT_INDICES, RB_LIT_INDICES,