Skip to content
Snippets Groups Projects
Commit c76c35a9 authored by Tomi Korpipää's avatar Tomi Korpipää
Browse files

Add logging for actual scene statistics

Get scene statistic from renderStats extended data
and use them instead of the artifically calculated ones.
This feature is supported from Qt 6.5 onwards.
parent 2e963103
No related branches found
No related tags found
No related merge requests found
...@@ -25,6 +25,11 @@ Item { ...@@ -25,6 +25,11 @@ Item {
property real renderTime: source === null ? 0 : source.renderStats.renderTime property real renderTime: source === null ? 0 : source.renderStats.renderTime
property real syncTime: source === null ? 0 : source.renderStats.syncTime property real syncTime: source === null ? 0 : source.renderStats.syncTime
property int fps: source === null ? 0 : source.renderStats.fps property int fps: source === null ? 0 : source.renderStats.fps
property int drawCallCount: source === null ? 0 : source.renderStats.drawCallCount
property int drawVertexCount: source === null ? 0 : source.renderStats.drawVertexCount
property int imageDataSize: source === null ? 0 : source.renderStats.imageDataSize
property int meshDataSize: source === null ? 0 : source.renderStats.meshDataSize
property int renderPassCount: source === null ? 0 : source.renderStats.renderPassCount
// min/max // min/max
property real maxFrameTime: 0 property real maxFrameTime: 0
...@@ -130,6 +135,7 @@ Item { ...@@ -130,6 +135,7 @@ Item {
interval: 5000 interval: 5000
running: false running: false
onTriggered: { onTriggered: {
source.renderStats.extendedDataCollectionEnabled = (QtVersion[0] == 6 && QtVersion[1] >= 5)
reset(); reset();
measureTimer.start(); measureTimer.start();
} }
...@@ -155,91 +161,101 @@ Item { ...@@ -155,91 +161,101 @@ Item {
measurementLog += "\nMaximum Sync Time: " + maxSyncTime; measurementLog += "\nMaximum Sync Time: " + maxSyncTime;
for (var i = 0; i < config.length; ++i) for (var i = 0; i < config.length; ++i)
measurementLog += "\n" + config[i]; measurementLog += "\n" + config[i];
if (reportModelStats) { if (reportModelStats || (QtVersion[0] == 6 && QtVersion[1] >= 5)) {
measurementLog += "\nModel statistics:\n"; if (QtVersion[0] == 6 && QtVersion[1] >= 5) {
var drawCalls = 0; measurementLog += "\nScene statistics:";
var shadowDrawCalls = 0; measurementLog += "\n - draw calls: " + drawCallCount;
var aoDrawCalls = 0; measurementLog += "\n - vertices: " + drawVertexCount;
var skyboxDrawCalls = 0; measurementLog += "\n - triangles: " + drawVertexCount / 3;
switch (benchmarkRoot.modelIndex) { measurementLog += "\n - render passes: " + renderPassCount;
case 0: measurementLog += "\n - image data: " + imageDataSize + " bytes";
measurementLog += "-Model consists of 3 separate meshes of 336 triangles each.\n"; measurementLog += "\n - mesh data: " + meshDataSize + " bytes\n";
measurementLog += "-There is one material used by all meshes.\n"; } else {
drawCalls = (instancing ? 1 : benchmarkRoot.modelInstanceCount) * 3; measurementLog += "\nModel statistics:\n";
measurementLog += "-This results in 3 separate draw calls per model, i.e. " var drawCalls = 0;
+ drawCalls + " draw calls per frame.\n"; var shadowDrawCalls = 0;
if (instancing) { var aoDrawCalls = 0;
measurementLog += "-Due to instancing each draw call draws " var skyboxDrawCalls = 0;
+ benchmarkRoot.modelInstanceCount switch (benchmarkRoot.modelIndex) {
+ " times the original triangle count." case 0:
measurementLog += "-Model consists of 3 separate meshes of 336 triangles each.\n";
measurementLog += "-There is one material used by all meshes.\n";
drawCalls = (instancing ? 1 : benchmarkRoot.modelInstanceCount) * 3;
measurementLog += "-This results in 3 separate draw calls per model, i.e. "
+ drawCalls + " draw calls per frame.\n";
if (instancing) {
measurementLog += "-Due to instancing each draw call draws "
+ benchmarkRoot.modelInstanceCount
+ " times the original triangle count."
}
break;
case 1:
measurementLog += "-Model consists of 5 separate meshes. One has 21196 triangles and the rest 1600 triangles each.\n";
measurementLog += "-There is one material used by all meshes.\n";
drawCalls = (instancing ? 1 : benchmarkRoot.modelInstanceCount) * 5;
measurementLog += "-This results in 5 separate draw calls per model, i.e. "
+ drawCalls + " draw calls per frame.\n";
if (instancing) {
measurementLog += "-Due to instancing each draw call draws "
+ benchmarkRoot.modelInstanceCount
+ " times the original triangle count."
}
break;
case 2:
measurementLog += "-Model consists of 5 separate meshes. One has 81734 triangles and the rest 1600 triangles each.\n";
measurementLog += "-There are 10 materials used by one mesh and 1 used by the rest.\n";
drawCalls = (instancing ? 1 : benchmarkRoot.modelInstanceCount) * 14;
measurementLog += "-This results in 14 separate draw calls per model, i.e. "
+ drawCalls + " draw calls per frame.\n";
if (instancing) {
measurementLog += "-Due to instancing each draw call draws "
+ benchmarkRoot.modelInstanceCount
+ " times the original triangle count."
}
break;
case 3:
measurementLog += "-Model consists of 5 separate meshes. One has 154397 triangles and the rest 1600 triangles each.\n";
measurementLog += "-There are 10 materials used by one mesh and 1 used by the rest.\n";
drawCalls = (instancing ? 1 : benchmarkRoot.modelInstanceCount) * 14;
measurementLog += "-This results in 14 separate draw calls per model, i.e. "
+ drawCalls + " draw calls per frame.\n";
if (instancing) {
measurementLog += "-Due to instancing each draw call draws "
+ benchmarkRoot.modelInstanceCount
+ " times the original triangle count."
}
break;
case 4:
measurementLog += "-Model consists of 5 separate meshes. One has 879892 triangles and the rest 1600 triangles each.\n";
measurementLog += "-There are 10 materials used by one mesh and 1 used by the rest.\n";
drawCalls = (instancing ? 1 : benchmarkRoot.modelInstanceCount) * 14;
measurementLog += "-This results in 14 separate draw calls per model, i.e. "
+ drawCalls + " draw calls per frame.\n";
if (instancing) {
measurementLog += "-Due to instancing each draw call draws "
+ benchmarkRoot.modelInstanceCount
+ " times the original triangle count."
}
break;
} }
break; if (benchmarkRoot.skyboxEnabled && benchmarkRoot.iblEnabled) {
case 1: skyboxDrawCalls = 1;
measurementLog += "-Model consists of 5 separate meshes. One has 21196 triangles and the rest 1600 triangles each.\n"; measurementLog += "-Taking skybox into account there are "
measurementLog += "-There is one material used by all meshes.\n"; + (drawCalls + skyboxDrawCalls)
drawCalls = (instancing ? 1 : benchmarkRoot.modelInstanceCount) * 5; + " draw calls per frame.\n";
measurementLog += "-This results in 5 separate draw calls per model, i.e. "
+ drawCalls + " draw calls per frame.\n";
if (instancing) {
measurementLog += "-Due to instancing each draw call draws "
+ benchmarkRoot.modelInstanceCount
+ " times the original triangle count."
} }
break; if (benchmarkRoot.shadowsEnabled) {
case 2: shadowDrawCalls = benchmarkRoot.lightTypeIndex === 0 ? drawCalls : 6 * drawCalls;
measurementLog += "-Model consists of 5 separate meshes. One has 81734 triangles and the rest 1600 triangles each.\n"; measurementLog += "-Taking shadows into account there are "
measurementLog += "-There are 10 materials used by one mesh and 1 used by the rest.\n"; + (drawCalls + skyboxDrawCalls + shadowDrawCalls)
drawCalls = (instancing ? 1 : benchmarkRoot.modelInstanceCount) * 14; + " draw calls per frame.\n";
measurementLog += "-This results in 14 separate draw calls per model, i.e. "
+ drawCalls + " draw calls per frame.\n";
if (instancing) {
measurementLog += "-Due to instancing each draw call draws "
+ benchmarkRoot.modelInstanceCount
+ " times the original triangle count."
} }
break; if (benchmarkRoot.aoEnabled) {
case 3: aoDrawCalls = drawCalls;
measurementLog += "-Model consists of 5 separate meshes. One has 154397 triangles and the rest 1600 triangles each.\n"; measurementLog += "-Taking ambient occlusion into account there are "
measurementLog += "-There are 10 materials used by one mesh and 1 used by the rest.\n"; + (drawCalls + skyboxDrawCalls + shadowDrawCalls + aoDrawCalls)
drawCalls = (instancing ? 1 : benchmarkRoot.modelInstanceCount) * 14; + " draw calls per frame, " + aoDrawCalls + " being depth-only.\n";
measurementLog += "-This results in 14 separate draw calls per model, i.e. "
+ drawCalls + " draw calls per frame.\n";
if (instancing) {
measurementLog += "-Due to instancing each draw call draws "
+ benchmarkRoot.modelInstanceCount
+ " times the original triangle count."
} }
break;
case 4:
measurementLog += "-Model consists of 5 separate meshes. One has 879892 triangles and the rest 1600 triangles each.\n";
measurementLog += "-There are 10 materials used by one mesh and 1 used by the rest.\n";
drawCalls = (instancing ? 1 : benchmarkRoot.modelInstanceCount) * 14;
measurementLog += "-This results in 14 separate draw calls per model, i.e. "
+ drawCalls + " draw calls per frame.\n";
if (instancing) {
measurementLog += "-Due to instancing each draw call draws "
+ benchmarkRoot.modelInstanceCount
+ " times the original triangle count."
}
break;
}
if (benchmarkRoot.skyboxEnabled && benchmarkRoot.iblEnabled) {
skyboxDrawCalls = 1;
measurementLog += "-Taking skybox into account there are "
+ (drawCalls + skyboxDrawCalls)
+ " draw calls per frame.\n";
}
if (benchmarkRoot.shadowsEnabled) {
shadowDrawCalls = benchmarkRoot.lightTypeIndex === 0 ? drawCalls : 6 * drawCalls;
measurementLog += "-Taking shadows into account there are "
+ (drawCalls + skyboxDrawCalls + shadowDrawCalls)
+ " draw calls per frame.\n";
}
if (benchmarkRoot.aoEnabled) {
aoDrawCalls = drawCalls;
measurementLog += "-Taking ambient occlusion into account there are "
+ (drawCalls + skyboxDrawCalls + shadowDrawCalls + aoDrawCalls)
+ " draw calls per frame, " + aoDrawCalls + " being depth-only.\n";
} }
} }
if (singleReportMode) if (singleReportMode)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment