summaryrefslogtreecommitdiffstats
path: root/src/gui/rhi/qrhivulkan_p_p.h
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2020-09-30 14:08:53 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2020-10-02 13:14:08 +0200
commitd92b0e18c1b987e60304c2e366ff374405adaab1 (patch)
tree07734992c8ce08cedf3214c1893dc033c21c2996 /src/gui/rhi/qrhivulkan_p_p.h
parent3080194ae41128e91da59301a7e221303a2f04a5 (diff)
rhi: Make per-frame flags per-pass where appropriate
ExternalContentsInPass becomes a per-pass flag now. Why is this beneficial? Because while Qt Quick has no choice for its render pass, not being able to guess if the application wants to do some native rendering in there, Quick 3D's render passes, all the ones that are under Quick3D's control, do not have native rendering from the application in them, and so using secondary command buffers with Vulkan is not necessary. Introduce something similar for compute and OpenGL. By knowing that none of the resources used in a pass are used with a compute pass (e.g. because we know that there are no compute passes at all) a small amount of time can be saved by skipping tracking buffers and textures because the only purpose of said tracking is to generate barriers that are relevant only to compute. Change-Id: I0eceb4774d87803c73a39db527f5707a9f4d75c1 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/gui/rhi/qrhivulkan_p_p.h')
-rw-r--r--src/gui/rhi/qrhivulkan_p_p.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/gui/rhi/qrhivulkan_p_p.h b/src/gui/rhi/qrhivulkan_p_p.h
index c590039bc1..a352f3c2f2 100644
--- a/src/gui/rhi/qrhivulkan_p_p.h
+++ b/src/gui/rhi/qrhivulkan_p_p.h
@@ -329,7 +329,6 @@ struct QVkCommandBuffer : public QRhiCommandBuffer
const QRhiNativeHandles *nativeHandles();
VkCommandBuffer cb = VK_NULL_HANDLE; // primary
- bool useSecondaryCb = false;
QRhiVulkanCommandBufferNativeHandles nativeHandlesStruct;
enum PassType {
@@ -340,6 +339,7 @@ struct QVkCommandBuffer : public QRhiCommandBuffer
void resetState() {
recordingPass = NoPass;
+ passUsesSecondaryCb = false;
currentTarget = nullptr;
secondaryCbs.clear();
@@ -365,6 +365,7 @@ struct QVkCommandBuffer : public QRhiCommandBuffer
}
PassType recordingPass;
+ bool passUsesSecondaryCb;
QRhiRenderTarget *currentTarget;
QRhiGraphicsPipeline *currentGraphicsPipeline;
QRhiComputePipeline *currentComputePipeline;
@@ -468,6 +469,7 @@ struct QVkCommandBuffer : public QRhiCommandBuffer
struct {
VkRenderPassBeginInfo desc;
int clearValueIndex;
+ bool useSecondaryCb;
} beginRenderPass;
struct {
} endRenderPass;
@@ -694,7 +696,8 @@ public:
QRhiRenderTarget *rt,
const QColor &colorClearValue,
const QRhiDepthStencilClearValue &depthStencilClearValue,
- QRhiResourceUpdateBatch *resourceUpdates) override;
+ QRhiResourceUpdateBatch *resourceUpdates,
+ QRhiCommandBuffer::BeginPassFlags flags) override;
void endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
void setGraphicsPipeline(QRhiCommandBuffer *cb,
@@ -726,7 +729,9 @@ public:
void debugMarkEnd(QRhiCommandBuffer *cb) override;
void debugMarkMsg(QRhiCommandBuffer *cb, const QByteArray &msg) override;
- void beginComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
+ void beginComputePass(QRhiCommandBuffer *cb,
+ QRhiResourceUpdateBatch *resourceUpdates,
+ QRhiCommandBuffer::BeginPassFlags flags) override;
void endComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
void setComputePipeline(QRhiCommandBuffer *cb, QRhiComputePipeline *ps) override;
void dispatch(QRhiCommandBuffer *cb, int x, int y, int z) override;