mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Expose to counters fro drawcalls, one for the API drawcalls and the other for gpu drawcalls spawned
This commit is contained in:
parent
f09593e106
commit
6213e0859d
5 changed files with 22 additions and 7 deletions
|
@ -122,13 +122,13 @@ Item {
|
|||
plots: [
|
||||
{
|
||||
prop: "frameTriangleCount",
|
||||
label: "Frame",
|
||||
color: "#E2334D"
|
||||
label: "Triangles",
|
||||
color: "#1AC567"
|
||||
},
|
||||
{
|
||||
prop: "frameTriangleRate",
|
||||
label: "rate",
|
||||
color: "#1AC567",
|
||||
color: "#E2334D",
|
||||
scale: 0.001,
|
||||
unit: "MT/s"
|
||||
}
|
||||
|
@ -140,15 +140,20 @@ Item {
|
|||
object: stats.config
|
||||
trigger: stats.config["frameDrawcallCount"]
|
||||
plots: [
|
||||
{
|
||||
prop: "frameAPIDrawcallCount",
|
||||
label: "API Drawcalls",
|
||||
color: "#00B4EF"
|
||||
},
|
||||
{
|
||||
prop: "frameDrawcallCount",
|
||||
label: "Frame",
|
||||
color: "#E2334D"
|
||||
label: "GPU Drawcalls",
|
||||
color: "#1AC567"
|
||||
},
|
||||
{
|
||||
prop: "frameDrawcallRate",
|
||||
label: "rate",
|
||||
color: "#1AC567",
|
||||
color: "#E2334D",
|
||||
scale: 0.001,
|
||||
unit: "K/s"
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ public:
|
|||
|
||||
int _RSNumTextureBounded = 0;
|
||||
|
||||
int _DSNumAPIDrawcalls = 0;
|
||||
int _DSNumDrawcalls = 0;
|
||||
int _DSNumTriangles = 0;
|
||||
|
||||
|
|
|
@ -326,6 +326,7 @@ void GLBackend::do_draw(Batch& batch, size_t paramOffset) {
|
|||
glDrawArrays(mode, startVertex, numVertices);
|
||||
_stats._DSNumTriangles += numVertices / 3;
|
||||
_stats._DSNumDrawcalls++;
|
||||
_stats._DSNumAPIDrawcalls++;
|
||||
|
||||
(void)CHECK_GL_ERROR();
|
||||
}
|
||||
|
@ -344,6 +345,7 @@ void GLBackend::do_drawIndexed(Batch& batch, size_t paramOffset) {
|
|||
glDrawElements(mode, numIndices, glType, indexBufferByteOffset);
|
||||
_stats._DSNumTriangles += numIndices / 3;
|
||||
_stats._DSNumDrawcalls++;
|
||||
_stats._DSNumAPIDrawcalls++;
|
||||
|
||||
(void) CHECK_GL_ERROR();
|
||||
}
|
||||
|
@ -358,6 +360,7 @@ void GLBackend::do_drawInstanced(Batch& batch, size_t paramOffset) {
|
|||
glDrawArraysInstancedARB(mode, startVertex, numVertices, numInstances);
|
||||
_stats._DSNumTriangles += (numInstances * numVertices) / 3;
|
||||
_stats._DSNumDrawcalls += numInstances;
|
||||
_stats._DSNumAPIDrawcalls++;
|
||||
|
||||
(void) CHECK_GL_ERROR();
|
||||
}
|
||||
|
@ -383,6 +386,7 @@ void GLBackend::do_drawIndexedInstanced(Batch& batch, size_t paramOffset) {
|
|||
#endif
|
||||
_stats._DSNumTriangles += (numInstances * numIndices) / 3;
|
||||
_stats._DSNumDrawcalls += numInstances;
|
||||
_stats._DSNumAPIDrawcalls++;
|
||||
|
||||
(void)CHECK_GL_ERROR();
|
||||
}
|
||||
|
@ -395,6 +399,8 @@ void GLBackend::do_multiDrawIndirect(Batch& batch, size_t paramOffset) {
|
|||
|
||||
glMultiDrawArraysIndirect(mode, reinterpret_cast<GLvoid*>(_input._indirectBufferOffset), commandCount, (GLsizei)_input._indirectBufferStride);
|
||||
_stats._DSNumDrawcalls += commandCount;
|
||||
_stats._DSNumAPIDrawcalls++;
|
||||
|
||||
#else
|
||||
// FIXME implement the slow path
|
||||
#endif
|
||||
|
@ -410,7 +416,7 @@ void GLBackend::do_multiDrawIndexedIndirect(Batch& batch, size_t paramOffset) {
|
|||
|
||||
glMultiDrawElementsIndirect(mode, indexType, reinterpret_cast<GLvoid*>(_input._indirectBufferOffset), commandCount, (GLsizei)_input._indirectBufferStride);
|
||||
_stats._DSNumDrawcalls += commandCount;
|
||||
|
||||
_stats._DSNumAPIDrawcalls++;
|
||||
#else
|
||||
// FIXME implement the slow path
|
||||
#endif
|
||||
|
|
|
@ -36,6 +36,7 @@ void EngineStats::run(const SceneContextPointer& sceneContext, const RenderConte
|
|||
gpu::ContextStats gpuStats(_gpuStats);
|
||||
renderContext->args->_context->getStats(_gpuStats);
|
||||
|
||||
config->frameAPIDrawcallCount = _gpuStats._DSNumAPIDrawcalls - gpuStats._DSNumAPIDrawcalls;
|
||||
config->frameDrawcallCount = _gpuStats._DSNumDrawcalls - gpuStats._DSNumDrawcalls;
|
||||
config->frameDrawcallRate = config->frameDrawcallCount * frequency;
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ namespace render {
|
|||
Q_PROPERTY(qint64 textureCPUMemoryUsage MEMBER textureCPUMemoryUsage NOTIFY dirty)
|
||||
Q_PROPERTY(qint64 textureGPUMemoryUsage MEMBER textureGPUMemoryUsage NOTIFY dirty)
|
||||
|
||||
Q_PROPERTY(quint32 frameAPIDrawcallCount MEMBER frameAPIDrawcallCount NOTIFY dirty)
|
||||
Q_PROPERTY(quint32 frameDrawcallCount MEMBER frameDrawcallCount NOTIFY dirty)
|
||||
Q_PROPERTY(quint32 frameDrawcallRate MEMBER frameDrawcallRate NOTIFY dirty)
|
||||
|
||||
|
@ -57,6 +58,7 @@ namespace render {
|
|||
qint64 textureCPUMemoryUsage{ 0 };
|
||||
qint64 textureGPUMemoryUsage{ 0 };
|
||||
|
||||
quint32 frameAPIDrawcallCount{ 0 };
|
||||
quint32 frameDrawcallCount{ 0 };
|
||||
quint32 frameDrawcallRate{ 0 };
|
||||
|
||||
|
|
Loading…
Reference in a new issue