summaryrefslogtreecommitdiffstats
path: root/src/gui/rhi/qrhid3d11.cpp
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2022-06-10 12:08:54 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2022-07-05 13:04:09 +0200
commit6ec339c4844125ba2f1330d07c520437ae73ec0b (patch)
tree0a451d7557303a2bd93f4d401e06decd1f2b7e4c /src/gui/rhi/qrhid3d11.cpp
parenta09e518f6589fff7789ad7224badf24593240711 (diff)
rhi: Keep track of pipeline creation times
Make our QRhiMemAllocStats struct a bit more generic, drop the memory allocation part in the naming, and use the same getter and struct for reporting some important timings. (we are free to rename for now, there are no users in other modules yet) The time spent in graphics (or compute) pipeline creation has a special relevance in particular with the modern APIs (as it is the single biggest potentially time consuming blocking operation), but also highly interesting with others like D3D11 simply because that's where we do the expensive source-to-intermediate compilation is HLSL source is provided. In order to see the effects of the various caching mechanisms (of which there can be confusingly many, on multiple levels), the ability to see how much time we spent on pipeline creation e.g. until we render the first view of an application can be pretty essential. Task-number: QTBUG-103802 Change-Id: I85dd056a39db7e6b25fb1f9d02e4c94298d22b41 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/gui/rhi/qrhid3d11.cpp')
-rw-r--r--src/gui/rhi/qrhid3d11.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/gui/rhi/qrhid3d11.cpp b/src/gui/rhi/qrhid3d11.cpp
index 0ac92e2266..fddef52cee 100644
--- a/src/gui/rhi/qrhid3d11.cpp
+++ b/src/gui/rhi/qrhid3d11.cpp
@@ -615,9 +615,11 @@ QRhiDriverInfo QRhiD3D11::driverInfo() const
return driverInfoStruct;
}
-QRhiMemAllocStats QRhiD3D11::graphicsMemoryAllocationStatistics()
+QRhiStats QRhiD3D11::statistics()
{
- return {};
+ QRhiStats result;
+ result.totalPipelineCreationTime = totalPipelineCreationTime();
+ return result;
}
bool QRhiD3D11::makeThreadLocalNativeContextCurrent()
@@ -4252,6 +4254,7 @@ bool QD3D11GraphicsPipeline::create()
destroy();
QRHI_RES_RHI(QRhiD3D11);
+ rhiD->pipelineCreationStart();
if (!rhiD->sanityCheckGraphicsPipeline(this))
return false;
@@ -4438,6 +4441,7 @@ bool QD3D11GraphicsPipeline::create()
} // else leave inputLayout set to nullptr; that's valid and it avoids a debug layer warning about an input layout with 0 elements
}
+ rhiD->pipelineCreationEnd();
generation += 1;
rhiD->registerResource(this);
return true;
@@ -4473,6 +4477,7 @@ bool QD3D11ComputePipeline::create()
destroy();
QRHI_RES_RHI(QRhiD3D11);
+ rhiD->pipelineCreationStart();
auto cacheIt = rhiD->m_shaderCache.constFind(m_shaderStage);
if (cacheIt != rhiD->m_shaderCache.constEnd()) {
@@ -4508,6 +4513,7 @@ bool QD3D11ComputePipeline::create()
cs.shader->AddRef();
+ rhiD->pipelineCreationEnd();
generation += 1;
rhiD->registerResource(this);
return true;