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 {
property real renderTime: source === null ? 0 : source.renderStats.renderTime
property real syncTime: source === null ? 0 : source.renderStats.syncTime
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
property real maxFrameTime: 0
......@@ -130,6 +135,7 @@ Item {
interval: 5000
running: false
onTriggered: {
source.renderStats.extendedDataCollectionEnabled = (QtVersion[0] == 6 && QtVersion[1] >= 5)
reset();
measureTimer.start();
}
......@@ -155,91 +161,101 @@ Item {
measurementLog += "\nMaximum Sync Time: " + maxSyncTime;
for (var i = 0; i < config.length; ++i)
measurementLog += "\n" + config[i];
if (reportModelStats) {
measurementLog += "\nModel statistics:\n";
var drawCalls = 0;
var shadowDrawCalls = 0;
var aoDrawCalls = 0;
var skyboxDrawCalls = 0;
switch (benchmarkRoot.modelIndex) {
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."
if (reportModelStats || (QtVersion[0] == 6 && QtVersion[1] >= 5)) {
if (QtVersion[0] == 6 && QtVersion[1] >= 5) {
measurementLog += "\nScene statistics:";
measurementLog += "\n - draw calls: " + drawCallCount;
measurementLog += "\n - vertices: " + drawVertexCount;
measurementLog += "\n - triangles: " + drawVertexCount / 3;
measurementLog += "\n - render passes: " + renderPassCount;
measurementLog += "\n - image data: " + imageDataSize + " bytes";
measurementLog += "\n - mesh data: " + meshDataSize + " bytes\n";
} else {
measurementLog += "\nModel statistics:\n";
var drawCalls = 0;
var shadowDrawCalls = 0;
var aoDrawCalls = 0;
var skyboxDrawCalls = 0;
switch (benchmarkRoot.modelIndex) {
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;
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."
if (benchmarkRoot.skyboxEnabled && benchmarkRoot.iblEnabled) {
skyboxDrawCalls = 1;
measurementLog += "-Taking skybox into account there are "
+ (drawCalls + skyboxDrawCalls)
+ " draw calls per frame.\n";
}
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."
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";
}
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."
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";
}
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)
......
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