summaryrefslogtreecommitdiffstats
path: root/src/gui/rhi/qrhi_p.h
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2023-04-03 19:18:59 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2023-04-18 15:35:28 +0200
commite539e9a7afacc330117a761e0ee55d6452cffaca (patch)
tree169646118e75acc84663190e41f97efd42c627cd /src/gui/rhi/qrhi_p.h
parent62a4ca773a9e8a2f0c993c159c045f2794078aad (diff)
rhi: Replace the temporary GPU time query API with a saner one
Modeled after Metal's cb.GPUStart/EndTime. Implemented with timestamp queries for other APIs. Implemented for Metal, D3D11, Vulkan for now. No more callback, just a getter on the command buffer which returns the latest known value, referring to some previous frame. This makes it a lot more usable than the original solution that is not really used anywhere at the moment. Now works for offscreen "frames" as well, this was not implemented before. Opt in with a new QRhi::create() flag because we cannot tell in advance if the getter will be called or not, and this way we can skip recording the timestamps by default. The cost is probably minimal, though. Qt Quick will set this automatically when running with QSG_RHI_PROFILE=1. Change-Id: I903779984a4e0bbf1d03806d04bf61571ce23d72 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.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/gui/rhi/qrhi_p.h b/src/gui/rhi/qrhi_p.h
index 8f7fce18ea..4af1dc746f 100644
--- a/src/gui/rhi/qrhi_p.h
+++ b/src/gui/rhi/qrhi_p.h
@@ -1666,6 +1666,8 @@ public:
void beginExternal();
void endExternal();
+ double lastCompletedGpuTime();
+
protected:
QRhiCommandBuffer(QRhiImplementation *rhi);
};
@@ -1768,7 +1770,8 @@ public:
enum Flag {
EnableDebugMarkers = 1 << 0,
PreferSoftwareRenderer = 1 << 1,
- EnablePipelineCacheDataSave = 1 << 2
+ EnablePipelineCacheDataSave = 1 << 2,
+ EnableTimestamps = 1 << 3
};
Q_DECLARE_FLAGS(Flags, Flag)
@@ -1866,9 +1869,6 @@ 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();