summaryrefslogtreecommitdiffstats
path: root/src/gui/rhi/qrhid3d12_p.h
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2023-07-17 12:28:13 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2023-07-31 12:38:40 +0200
commiteb99d19cc4346ac92f7876e94f245f786987391b (patch)
tree7f58a5b2cad76e071109ffc1b2a27b9607f70948 /src/gui/rhi/qrhid3d12_p.h
parent95ed8d1fd9ccc5270b825550085c3a3df2830d5c (diff)
rhi: d3d12: Implement lastCompletedGpuTime via timestamp queries
Change-Id: I5f2588268cf4d52025f9b1c8d94cdcd9a742531c Reviewed-by: Andy Nichols <andy.nichols@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src/gui/rhi/qrhid3d12_p.h')
-rw-r--r--src/gui/rhi/qrhid3d12_p.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/gui/rhi/qrhid3d12_p.h b/src/gui/rhi/qrhid3d12_p.h
index bfc2f530db..5f9253c7a7 100644
--- a/src/gui/rhi/qrhid3d12_p.h
+++ b/src/gui/rhi/qrhid3d12_p.h
@@ -119,6 +119,18 @@ struct QD3D12CpuDescriptorPool
const char *debugName;
};
+struct QD3D12QueryHeap
+{
+ bool isValid() const { return heap && capacity; }
+ bool create(ID3D12Device *device,
+ quint32 queryCount,
+ D3D12_QUERY_HEAP_TYPE heapType);
+ void destroy();
+
+ ID3D12QueryHeap *heap = nullptr;
+ quint32 capacity = 0;
+};
+
struct QD3D12StagingArea
{
static const quint32 ALIGNMENT = D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT; // 512 so good enough both for cb and texdata
@@ -931,9 +943,11 @@ struct QD3D12CommandBuffer : public QRhiCommandBuffer
currentVertexOffsets = {};
}
+ // per-frame
PassType recordingPass;
QRhiRenderTarget *currentTarget;
+ // per-pass
QD3D12GraphicsPipeline *currentGraphicsPipeline;
QD3D12ComputePipeline *currentComputePipeline;
uint currentPipelineGeneration;
@@ -945,6 +959,9 @@ struct QD3D12CommandBuffer : public QRhiCommandBuffer
DXGI_FORMAT currentIndexFormat;
std::array<QD3D12ObjectHandle, D3D12_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT> currentVertexBuffers;
std::array<quint32, D3D12_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT> currentVertexOffsets;
+
+ // global
+ double lastGpuTime = 0;
};
struct QD3D12SwapChain : public QRhiSwapChain
@@ -1169,6 +1186,9 @@ public:
QD3D12MipmapGenerator mipmapGen;
QD3D12StagingArea smallStagingAreas[QD3D12_FRAMES_IN_FLIGHT];
QD3D12ShaderVisibleDescriptorHeap shaderVisibleCbvSrvUavHeap;
+ UINT64 timestampTicksPerSecond = 0;
+ QD3D12QueryHeap timestampQueryHeap;
+ QD3D12StagingArea timestampReadbackArea;
IDCompositionDevice *dcompDevice = nullptr;
QD3D12SwapChain *currentSwapChain = nullptr;
QSet<QD3D12SwapChain *> swapchains;