rhi: vulkan: Expose the VkRenderPass via the usual mechanisms
Qt Quick in turn will expose it via QSGRendererInterface. Essential when adding custom Vulkan rendering into a Qt Quick application because the custom pipeline state objects will need to reference a VkRenderPass. Change-Id: Idf4092cfc3937830fb8123164081059b0d8d030e Reviewed-by: Andy Nichols <andy.nichols@qt.io>bb10
parent
d6551fe125
commit
2d7fc7a152
|
|
@ -2246,6 +2246,10 @@ QRhiResource::Type QRhiSampler::resourceType() const
|
|||
\internal
|
||||
\inmodule QtGui
|
||||
\brief Render pass resource.
|
||||
|
||||
A render pass, if such a concept exists in the underlying graphics API, is
|
||||
a collection of attachments (color, depth, stencil) and describes how those
|
||||
attachments are used.
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
|
@ -2264,6 +2268,18 @@ QRhiResource::Type QRhiRenderPassDescriptor::resourceType() const
|
|||
return RenderPassDescriptor;
|
||||
}
|
||||
|
||||
/*!
|
||||
\return a pointer to a backend-specific QRhiNativeHandles subclass, such as
|
||||
QRhiVulkanRenderPassNativeHandles. The returned value is null when exposing
|
||||
the underlying native resources is not supported by the backend.
|
||||
|
||||
\sa QRhiVulkanRenderPassNativeHandles
|
||||
*/
|
||||
const QRhiNativeHandles *QRhiRenderPassDescriptor::nativeHandles()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/*!
|
||||
\class QRhiRenderTarget
|
||||
\internal
|
||||
|
|
|
|||
|
|
@ -843,6 +843,8 @@ class Q_GUI_EXPORT QRhiRenderPassDescriptor : public QRhiResource
|
|||
public:
|
||||
QRhiResource::Type resourceType() const override;
|
||||
|
||||
virtual const QRhiNativeHandles *nativeHandles();
|
||||
|
||||
protected:
|
||||
QRhiRenderPassDescriptor(QRhiImplementation *rhi);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -182,6 +182,13 @@ QT_BEGIN_NAMESPACE
|
|||
\l{QRhi::endOffsrceenFrame()}{endOffscreenFrame()} pair.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\class QRhiVulkanRenderPassNativeHandles
|
||||
\internal
|
||||
\inmodule QtGui
|
||||
\brief Holds the Vulkan render pass object backing a QRhiRenderPassDescriptor.
|
||||
*/
|
||||
|
||||
static inline VkDeviceSize aligned(VkDeviceSize v, VkDeviceSize byteAlign)
|
||||
{
|
||||
return (v + byteAlign - 1) & ~(byteAlign - 1);
|
||||
|
|
@ -5098,6 +5105,12 @@ void QVkRenderPassDescriptor::release()
|
|||
rhiD->unregisterResource(this);
|
||||
}
|
||||
|
||||
const QRhiNativeHandles *QVkRenderPassDescriptor::nativeHandles()
|
||||
{
|
||||
nativeHandlesStruct.renderPass = rp;
|
||||
return &nativeHandlesStruct;
|
||||
}
|
||||
|
||||
QVkReferenceRenderTarget::QVkReferenceRenderTarget(QRhiImplementation *rhi)
|
||||
: QRhiRenderTarget(rhi)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -80,6 +80,11 @@ struct Q_GUI_EXPORT QRhiVulkanCommandBufferNativeHandles : public QRhiNativeHand
|
|||
VkCommandBuffer commandBuffer = VK_NULL_HANDLE;
|
||||
};
|
||||
|
||||
struct Q_GUI_EXPORT QRhiVulkanRenderPassNativeHandles : public QRhiNativeHandles
|
||||
{
|
||||
VkRenderPass renderPass = VK_NULL_HANDLE;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -171,9 +171,11 @@ struct QVkRenderPassDescriptor : public QRhiRenderPassDescriptor
|
|||
QVkRenderPassDescriptor(QRhiImplementation *rhi);
|
||||
~QVkRenderPassDescriptor();
|
||||
void release() override;
|
||||
const QRhiNativeHandles *nativeHandles() override;
|
||||
|
||||
VkRenderPass rp = VK_NULL_HANDLE;
|
||||
bool ownsRp = false;
|
||||
QRhiVulkanRenderPassNativeHandles nativeHandlesStruct;
|
||||
int lastActiveFrameSlot = -1;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue