diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2022-06-10 12:08:54 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2022-07-05 13:04:09 +0200 |
commit | 6ec339c4844125ba2f1330d07c520437ae73ec0b (patch) | |
tree | 0a451d7557303a2bd93f4d401e06decd1f2b7e4c /src/gui/rhi/qrhimetal.mm | |
parent | a09e518f6589fff7789ad7224badf24593240711 (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/qrhimetal.mm')
-rw-r--r-- | src/gui/rhi/qrhimetal.mm | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/gui/rhi/qrhimetal.mm b/src/gui/rhi/qrhimetal.mm index 6e469f5b6d..1a9ae651a3 100644 --- a/src/gui/rhi/qrhimetal.mm +++ b/src/gui/rhi/qrhimetal.mm @@ -658,9 +658,11 @@ QRhiDriverInfo QRhiMetal::driverInfo() const return driverInfoStruct; } -QRhiMemAllocStats QRhiMetal::graphicsMemoryAllocationStatistics() +QRhiStats QRhiMetal::statistics() { - return {}; + QRhiStats result; + result.totalPipelineCreationTime = totalPipelineCreationTime(); + return result; } bool QRhiMetal::makeThreadLocalNativeContextCurrent() @@ -3586,6 +3588,7 @@ bool QMetalGraphicsPipeline::create() destroy(); QRHI_RES_RHI(QRhiMetal); + rhiD->pipelineCreationStart(); if (!rhiD->sanityCheckGraphicsPipeline(this)) return false; @@ -3772,6 +3775,7 @@ bool QMetalGraphicsPipeline::create() d->depthBias = float(m_depthBias); d->slopeScaledDepthBias = m_slopeScaledDepthBias; + rhiD->pipelineCreationEnd(); lastActiveFrameSlot = -1; generation += 1; rhiD->registerResource(this); @@ -3811,6 +3815,7 @@ bool QMetalComputePipeline::create() destroy(); QRHI_RES_RHI(QRhiMetal); + rhiD->pipelineCreationStart(); auto cacheIt = rhiD->d->shaderCache.constFind(m_shaderStage); if (cacheIt != rhiD->d->shaderCache.constEnd()) { @@ -3858,6 +3863,7 @@ bool QMetalComputePipeline::create() return false; } + rhiD->pipelineCreationEnd(); lastActiveFrameSlot = -1; generation += 1; rhiD->registerResource(this); |