summaryrefslogtreecommitdiffstats
path: root/src/gui/rhi/qrhinull_p_p.h
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2022-04-01 15:01:45 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2022-04-05 19:40:17 +0200
commita5db072dc2e85be1c8c6411b67844a53fafcb522 (patch)
tree5506ec12a8d2b6a121f5ed002d54b8105137c1a4 /src/gui/rhi/qrhinull_p_p.h
parentd72f2ca9ea5e8bc7357f457370b2eb039bb48a2f (diff)
rhi: Add explicit subclass for RTs from swapchains
We want to enable gaining access to the underlying resource(s) by inspecting a QRhiRenderTarget. This is not currently possible for swapchains since there is nothing that references the actual QRhiSwapChain. To clean this up, make an explicit, new QRhiSwapChainRenderTarget subclass. Thus the logic already used in a couple of places to examine the resources attached to a QRhiTextureRenderTarget can now work with swapchain render targets too, by branching based on the resourceType(). This eliminates the somewhat odd setup where a "RenderTarget" resource is QRhiRenderTarget corresponding (but not exposing!) a swapchain, whereas a "TextureRenderTarget" is a QRhiTextureRenderTarget which is a subclass of QRhiRenderTarget. Now we correctly have an (abstract) base and two subclasses, one for each type of render targets. Besides, it allows us to clean up the oddly named Q...ReferenceRenderTarget classes in the backends, which initially tried to indicate that this "render target" merely references (or, in practice, is) a swapchain. We can now have a nice and symmetrical Q...SwapChainRenderTarget and Q...TextureRenderTarget naming scheme. Change-Id: Ib07e9be99a316eec67b94de0860e08f5f4638959 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/gui/rhi/qrhinull_p_p.h')
-rw-r--r--src/gui/rhi/qrhinull_p_p.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/gui/rhi/qrhinull_p_p.h b/src/gui/rhi/qrhinull_p_p.h
index 90c448dd24..b43cbc7687 100644
--- a/src/gui/rhi/qrhinull_p_p.h
+++ b/src/gui/rhi/qrhinull_p_p.h
@@ -124,10 +124,10 @@ struct QNullRenderTargetData
QRhiRenderTargetAttachmentTracker::ResIdList currentResIdList;
};
-struct QNullReferenceRenderTarget : public QRhiRenderTarget
+struct QNullSwapChainRenderTarget : public QRhiSwapChainRenderTarget
{
- QNullReferenceRenderTarget(QRhiImplementation *rhi);
- ~QNullReferenceRenderTarget();
+ QNullSwapChainRenderTarget(QRhiImplementation *rhi, QRhiSwapChain *swapchain);
+ ~QNullSwapChainRenderTarget();
void destroy() override;
QSize pixelSize() const override;
@@ -201,7 +201,7 @@ struct QNullSwapChain : public QRhiSwapChain
bool createOrResize() override;
QWindow *window = nullptr;
- QNullReferenceRenderTarget rt;
+ QNullSwapChainRenderTarget rt;
QNullCommandBuffer cb;
int frameCount = 0;
};