diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2021-12-17 17:04:38 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2022-01-04 13:00:40 +0100 |
commit | 23f8d6c57f8d599b8b9542586801964d10cf8fba (patch) | |
tree | 3c0fe3e7b3cb808afcd828687e3613c57b3b9a41 /src/gui/rhi/qrhi_p.h | |
parent | dcc2704d17bda08e6dc7783559ccbfd864dd4339 (diff) |
rhi: Drop the profiler for now
The system we inherited from the original Qt 5.14 introduction of QRhi
is a text stream based solution where resource creation and frame
timings are sent in a comma-separated format to a QIODevice.
This, while useful to get insights about the number of resources at a
given time, is not actively helpful. The frameworks built on top (Qt
Quick, Qt Quick 3D) are expected to provide solutions for logging
timings in a different way (e.g. via the QML Profiler). Similarly,
tracking active resources and generating statistics from that is
better handled on a higher level.
The unique bits, such as the Vulkan memory allocator statistics and
the GPU frame timestamps, are converted into APIs in QRhi. This way a
user of QRhi can query it at any time and do whatever it sees fit with
the data.
When it comes to the GPU timestamps, that has a somewhat limited value
due to the heavy asynchronousness, hence the callback based
API. Nonetheless, this is still useful since it is the only means of
reporting some frame timing data (an approx. elapsed milliseconds for
a frame) from the GPU side.
Change-Id: I67cd58b81aaa7e343c11731f9aa5b4804c2a1823
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/gui/rhi/qrhi_p.h')
-rw-r--r-- | src/gui/rhi/qrhi_p.h | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/gui/rhi/qrhi_p.h b/src/gui/rhi/qrhi_p.h index 7a3bfff0c7..7aae71771e 100644 --- a/src/gui/rhi/qrhi_p.h +++ b/src/gui/rhi/qrhi_p.h @@ -74,7 +74,6 @@ class QRhiSampler; class QRhiCommandBuffer; class QRhiResourceUpdateBatch; class QRhiResourceUpdateBatchPrivate; -class QRhiProfiler; class Q_GUI_EXPORT QRhiDepthStencilClearValue { @@ -1541,6 +1540,20 @@ Q_DECLARE_TYPEINFO(QRhiDriverInfo, Q_RELOCATABLE_TYPE); Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiDriverInfo &); #endif +struct Q_GUI_EXPORT QRhiMemAllocStats +{ + quint32 blockCount = 0; + quint32 allocCount = 0; + quint64 usedBytes = 0; + quint64 unusedBytes = 0; +}; + +Q_DECLARE_TYPEINFO(QRhiMemAllocStats, Q_RELOCATABLE_TYPE); + +#ifndef QT_NO_DEBUG_STREAM +Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiMemAllocStats &); +#endif + struct Q_GUI_EXPORT QRhiInitParams { }; @@ -1645,6 +1658,9 @@ public: void addCleanupCallback(const CleanupCallback &callback); void runCleanup(); + using GpuFrameTimeCallback = std::function<void(float t)>; + void addGpuFrameTimeCallback(const GpuFrameTimeCallback &callback); + QRhiGraphicsPipeline *newGraphicsPipeline(); QRhiComputePipeline *newComputePipeline(); QRhiShaderResourceBindings *newShaderResourceBindings(); @@ -1719,8 +1735,6 @@ public: const QRhiNativeHandles *nativeHandles(); bool makeThreadLocalNativeContextCurrent(); - QRhiProfiler *profiler(); - static const int MAX_MIP_LEVELS = 16; // a width and/or height of 65536 should be enough for everyone void releaseCachedResources(); @@ -1730,6 +1744,8 @@ public: QByteArray pipelineCacheData(); void setPipelineCacheData(const QByteArray &data); + QRhiMemAllocStats graphicsMemoryAllocationStatistics() const; + protected: QRhi(); |