diff options
Diffstat (limited to 'src/gui/rhi/qrhivulkan_p_p.h')
-rw-r--r-- | src/gui/rhi/qrhivulkan_p_p.h | 42 |
1 files changed, 32 insertions, 10 deletions
diff --git a/src/gui/rhi/qrhivulkan_p_p.h b/src/gui/rhi/qrhivulkan_p_p.h index d0e1e6758b..6322882569 100644 --- a/src/gui/rhi/qrhivulkan_p_p.h +++ b/src/gui/rhi/qrhivulkan_p_p.h @@ -76,6 +76,7 @@ struct QVkBuffer : public QRhiBuffer ~QVkBuffer(); void release() override; bool build() override; + QRhiBuffer::NativeBuffer nativeBuffer() override; VkBuffer buffers[QVK_FRAMES_IN_FLIGHT]; QVkAlloc allocations[QVK_FRAMES_IN_FLIGHT]; @@ -120,8 +121,8 @@ struct QVkTexture : public QRhiTexture ~QVkTexture(); void release() override; bool build() override; - bool buildFrom(const QRhiNativeHandles *src) override; - const QRhiNativeHandles *nativeHandles() override; + bool buildFrom(NativeTexture src) override; + NativeTexture nativeTexture() override; bool prepareBuild(QSize *adjustedSize = nullptr); bool finishBuild(); @@ -134,7 +135,6 @@ struct QVkTexture : public QRhiTexture QVkAlloc stagingAllocations[QVK_FRAMES_IN_FLIGHT]; VkImageView perLevelImageViews[QRhi::MAX_LEVELS]; bool owns = true; - QRhiVulkanTextureNativeHandles nativeHandlesStruct; struct UsageState { // no tracking of subresource layouts (some operations can keep // subresources in different layouts for some time, but that does not @@ -155,7 +155,7 @@ struct QVkTexture : public QRhiTexture struct QVkSampler : public QRhiSampler { QVkSampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilter, Filter mipmapMode, - AddressMode u, AddressMode v); + AddressMode u, AddressMode v, AddressMode w); ~QVkSampler(); void release() override; bool build() override; @@ -171,10 +171,16 @@ struct QVkRenderPassDescriptor : public QRhiRenderPassDescriptor QVkRenderPassDescriptor(QRhiImplementation *rhi); ~QVkRenderPassDescriptor(); void release() override; + bool isCompatible(const QRhiRenderPassDescriptor *other) const override; const QRhiNativeHandles *nativeHandles() override; VkRenderPass rp = VK_NULL_HANDLE; bool ownsRp = false; + QVarLengthArray<VkAttachmentDescription, 8> attDescs; + QVarLengthArray<VkAttachmentReference, 8> colorRefs; + QVarLengthArray<VkAttachmentReference, 8> resolveRefs; + bool hasDepthStencil = false; + VkAttachmentReference dsRef; QRhiVulkanRenderPassNativeHandles nativeHandlesStruct; int lastActiveFrameSlot = -1; }; @@ -365,6 +371,13 @@ struct QVkCommandBuffer : public QRhiCommandBuffer QVarLengthArray<VkCommandBuffer, 4> secondaryCbs; bool inExternal; + struct { + QHash<QRhiResource *, QPair<VkAccessFlags, bool> > writtenResources; + void reset() { + writtenResources.clear(); + } + } computePassState; + struct Command { enum Cmd { CopyBuffer, @@ -424,12 +437,14 @@ struct QVkCommandBuffer : public QRhiCommandBuffer struct { VkPipelineStageFlags srcStageMask; VkPipelineStageFlags dstStageMask; - VkImageMemoryBarrier desc; + int count; + int index; } imageBarrier; struct { VkPipelineStageFlags srcStageMask; VkPipelineStageFlags dstStageMask; - VkBufferMemoryBarrier desc; + int count; + int index; } bufferBarrier; struct { VkImage src; @@ -532,6 +547,8 @@ struct QVkCommandBuffer : public QRhiCommandBuffer pools.vertexBuffer.clear(); pools.vertexBufferOffset.clear(); pools.debugMarkerData.clear(); + pools.imageBarrier.clear(); + pools.bufferBarrier.clear(); } struct { @@ -541,6 +558,8 @@ struct QVkCommandBuffer : public QRhiCommandBuffer QVarLengthArray<VkBuffer, 4> vertexBuffer; QVarLengthArray<VkDeviceSize, 4> vertexBufferOffset; QVarLengthArray<QByteArray, 4> debugMarkerData; + QVarLengthArray<VkImageMemoryBarrier, 8> imageBarrier; + QVarLengthArray<VkBufferMemoryBarrier, 8> bufferBarrier; } pools; friend class QRhiVulkan; @@ -639,9 +658,12 @@ public: const QSize &pixelSize, int sampleCount, QRhiTexture::Flags flags) override; - QRhiSampler *createSampler(QRhiSampler::Filter magFilter, QRhiSampler::Filter minFilter, + QRhiSampler *createSampler(QRhiSampler::Filter magFilter, + QRhiSampler::Filter minFilter, QRhiSampler::Filter mipmapMode, - QRhiSampler:: AddressMode u, QRhiSampler::AddressMode v) override; + QRhiSampler:: AddressMode u, + QRhiSampler::AddressMode v, + QRhiSampler::AddressMode w) override; QRhiTextureRenderTarget *createTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc, QRhiTextureRenderTarget::Flags flags) override; @@ -727,11 +749,11 @@ public: VkFormat optimalDepthStencilFormat(); VkSampleCountFlagBits effectiveSampleCount(int sampleCount); - bool createDefaultRenderPass(VkRenderPass *rp, + bool createDefaultRenderPass(QVkRenderPassDescriptor *rpD, bool hasDepthStencil, VkSampleCountFlagBits samples, VkFormat colorFormat); - bool createOffscreenRenderPass(VkRenderPass *rp, + bool createOffscreenRenderPass(QVkRenderPassDescriptor *rpD, const QRhiColorAttachment *firstColorAttachment, const QRhiColorAttachment *lastColorAttachment, bool preserveColor, |