Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qrhivulkan_p.h
Go to the documentation of this file.
1// Copyright (C) 2023 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QRHIVULKAN_P_H
5#define QRHIVULKAN_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include "qrhi_p.h"
19
21
24
25static const int QVK_FRAMES_IN_FLIGHT = 2;
26
27static const int QVK_DESC_SETS_PER_POOL = 128;
28static const int QVK_UNIFORM_BUFFERS_PER_POOL = 256;
30static const int QVK_STORAGE_BUFFERS_PER_POOL = 128;
31static const int QVK_STORAGE_IMAGES_PER_POOL = 128;
32
33static const int QVK_MAX_ACTIVE_TIMESTAMP_PAIRS = 16;
34
35// no vk_mem_alloc.h available here, void* is good enough
36typedef void * QVkAlloc;
37typedef void * QVkAllocator;
38
67
69
70struct QVkTexture;
71
73{
76 QRhiTexture::Format backingFormatHint);
78 void destroy() override;
79 bool create() override;
80 QRhiTexture::Format backingFormat() const override;
81
82 VkDeviceMemory memory = VK_NULL_HANDLE;
83 VkImage image = VK_NULL_HANDLE;
84 VkImageView imageView = VK_NULL_HANDLE;
85 VkSampleCountFlagBits samples;
87 VkFormat vkformat;
90 friend class QRhiVulkan;
91};
92
93struct QVkTexture : public QRhiTexture
94{
98 void destroy() override;
99 bool create() override;
100 bool createFrom(NativeTexture src) override;
101 NativeTexture nativeTexture() override;
102 void setNativeLayout(int layout) override;
103
104 bool prepareCreate(QSize *adjustedSize = nullptr);
105 bool finishCreate();
106 VkImageView perLevelImageViewForLoadStore(int level);
107
108 VkImage image = VK_NULL_HANDLE;
109 VkImageView imageView = VK_NULL_HANDLE;
114 bool owns = true;
115 struct UsageState {
116 // no tracking of subresource layouts (some operations can keep
117 // subresources in different layouts for some time, but that does not
118 // need to be kept track of)
119 VkImageLayout layout;
120 VkAccessFlags access;
121 VkPipelineStageFlags stage;
122 };
124 VkFormat vkformat;
126 VkSampleCountFlagBits samples;
127 VkFormat viewFormat;
131 friend class QRhiVulkan;
132};
133
134struct QVkSampler : public QRhiSampler
135{
138 ~QVkSampler();
139 void destroy() override;
140 bool create() override;
141
142 VkSampler sampler = VK_NULL_HANDLE;
145 friend class QRhiVulkan;
146};
147
149{
152 void destroy() override;
153 bool isCompatible(const QRhiRenderPassDescriptor *other) const override;
155 QVector<quint32> serializedFormat() const override;
156 const QRhiNativeHandles *nativeHandles() override;
157
159
160 VkRenderPass rp = VK_NULL_HANDLE;
161 bool ownsRp = false;
162 QVarLengthArray<VkAttachmentDescription, 8> attDescs;
163 QVarLengthArray<VkAttachmentReference, 8> colorRefs;
164 QVarLengthArray<VkAttachmentReference, 8> resolveRefs;
165 QVarLengthArray<VkSubpassDependency, 2> subpassDeps;
166 bool hasDepthStencil = false;
168 uint32_t multiViewCount = 0;
169 VkAttachmentReference dsRef;
170 VkAttachmentReference dsResolveRef;
171 QVector<quint32> serializedFormatData;
174};
175
191
193{
196 void destroy() override;
197
198 QSize pixelSize() const override;
199 float devicePixelRatio() const override;
200 int sampleCount() const override;
201
203};
204
206{
209 void destroy() override;
210
211 QSize pixelSize() const override;
212 float devicePixelRatio() const override;
213 int sampleCount() const override;
214
216 bool create() override;
217
220 VkImageView dsv = VK_NULL_HANDLE;
222 VkImageView resdsv = VK_NULL_HANDLE;
224 friend class QRhiVulkan;
225};
226
228{
231 void destroy() override;
232 bool create() override;
233 void updateResources(UpdateFlags flags) override;
234
235 QVarLengthArray<QRhiShaderResourceBinding, 8> sortedBindings;
236 bool hasSlottedResource = false;
237 bool hasDynamicOffset = false;
238 int poolIndex = -1;
239 VkDescriptorSetLayout layout = VK_NULL_HANDLE;
240 VkDescriptorSet descSets[QVK_FRAMES_IN_FLIGHT]; // multiple sets to support dynamic buffers
243
244 // Keep track of the generation number of each referenced QRhi* to be able
245 // to detect that the underlying descriptor set became out of date and they
246 // need to be written again with the up-to-date VkBuffer etc. objects.
276 QVarLengthArray<BoundResourceData, 8> boundResourceData[QVK_FRAMES_IN_FLIGHT];
277
278 friend class QRhiVulkan;
279};
280
282
284{
287 void destroy() override;
288 bool create() override;
289
290 VkPipelineLayout layout = VK_NULL_HANDLE;
291 VkPipeline pipeline = VK_NULL_HANDLE;
294 friend class QRhiVulkan;
295};
296
298{
301 void destroy() override;
302 bool create() override;
303
304 VkPipelineLayout layout = VK_NULL_HANDLE;
305 VkPipeline pipeline = VK_NULL_HANDLE;
308 friend class QRhiVulkan;
309};
310
312{
315 void destroy() override;
316
318
319 VkCommandBuffer cb = VK_NULL_HANDLE; // primary
321
327
328 void resetState() {
330 passUsesSecondaryCb = false;
331 lastGpuTime = 0;
332 currentTarget = nullptr;
336 }
337
339 currentGraphicsPipeline = nullptr;
340 currentComputePipeline = nullptr;
342 currentGraphicsSrb = nullptr;
343 currentComputeSrb = nullptr;
346 currentIndexBuffer = VK_NULL_HANDLE;
348 currentIndexFormat = VK_INDEX_TYPE_UINT16;
349 memset(currentVertexBuffers, 0, sizeof(currentVertexBuffers));
350 memset(currentVertexOffsets, 0, sizeof(currentVertexOffsets));
351 inExternal = false;
352 }
353
356 double lastGpuTime = 0;
368 static const int VERTEX_INPUT_RESOURCE_SLOT_COUNT = 32;
371 QVarLengthArray<VkCommandBuffer, 4> activeSecondaryCbStack;
373
374 struct {
375 QHash<QRhiResource *, QPair<VkAccessFlags, bool> > writtenResources;
376 void reset() {
378 }
380
381 struct Command {
410
411 union Args {
412 struct {
413 VkBuffer src;
414 VkBuffer dst;
415 VkBufferCopy desc;
417 struct {
418 VkBuffer src;
419 VkImage dst;
420 VkImageLayout dstLayout;
421 int count;
424 struct {
425 VkImage src;
426 VkImageLayout srcLayout;
427 VkImage dst;
428 VkImageLayout dstLayout;
429 VkImageCopy desc;
431 struct {
432 VkImage src;
433 VkImageLayout srcLayout;
434 VkBuffer dst;
435 VkBufferImageCopy desc;
437 struct {
438 VkPipelineStageFlags srcStageMask;
439 VkPipelineStageFlags dstStageMask;
440 int count;
441 int index;
443 struct {
444 VkPipelineStageFlags srcStageMask;
445 VkPipelineStageFlags dstStageMask;
446 int count;
447 int index;
449 struct {
450 VkImage src;
451 VkImageLayout srcLayout;
452 VkImage dst;
453 VkImageLayout dstLayout;
454 VkFilter filter;
455 VkImageBlit desc;
457 struct {
458 VkRenderPassBeginInfo desc;
462 struct {
464 struct {
465 VkPipelineBindPoint bindPoint;
466 VkPipeline pipeline;
468 struct {
469 VkPipelineBindPoint bindPoint;
470 VkPipelineLayout pipelineLayout;
471 VkDescriptorSet descSet;
475 struct {
477 int count;
481 struct {
482 VkBuffer buf;
483 VkDeviceSize ofs;
484 VkIndexType type;
486 struct {
487 VkViewport viewport;
489 struct {
490 VkRect2D scissor;
492 struct {
493 float c[4];
495 struct {
496 uint32_t ref;
498 struct {
499 uint32_t vertexCount;
501 uint32_t firstVertex;
504 struct {
505 uint32_t indexCount;
506 uint32_t instanceCount;
507 uint32_t firstIndex;
509 uint32_t firstInstance;
511 struct {
512#ifdef VK_EXT_debug_utils
513 VkDebugUtilsLabelEXT label;
514 int labelNameIndex;
515#endif
517 struct {
519 struct {
520#ifdef VK_EXT_debug_utils
521 VkDebugUtilsLabelEXT label;
522 int labelNameIndex;
523#endif
525 struct {
528 struct {
529 int x, y, z;
531 struct {
532 VkCommandBuffer cb;
535 };
536
537 QRhiBackendCommandList<Command> commands;
538 QVarLengthArray<QRhiPassResourceTracker, 8> passResTrackers;
540
542 commands.reset();
543 resetPools();
544
547 }
548
549 void resetPools() {
550 pools.clearValue.clear();
551 pools.bufferImageCopy.clear();
552 pools.dynamicOffset.clear();
553 pools.vertexBuffer.clear();
554 pools.vertexBufferOffset.clear();
555 pools.debugMarkerData.clear();
556 pools.imageBarrier.clear();
557 pools.bufferBarrier.clear();
558 }
559
560 struct {
561 QVarLengthArray<VkClearValue, 4> clearValue;
562 QVarLengthArray<VkBufferImageCopy, 16> bufferImageCopy;
563 QVarLengthArray<uint32_t, 4> dynamicOffset;
564 QVarLengthArray<VkBuffer, 4> vertexBuffer;
565 QVarLengthArray<VkDeviceSize, 4> vertexBufferOffset;
566 QVarLengthArray<QByteArray, 4> debugMarkerData;
567 QVarLengthArray<VkImageMemoryBarrier, 8> imageBarrier;
568 QVarLengthArray<VkBufferMemoryBarrier, 8> bufferBarrier;
570
571 friend class QRhiVulkan;
572};
573
575{
578 void destroy() override;
579
583
584 QSize surfacePixelSize() override;
585 bool isFormatSupported(Format f) override;
586
588 bool createOrResize() override;
589
590 bool ensureSurface();
591
593
594 QWindow *window = nullptr;
596 bool supportsReadback = false;
597 bool stereo = false;
598 VkSwapchainKHR sc = VK_NULL_HANDLE;
599 int bufferCount = 0;
600 VkSurfaceKHR surface = VK_NULL_HANDLE;
601 VkSurfaceKHR lastConnectedSurface = VK_NULL_HANDLE;
602 VkFormat colorFormat = VK_FORMAT_B8G8R8A8_UNORM;
603 VkColorSpaceKHR colorSpace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR;
604 QVkRenderBuffer *ds = nullptr;
605 VkSampleCountFlagBits samples = VK_SAMPLE_COUNT_1_BIT;
606 QVarLengthArray<VkPresentModeKHR, 8> supportedPresentationModes;
607 VkDeviceMemory msaaImageMem = VK_NULL_HANDLE;
611
613 VkImage image = VK_NULL_HANDLE;
614 VkImageView imageView = VK_NULL_HANDLE;
615 VkFramebuffer fb = VK_NULL_HANDLE;
616 VkImage msaaImage = VK_NULL_HANDLE;
617 VkImageView msaaImageView = VK_NULL_HANDLE;
624 };
625 QVarLengthArray<ImageResources, EXPECTED_MAX_BUFFER_COUNT> imageRes;
626
628 VkFence imageFence = VK_NULL_HANDLE;
629 bool imageFenceWaitable = false;
630 VkSemaphore imageSem = VK_NULL_HANDLE;
631 VkSemaphore drawSem = VK_NULL_HANDLE;
632 bool imageAcquired = false;
633 bool imageSemWaitable = false;
634 VkFence cmdFence = VK_NULL_HANDLE;
635 bool cmdFenceWaitable = false;
636 VkCommandBuffer cmdBuf = VK_NULL_HANDLE; // primary
639
640 quint32 currentImageIndex = 0; // index in imageRes
641 quint32 currentFrameSlot = 0; // index in frameRes
642 int frameCount = 0;
643
644 friend class QRhiVulkan;
645};
646
648{
649public:
651
652 bool create(QRhi::Flags flags) override;
653 void destroy() override;
654
659 QRhiBuffer::UsageFlags usage,
660 quint32 size) override;
662 const QSize &pixelSize,
663 int sampleCount,
664 QRhiRenderBuffer::Flags flags,
665 QRhiTexture::Format backingFormatHint) override;
667 const QSize &pixelSize,
668 int depth,
669 int arraySize,
670 int sampleCount,
671 QRhiTexture::Flags flags) override;
673 QRhiSampler::Filter minFilter,
674 QRhiSampler::Filter mipmapMode,
677 QRhiSampler::AddressMode w) override;
678
680 QRhiTextureRenderTarget::Flags flags) override;
681
682 QRhiSwapChain *createSwapChain() override;
683 QRhi::FrameOpResult beginFrame(QRhiSwapChain *swapChain, QRhi::BeginFrameFlags flags) override;
684 QRhi::FrameOpResult endFrame(QRhiSwapChain *swapChain, QRhi::EndFrameFlags flags) override;
685 QRhi::FrameOpResult beginOffscreenFrame(QRhiCommandBuffer **cb, QRhi::BeginFrameFlags flags) override;
686 QRhi::FrameOpResult endOffscreenFrame(QRhi::EndFrameFlags flags) override;
687 QRhi::FrameOpResult finish() override;
688
689 void resourceUpdate(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
690
693 const QColor &colorClearValue,
694 const QRhiDepthStencilClearValue &depthStencilClearValue,
695 QRhiResourceUpdateBatch *resourceUpdates,
696 QRhiCommandBuffer::BeginPassFlags flags) override;
697 void endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
698
700 QRhiGraphicsPipeline *ps) override;
701
704 int dynamicOffsetCount,
705 const QRhiCommandBuffer::DynamicOffset *dynamicOffsets) override;
706
708 int startBinding, int bindingCount, const QRhiCommandBuffer::VertexInput *bindings,
709 QRhiBuffer *indexBuf, quint32 indexOffset,
710 QRhiCommandBuffer::IndexFormat indexFormat) override;
711
712 void setViewport(QRhiCommandBuffer *cb, const QRhiViewport &viewport) override;
713 void setScissor(QRhiCommandBuffer *cb, const QRhiScissor &scissor) override;
714 void setBlendConstants(QRhiCommandBuffer *cb, const QColor &c) override;
715 void setStencilRef(QRhiCommandBuffer *cb, quint32 refValue) override;
716
717 void draw(QRhiCommandBuffer *cb, quint32 vertexCount,
718 quint32 instanceCount, quint32 firstVertex, quint32 firstInstance) override;
719
720 void drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount,
721 quint32 instanceCount, quint32 firstIndex,
722 qint32 vertexOffset, quint32 firstInstance) override;
723
724 void debugMarkBegin(QRhiCommandBuffer *cb, const QByteArray &name) override;
725 void debugMarkEnd(QRhiCommandBuffer *cb) override;
726 void debugMarkMsg(QRhiCommandBuffer *cb, const QByteArray &msg) override;
727
729 QRhiResourceUpdateBatch *resourceUpdates,
730 QRhiCommandBuffer::BeginPassFlags flags) override;
731 void endComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
733 void dispatch(QRhiCommandBuffer *cb, int x, int y, int z) override;
734
736 void beginExternal(QRhiCommandBuffer *cb) override;
737 void endExternal(QRhiCommandBuffer *cb) override;
738 double lastCompletedGpuTime(QRhiCommandBuffer *cb) override;
739
740 QList<int> supportedSampleCounts() const override;
741 int ubufAlignment() const override;
742 bool isYUpInFramebuffer() const override;
743 bool isYUpInNDC() const override;
744 bool isClipDepthZeroToOne() const override;
745 QMatrix4x4 clipSpaceCorrMatrix() const override;
746 bool isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture::Flags flags) const override;
747 bool isFeatureSupported(QRhi::Feature feature) const override;
748 int resourceLimit(QRhi::ResourceLimit limit) const override;
749 const QRhiNativeHandles *nativeHandles() override;
750 QRhiDriverInfo driverInfo() const override;
751 QRhiStats statistics() override;
753 void releaseCachedResources() override;
754 bool isDeviceLost() const override;
755
756 QByteArray pipelineCacheData() override;
757 void setPipelineCacheData(const QByteArray &data) override;
758
759 VkResult createDescriptorPool(VkDescriptorPool *pool);
760 bool allocateDescriptorSet(VkDescriptorSetAllocateInfo *allocInfo, VkDescriptorSet *result, int *resultPoolIndex);
761 uint32_t chooseTransientImageMemType(VkImage img, uint32_t startIndex);
762 bool createTransientImage(VkFormat format, const QSize &pixelSize, VkImageUsageFlags usage,
763 VkImageAspectFlags aspectMask, VkSampleCountFlagBits samples,
764 VkDeviceMemory *mem, VkImage *images, VkImageView *views, int count);
765
766 bool recreateSwapChain(QRhiSwapChain *swapChain);
768
769 VkFormat optimalDepthStencilFormat();
770 VkSampleCountFlagBits effectiveSampleCountBits(int sampleCount);
772 bool hasDepthStencil,
773 VkSampleCountFlagBits samples,
774 VkFormat colorFormat);
776 const QRhiColorAttachment *colorAttachmentsBegin,
777 const QRhiColorAttachment *colorAttachmentsEnd,
778 bool preserveColor,
779 bool preserveDs,
780 bool storeDs,
781 QRhiRenderBuffer *depthStencilBuffer,
782 QRhiTexture *depthTexture,
783 QRhiTexture *depthResolveTexture);
784 bool ensurePipelineCache(const void *initialData = nullptr, size_t initialDataSize = 0);
785 VkShaderModule createShader(const QByteArray &spirv);
786
788 VkCommandBuffer startSecondaryCommandBuffer(QVkRenderTargetData *rtD = nullptr);
789 void endAndEnqueueSecondaryCommandBuffer(VkCommandBuffer cb, QVkCommandBuffer *cbD);
791 QRhi::FrameOpResult endAndSubmitPrimaryCommandBuffer(VkCommandBuffer cb, VkFence cmdFence,
792 VkSemaphore *waitSem, VkSemaphore *signalSem);
793 void waitCommandCompletion(int frameSlot);
794 VkDeviceSize subresUploadByteSize(const QRhiTextureSubresourceUploadDescription &subresDesc) const;
795 using BufferImageCopyList = QVarLengthArray<VkBufferImageCopy, 16>;
796 void prepareUploadSubres(QVkTexture *texD, int layer, int level,
798 size_t *curOfs, void *mp,
799 BufferImageCopyList *copyInfos);
801 void executeBufferHostWritesForSlot(QVkBuffer *bufD, int slot);
805 QVkBuffer *bufD,
806 int slot,
810 QVkTexture *texD,
815 void executeDeferredReleases(bool forced = false);
816 void finishActiveReadbacks(bool forced = false);
817
818 void setObjectName(uint64_t object, VkObjectType type, const QByteArray &name, int slot = -1);
819 void trackedBufferBarrier(QVkCommandBuffer *cbD, QVkBuffer *bufD, int slot,
820 VkAccessFlags access, VkPipelineStageFlags stage);
822 VkImageLayout layout, VkAccessFlags access, VkPipelineStageFlags stage);
824 void subresourceBarrier(QVkCommandBuffer *cbD, VkImage image,
825 VkImageLayout oldLayout, VkImageLayout newLayout,
826 VkAccessFlags srcAccess, VkAccessFlags dstAccess,
827 VkPipelineStageFlags srcStage, VkPipelineStageFlags dstStage,
828 int startLayer, int layerCount,
829 int startLevel, int levelCount);
830 void updateShaderResourceBindings(QRhiShaderResourceBindings *srb, int descSetIdx = -1);
832 double elapsedSecondsFromTimestamp(quint64 timestamp[2], bool *ok);
833 void printExtraErrorInfo(VkResult err);
834
838 bool importedDevice = false;
839 VkPhysicalDevice physDev = VK_NULL_HANDLE;
840 VkDevice dev = VK_NULL_HANDLE;
841 VkCommandPool cmdPool[QVK_FRAMES_IN_FLIGHT] = {};
844 VkQueue gfxQueue = VK_NULL_HANDLE;
846 bool importedAllocator = false;
848 QVulkanFunctions *f = nullptr;
850 QRhi::Flags rhiFlags;
851 VkPhysicalDeviceFeatures physDevFeatures;
852#ifdef VK_VERSION_1_1
853 VkPhysicalDeviceMultiviewFeatures multiviewFeaturesIfApi11;
854#endif
855#ifdef VK_VERSION_1_2
856 VkPhysicalDeviceVulkan11Features physDevFeatures11IfApi12OrNewer;
857 VkPhysicalDeviceVulkan12Features physDevFeatures12;
858#endif
859#ifdef VK_VERSION_1_3
860 VkPhysicalDeviceVulkan13Features physDevFeatures13;
861#endif
862 VkPhysicalDeviceProperties physDevProperties;
863 VkDeviceSize ubufAlign;
864 VkDeviceSize texbufAlign;
865 bool deviceLost = false;
867
868#ifdef VK_EXT_debug_utils
869 PFN_vkSetDebugUtilsObjectNameEXT vkSetDebugUtilsObjectNameEXT = nullptr;
870 PFN_vkCmdBeginDebugUtilsLabelEXT vkCmdBeginDebugUtilsLabelEXT = nullptr;
871 PFN_vkCmdEndDebugUtilsLabelEXT vkCmdEndDebugUtilsLabelEXT = nullptr;
872 PFN_vkCmdInsertDebugUtilsLabelEXT vkCmdInsertDebugUtilsLabelEXT = nullptr;
873#endif
874
875 PFN_vkCreateSwapchainKHR vkCreateSwapchainKHR = nullptr;
876 PFN_vkDestroySwapchainKHR vkDestroySwapchainKHR;
877 PFN_vkGetSwapchainImagesKHR vkGetSwapchainImagesKHR;
878 PFN_vkAcquireNextImageKHR vkAcquireNextImageKHR;
879 PFN_vkQueuePresentKHR vkQueuePresentKHR;
880 PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR vkGetPhysicalDeviceSurfaceCapabilitiesKHR;
881 PFN_vkGetPhysicalDeviceSurfaceFormatsKHR vkGetPhysicalDeviceSurfaceFormatsKHR;
882 PFN_vkGetPhysicalDeviceSurfacePresentModesKHR vkGetPhysicalDeviceSurfacePresentModesKHR;
883
884#ifdef VK_KHR_create_renderpass2
885 PFN_vkCreateRenderPass2KHR vkCreateRenderPass2KHR = nullptr;
886#endif
887
888 struct {
889 bool compute = false;
890 bool wideLines = false;
891 bool debugUtils = false;
893 bool texture3DSliceAs2D = false;
894 bool tessellation = false;
895 bool geometryShader = false;
896 bool nonFillPolygonMode = false;
897 bool multiView = false;
898 bool renderPass2KHR = false;
902
903 VkPipelineCache pipelineCache = VK_NULL_HANDLE;
906 DescriptorPoolData(VkDescriptorPool pool_)
907 : pool(pool_)
908 { }
909 VkDescriptorPool pool = VK_NULL_HANDLE;
910 int refCount = 0;
912 };
913 QVarLengthArray<DescriptorPoolData, 8> descriptorPools;
914 QVarLengthArray<VkCommandBuffer, 4> freeSecondaryCbs[QVK_FRAMES_IN_FLIGHT];
915
916 VkQueryPool timestampQueryPool = VK_NULL_HANDLE;
918
919 VkFormat optimalDsFormat = VK_FORMAT_UNDEFINED;
921
923 QSet<QVkSwapChain *> swapchains;
926
929 {
930 for (int i = 0; i < QVK_FRAMES_IN_FLIGHT; ++i)
931 cbWrapper[i] = new QVkCommandBuffer(rhi);
932 }
934 {
935 for (int i = 0; i < QVK_FRAMES_IN_FLIGHT; ++i)
936 delete cbWrapper[i];
937 }
938 bool active = false;
940 VkFence cmdFence = VK_NULL_HANDLE;
943
954 QVarLengthArray<TextureReadback, 2> activeTextureReadbacks;
962 QVarLengthArray<BufferReadback, 2> activeBufferReadbacks;
963
978 int lastActiveFrameSlot; // -1 if not used otherwise 0..FRAMES_IN_FLIGHT-1
979 union {
980 struct {
981 VkPipeline pipeline;
982 VkPipelineLayout layout;
984 struct {
986 VkDescriptorSetLayout layout;
988 struct {
994 struct {
995 VkDeviceMemory memory;
996 VkImage image;
997 VkImageView imageView;
999 struct {
1000 VkImage image;
1001 VkImageView imageView;
1007 struct {
1008 VkSampler sampler;
1010 struct {
1011 VkFramebuffer fb;
1014 VkImageView dsv;
1015 VkImageView resdsv;
1017 struct {
1018 VkRenderPass rp;
1020 struct {
1024 struct {
1025 VkCommandBuffer cb;
1027 };
1028 };
1029 QList<DeferredReleaseEntry> releaseQueue;
1030};
1031
1036
1038
1039#endif
\inmodule QtCore
Definition qbitarray.h:13
\inmodule QtCore
\inmodule QtCore
Definition qbytearray.h:57
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
void clear() noexcept(std::is_nothrow_destructible< Node >::value)
Removes all items from the hash and frees up all memory used by it.
Definition qhash.h:951
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
Definition qmatrix4x4.h:25
\inmodule QtGui
Definition qrhi.h:846
Type
Specifies storage type of buffer resource.
Definition qrhi.h:848
\inmodule QtGui
Definition qrhi.h:576
\inmodule QtGui
Definition qrhi.h:1651
QPair< int, quint32 > DynamicOffset
Synonym for QPair<int, quint32>.
Definition qrhi.h:1676
QPair< QRhiBuffer *, quint32 > VertexInput
Synonym for QPair<QRhiBuffer *, quint32>.
Definition qrhi.h:1680
IndexFormat
Specifies the index data type.
Definition qrhi.h:1653
\inmodule QtGui
Definition qrhi.h:1622
\inmodule QtGui
Definition qrhi.h:44
\inmodule QtGui
Definition qrhi.h:1270
\inmodule QtGui
Definition qrhi.h:777
\inmodule QtGui
Definition qrhi.h:1094
QSize pixelSize() const
Definition qrhi.h:1115
int sampleCount() const
Definition qrhi.h:1118
Type
Specifies the type of the renderbuffer.
Definition qrhi.h:1096
\inmodule QtGui
Definition qrhi.h:1142
\inmodule QtGui
Definition qrhi.h:1158
\inmodule QtGui
Definition qrhi.h:1731
QRhi * rhi() const
Definition qrhi.cpp:3603
\inmodule QtGui
Definition qrhi.h:1030
Filter
Specifies the minification, magnification, or mipmap filtering.
Definition qrhi.h:1032
Filter magFilter() const
Definition qrhi.h:1057
AddressMode
Specifies the addressing mode.
Definition qrhi.h:1038
Filter minFilter() const
Definition qrhi.h:1060
Filter mipmapMode() const
Definition qrhi.h:1063
\inmodule QtGui
Definition qrhi.h:138
\inmodule QtGui
Definition qrhi.h:1214
\inmodule QtGui
Definition qrhi.h:1173
\inmodule QtGui
Definition qrhi.h:1549
Format
Describes the swapchain format.
Definition qrhi.h:1561
StereoTargetBuffer
Selects the backbuffer to use with a stereoscopic swapchain.
Definition qrhi.h:1568
\inmodule QtGui
Definition qrhi.h:1184
\inmodule QtGui
Definition qrhi.h:895
int arraySize() const
Definition qrhi.h:981
int sampleCount() const
Definition qrhi.h:995
Format
Specifies the texture format.
Definition qrhi.h:914
QSize pixelSize() const
Definition qrhi.h:975
\inmodule QtGui
Definition qrhi.h:85
\variable QRhiVulkanNativeHandles::physDev
\inmodule QtGui
\variable QRhiVulkanInitParams::inst
\variable QRhiVulkanCommandBufferNativeHandles::commandBuffer
QVarLengthArray< DescriptorPoolData, 8 > descriptorPools
void recordTransitionPassResources(QVkCommandBuffer *cbD, const QRhiPassResourceTracker &tracker)
quint32 gfxQueueFamilyIdx
VkCommandBuffer startSecondaryCommandBuffer(QVkRenderTargetData *rtD=nullptr)
QRhiSwapChain * createSwapChain() override
PFN_vkGetSwapchainImagesKHR vkGetSwapchainImagesKHR
void debugMarkMsg(QRhiCommandBuffer *cb, const QByteArray &msg) override
int resourceLimit(QRhi::ResourceLimit limit) const override
bool isDeviceLost() const override
void prepareUploadSubres(QVkTexture *texD, int layer, int level, const QRhiTextureSubresourceUploadDescription &subresDesc, size_t *curOfs, void *mp, BufferImageCopyList *copyInfos)
VkPhysicalDeviceProperties physDevProperties
void executeDeferredReleases(bool forced=false)
uint32_t chooseTransientImageMemType(VkImage img, uint32_t startIndex)
QRhi::FrameOpResult finish() override
quint32 timestampValidBits
QRhiTextureRenderTarget * createTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc, QRhiTextureRenderTarget::Flags flags) override
bool createTransientImage(VkFormat format, const QSize &pixelSize, VkImageUsageFlags usage, VkImageAspectFlags aspectMask, VkSampleCountFlagBits samples, VkDeviceMemory *mem, VkImage *images, VkImageView *views, int count)
void setScissor(QRhiCommandBuffer *cb, const QRhiScissor &scissor) override
void releaseCachedResources() override
QVkSwapChain * currentSwapChain
bool geometryShader
bool importedDevice
QByteArrayList requestedDeviceExtensions
bool createDefaultRenderPass(QVkRenderPassDescriptor *rpD, bool hasDepthStencil, VkSampleCountFlagBits samples, VkFormat colorFormat)
QRhiVulkan(QRhiVulkanInitParams *params, QRhiVulkanNativeHandles *importParams=nullptr)
void draw(QRhiCommandBuffer *cb, quint32 vertexCount, quint32 instanceCount, quint32 firstVertex, quint32 firstInstance) override
void setStencilRef(QRhiCommandBuffer *cb, quint32 refValue) override
void endComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override
QList< int > supportedSampleCounts() const override
void destroy() override
QRhiRenderBuffer * createRenderBuffer(QRhiRenderBuffer::Type type, const QSize &pixelSize, int sampleCount, QRhiRenderBuffer::Flags flags, QRhiTexture::Format backingFormatHint) override
QRhi::FrameOpResult endOffscreenFrame(QRhi::EndFrameFlags flags) override
QBitArray timestampQueryPoolMap
double elapsedSecondsFromTimestamp(quint64 timestamp[2], bool *ok)
VkFormat optimalDsFormat
QRhi::FrameOpResult beginOffscreenFrame(QRhiCommandBuffer **cb, QRhi::BeginFrameFlags flags) override
void trackedBufferBarrier(QVkCommandBuffer *cbD, QVkBuffer *bufD, int slot, VkAccessFlags access, VkPipelineStageFlags stage)
void endExternal(QRhiCommandBuffer *cb) override
QWindow * maybeWindow
void dispatch(QRhiCommandBuffer *cb, int x, int y, int z) override
VkPhysicalDeviceFeatures physDevFeatures
QRhiVulkanNativeHandles nativeHandlesStruct
bool allocateDescriptorSet(VkDescriptorSetAllocateInfo *allocInfo, VkDescriptorSet *result, int *resultPoolIndex)
void updateShaderResourceBindings(QRhiShaderResourceBindings *srb, int descSetIdx=-1)
bool isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture::Flags flags) const override
VkDevice dev
QVersionNumber apiVersion
VkResult createDescriptorPool(VkDescriptorPool *pool)
void prepareNewFrame(QRhiCommandBuffer *cb)
void subresourceBarrier(QVkCommandBuffer *cbD, VkImage image, VkImageLayout oldLayout, VkImageLayout newLayout, VkAccessFlags srcAccess, VkAccessFlags dstAccess, VkPipelineStageFlags srcStage, VkPipelineStageFlags dstStage, int startLayer, int layerCount, int startLevel, int levelCount)
void printExtraErrorInfo(VkResult err)
void setComputePipeline(QRhiCommandBuffer *cb, QRhiComputePipeline *ps) override
QRhi::FrameOpResult beginFrame(QRhiSwapChain *swapChain, QRhi::BeginFrameFlags flags) override
QRhi::FrameOpResult startPrimaryCommandBuffer(VkCommandBuffer *cb)
bool renderPass2KHR
double lastCompletedGpuTime(QRhiCommandBuffer *cb) override
bool depthStencilResolveKHR
void trackedRegisterTexture(QRhiPassResourceTracker *passResTracker, QVkTexture *texD, QRhiPassResourceTracker::TextureAccess access, QRhiPassResourceTracker::TextureStage stage)
bool releaseCachedResourcesCalledBeforeFrameStart
QRhi::Flags rhiFlags
PFN_vkCreateSwapchainKHR vkCreateSwapchainKHR
QRhiGraphicsPipeline * createGraphicsPipeline() override
QRhiComputePipeline * createComputePipeline() override
bool nonFillPolygonMode
struct QRhiVulkan::@339 caps
QRhiTexture * createTexture(QRhiTexture::Format format, const QSize &pixelSize, int depth, int arraySize, int sampleCount, QRhiTexture::Flags flags) override
void waitCommandCompletion(int frameSlot)
void debugMarkBegin(QRhiCommandBuffer *cb, const QByteArray &name) override
PFN_vkGetPhysicalDeviceSurfacePresentModesKHR vkGetPhysicalDeviceSurfacePresentModesKHR
bool recreateSwapChain(QRhiSwapChain *swapChain)
PFN_vkQueuePresentKHR vkQueuePresentKHR
bool ensurePipelineCache(const void *initialData=nullptr, size_t initialDataSize=0)
QRhiDriverInfo driverInfoStruct
void resourceUpdate(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override
QVarLengthArray< TextureReadback, 2 > activeTextureReadbacks
bool texture3DSliceAs2D
void depthStencilExplicitBarrier(QVkCommandBuffer *cbD, QVkRenderBuffer *rbD)
void trackedImageBarrier(QVkCommandBuffer *cbD, QVkTexture *texD, VkImageLayout layout, VkAccessFlags access, VkPipelineStageFlags stage)
VkCommandPool cmdPool[QVK_FRAMES_IN_FLIGHT]
VkShaderModule createShader(const QByteArray &spirv)
void enqueueTransitionPassResources(QVkCommandBuffer *cbD)
void beginComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates, QRhiCommandBuffer::BeginPassFlags flags) override
QVulkanDeviceFunctions * df
void setObjectName(uint64_t object, VkObjectType type, const QByteArray &name, int slot=-1)
bool isFeatureSupported(QRhi::Feature feature) const override
PFN_vkGetPhysicalDeviceSurfaceFormatsKHR vkGetPhysicalDeviceSurfaceFormatsKHR
QVarLengthArray< BufferReadback, 2 > activeBufferReadbacks
void recordPrimaryCommandBuffer(QVkCommandBuffer *cbD)
bool isYUpInFramebuffer() const override
void debugMarkEnd(QRhiCommandBuffer *cb) override
QVulkanInstance * inst
QRhiSampler * createSampler(QRhiSampler::Filter magFilter, QRhiSampler::Filter minFilter, QRhiSampler::Filter mipmapMode, QRhiSampler::AddressMode u, QRhiSampler::AddressMode v, QRhiSampler::AddressMode w) override
PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR vkGetPhysicalDeviceSurfaceCapabilitiesKHR
void releaseSwapChainResources(QRhiSwapChain *swapChain)
void drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount, quint32 instanceCount, quint32 firstIndex, qint32 vertexOffset, quint32 firstInstance) override
VkDeviceSize subresUploadByteSize(const QRhiTextureSubresourceUploadDescription &subresDesc) const
void endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override
VkQueryPool timestampQueryPool
void trackedRegisterBuffer(QRhiPassResourceTracker *passResTracker, QVkBuffer *bufD, int slot, QRhiPassResourceTracker::BufferAccess access, QRhiPassResourceTracker::BufferStage stage)
VkFormat optimalDepthStencilFormat()
QRhiStats statistics() override
void setGraphicsPipeline(QRhiCommandBuffer *cb, QRhiGraphicsPipeline *ps) override
void activateTextureRenderTarget(QVkCommandBuffer *cbD, QVkTextureRenderTarget *rtD)
bool createOffscreenRenderPass(QVkRenderPassDescriptor *rpD, const QRhiColorAttachment *colorAttachmentsBegin, const QRhiColorAttachment *colorAttachmentsEnd, bool preserveColor, bool preserveDs, bool storeDs, QRhiRenderBuffer *depthStencilBuffer, QRhiTexture *depthTexture, QRhiTexture *depthResolveTexture)
PFN_vkDestroySwapchainKHR vkDestroySwapchainKHR
bool vertexAttribDivisor
QMatrix4x4 clipCorrectMatrix
void executeBufferHostWritesForSlot(QVkBuffer *bufD, int slot)
bool isYUpInNDC() const override
const QRhiNativeHandles * nativeHandles() override
void setPipelineCacheData(const QByteArray &data) override
void setVertexInput(QRhiCommandBuffer *cb, int startBinding, int bindingCount, const QRhiCommandBuffer::VertexInput *bindings, QRhiBuffer *indexBuf, quint32 indexOffset, QRhiCommandBuffer::IndexFormat indexFormat) override
QRhiShaderResourceBindings * createShaderResourceBindings() override
VkPipelineCache pipelineCache
VkDeviceSize ubufAlign
void finishActiveReadbacks(bool forced=false)
void ensureCommandPoolForNewFrame()
QByteArray pipelineCacheData() override
quint32 gfxQueueIdx
VkDeviceSize texbufAlign
QList< DeferredReleaseEntry > releaseQueue
void endAndEnqueueSecondaryCommandBuffer(VkCommandBuffer cb, QVkCommandBuffer *cbD)
void beginPass(QRhiCommandBuffer *cb, QRhiRenderTarget *rt, const QColor &colorClearValue, const QRhiDepthStencilClearValue &depthStencilClearValue, QRhiResourceUpdateBatch *resourceUpdates, QRhiCommandBuffer::BeginPassFlags flags) override
void setBlendConstants(QRhiCommandBuffer *cb, const QColor &c) override
QRhiBuffer * createBuffer(QRhiBuffer::Type type, QRhiBuffer::UsageFlags usage, quint32 size) override
bool isClipDepthZeroToOne() const override
void enqueueResourceUpdates(QVkCommandBuffer *cbD, QRhiResourceUpdateBatch *resourceUpdates)
QVarLengthArray< VkCommandBuffer, 4 > freeSecondaryCbs[QVK_FRAMES_IN_FLIGHT]
void setShaderResources(QRhiCommandBuffer *cb, QRhiShaderResourceBindings *srb, int dynamicOffsetCount, const QRhiCommandBuffer::DynamicOffset *dynamicOffsets) override
QVkAllocator allocator
bool importedAllocator
VkQueue gfxQueue
PFN_vkAcquireNextImageKHR vkAcquireNextImageKHR
QMatrix4x4 clipSpaceCorrMatrix() const override
bool tessellation
struct QRhiVulkan::OffscreenFrame ofr
QSet< QVkSwapChain * > swapchains
int ubufAlignment() const override
QRhiDriverInfo driverInfo() const override
void beginExternal(QRhiCommandBuffer *cb) override
void setViewport(QRhiCommandBuffer *cb, const QRhiViewport &viewport) override
QRhi::FrameOpResult endAndSubmitPrimaryCommandBuffer(VkCommandBuffer cb, VkFence cmdFence, VkSemaphore *waitSem, VkSemaphore *signalSem)
QRhi::FrameOpResult endFrame(QRhiSwapChain *swapChain, QRhi::EndFrameFlags flags) override
VkSampleCountFlagBits effectiveSampleCountBits(int sampleCount)
VkPhysicalDevice physDev
bool makeThreadLocalNativeContextCurrent() override
static constexpr int MAX_MIP_LEVELS
Definition qrhi.h:1997
ResourceLimit
Describes the resource limit to query.
Definition qrhi.h:1886
Feature
Flag values to indicate what features are supported by the backend currently in use.
Definition qrhi.h:1831
FrameOpResult
Describes the result of operations that can have a soft failure.
Definition qrhi.h:1824
\inmodule QtCore
Definition qsize.h:25
\inmodule QtCore
The QVulkanDeviceFunctions class provides cross-platform access to the device level core Vulkan 1....
The QVulkanFunctions class provides cross-platform access to the instance level core Vulkan 1....
The QVulkanInstance class represents a native Vulkan instance, enabling Vulkan rendering onto a QSurf...
\inmodule QtGui
Definition qwindow.h:63
Combined button and popup list for selecting options.
Definition image.cpp:4
static int instanceCount
EGLOutputLayerEXT layer
Flags
GLsizei const GLfloat * v
[13]
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat z
GLint GLint GLint GLint GLint x
[0]
GLuint const GLuint * buffers
GLint GLenum GLsizei GLsizei GLsizei depth
GLsizei samples
GLenum GLuint GLint level
GLfloat GLfloat GLfloat w
[0]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint sampler
GLenum GLenum GLsizei count
GLsizei const GLubyte * commands
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLfloat GLfloat f
GLenum src
GLenum type
GLuint GLsizei const GLchar * label
[43]
GLenum access
GLbitfield flags
GLuint name
GLint GLsizei GLsizei GLenum format
GLsizei GLenum GLsizei GLsizei GLuint memory
GLint y
void ** params
GLboolean reset
const GLubyte * c
GLint void * img
Definition qopenglext.h:233
GLint limit
GLuint64EXT * result
[6]
GLenum GLenum colorFormat
GLsizeiptr const void GLenum usage
Definition qopenglext.h:543
static const int QVK_UNIFORM_BUFFERS_PER_POOL
static const int QVK_COMBINED_IMAGE_SAMPLERS_PER_POOL
static const int QVK_STORAGE_BUFFERS_PER_POOL
static const int QVK_STORAGE_IMAGES_PER_POOL
void * QVkAllocator
static const int QVK_MAX_ACTIVE_TIMESTAMP_PAIRS
static const int QVK_DESC_SETS_PER_POOL
void * QVkAlloc
static const int QVK_FRAMES_IN_FLIGHT
SSL_CTX int(* cb)(SSL *ssl, unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg)
@ Q_RELOCATABLE_TYPE
Definition qtypeinfo.h:158
#define Q_DECLARE_TYPEINFO(TYPE, FLAGS)
Definition qtypeinfo.h:180
unsigned int quint32
Definition qtypes.h:50
int qint32
Definition qtypes.h:49
unsigned long long quint64
Definition qtypes.h:61
unsigned int uint
Definition qtypes.h:34
QList< QImage > images
[6]
QVBoxLayout * layout
QSharedPointer< T > other(t)
[5]
view viewport() -> scroll(dx, dy, deviceRect)
view create()
\inmodule QtGui
Definition qrhi.h:862
\inmodule QtGui
Definition qrhi.h:1759
\variable QRhiReadbackResult::completed
Definition qrhi.h:800
\inmodule QtGui
Definition qrhi.h:1723
static constexpr int MAX_TEX_SAMPLER_ARRAY_SIZE
Definition qrhi.h:506
\inmodule QtGui
Definition qrhi.h:1782
\inmodule QtGui
Definition qrhi.h:965
QRhiReadbackResult * result
VkBuffer stagingBuffers[QVK_FRAMES_IN_FLIGHT]
VkImageView rtv[QVkRenderTargetData::MAX_COLOR_ATTACHMENTS]
struct QRhiVulkan::DeferredReleaseEntry::@340::@349 renderPass
struct QRhiVulkan::DeferredReleaseEntry::@340::@343 shaderResourceBindings
QVkAlloc allocations[QVK_FRAMES_IN_FLIGHT]
VkImageView extraImageViews[QRhi::MAX_MIP_LEVELS]
VkDescriptorSetLayout layout
QVkAlloc stagingAllocations[QVK_FRAMES_IN_FLIGHT]
struct QRhiVulkan::DeferredReleaseEntry::@340::@342 pipelineState
struct QRhiVulkan::DeferredReleaseEntry::@340::@351 secondaryCommandBuffer
struct QRhiVulkan::DeferredReleaseEntry::@340::@346 texture
VkImageView resrtv[QVkRenderTargetData::MAX_COLOR_ATTACHMENTS]
struct QRhiVulkan::DeferredReleaseEntry::@340::@344 buffer
struct QRhiVulkan::DeferredReleaseEntry::@340::@348 textureRenderTarget
struct QRhiVulkan::DeferredReleaseEntry::@340::@345 renderBuffer
DescriptorPoolData(VkDescriptorPool pool_)
QVkCommandBuffer * cbWrapper[QVK_FRAMES_IN_FLIGHT]
OffscreenFrame(QRhiImplementation *rhi)
QRhiTexture::Format format
QRhiReadbackDescription desc
QRhiReadbackResult * result
VkPipelineStageFlags stage
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
QVkBuffer(QRhiImplementation *rhi, Type type, UsageFlags usage, quint32 size)
UsageState usageState[QVK_FRAMES_IN_FLIGHT]
uint generation
VkBuffer stagingBuffers[QVK_FRAMES_IN_FLIGHT]
QVkAlloc allocations[QVK_FRAMES_IN_FLIGHT]
QVkAlloc stagingAllocations[QVK_FRAMES_IN_FLIGHT]
void endFullDynamicBufferUpdateForCurrentFrame() override
To be called when the entire contents of the buffer data has been updated in the memory block returne...
QRhiBuffer::NativeBuffer nativeBuffer() override
bool create() override
Creates the corresponding native graphics resources.
QVarLengthArray< DynamicUpdate, 16 > pendingDynamicUpdates[QVK_FRAMES_IN_FLIGHT]
char * beginFullDynamicBufferUpdateForCurrentFrame() override
int lastActiveFrameSlot
union QVkCommandBuffer::Command::Args args
struct QVkCommandBuffer::@313 pools
VkBuffer currentVertexBuffers[VERTEX_INPUT_RESOURCE_SLOT_COUNT]
QVkCommandBuffer(QRhiImplementation *rhi)
QVarLengthArray< VkCommandBuffer, 4 > activeSecondaryCbStack
QRhiBackendCommandList< Command > commands
QRhiRenderTarget * currentTarget
QVarLengthArray< VkBufferImageCopy, 16 > bufferImageCopy
QRhiVulkanCommandBufferNativeHandles nativeHandlesStruct
QVarLengthArray< VkImageMemoryBarrier, 8 > imageBarrier
QVarLengthArray< VkBufferMemoryBarrier, 8 > bufferBarrier
quint32 currentVertexOffsets[VERTEX_INPUT_RESOURCE_SLOT_COUNT]
QHash< QRhiResource *, QPair< VkAccessFlags, bool > > writtenResources
QRhiComputePipeline * currentComputePipeline
static const int VERTEX_INPUT_RESOURCE_SLOT_COUNT
const QRhiNativeHandles * nativeHandles()
QRhiShaderResourceBindings * currentComputeSrb
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
QRhiShaderResourceBindings * currentGraphicsSrb
PassType recordingPass
QVarLengthArray< VkDeviceSize, 4 > vertexBufferOffset
VkBuffer currentIndexBuffer
VkCommandBuffer cb
QVarLengthArray< VkBuffer, 4 > vertexBuffer
QRhiGraphicsPipeline * currentGraphicsPipeline
QVarLengthArray< VkClearValue, 4 > clearValue
uint currentPipelineGeneration
quint32 currentIndexOffset
QVarLengthArray< uint32_t, 4 > dynamicOffset
QVarLengthArray< QByteArray, 4 > debugMarkerData
QVarLengthArray< QRhiPassResourceTracker, 8 > passResTrackers
struct QVkCommandBuffer::@312 computePassState
VkIndexType currentIndexFormat
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
QVkComputePipeline(QRhiImplementation *rhi)
bool create() override
VkPipelineLayout layout
QVkGraphicsPipeline(QRhiImplementation *rhi)
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
VkPipelineLayout layout
bool create() override
Creates the corresponding native graphics resources.
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
QVkRenderBuffer(QRhiImplementation *rhi, Type type, const QSize &pixelSize, int sampleCount, Flags flags, QRhiTexture::Format backingFormatHint)
VkFormat vkformat
VkSampleCountFlagBits samples
QRhiTexture::Format backingFormat() const override
bool create() override
Creates the corresponding native graphics resources.
QVkTexture * backingTexture
VkImageView imageView
QVarLengthArray< VkSubpassDependency, 2 > subpassDeps
const QRhiNativeHandles * nativeHandles() override
QVector< quint32 > serializedFormatData
QVarLengthArray< VkAttachmentReference, 8 > colorRefs
QRhiRenderPassDescriptor * newCompatibleRenderPassDescriptor() const override
VkAttachmentReference dsRef
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
QVarLengthArray< VkAttachmentReference, 8 > resolveRefs
QVarLengthArray< VkAttachmentDescription, 8 > attDescs
QRhiVulkanRenderPassNativeHandles nativeHandlesStruct
VkAttachmentReference dsResolveRef
QVector< quint32 > serializedFormat() const override
QVkRenderPassDescriptor(QRhiImplementation *rhi)
bool isCompatible(const QRhiRenderPassDescriptor *other) const override
QVkRenderPassDescriptor * rp
QRhiRenderTargetAttachmentTracker::ResIdList currentResIdList
static const int MAX_COLOR_ATTACHMENTS
int lastActiveFrameSlot
bool create() override
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
QVkSampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilter, Filter mipmapMode, AddressMode u, AddressMode v, AddressMode w)
struct QVkShaderResourceBindings::BoundSampledTextureData::@309 d[QRhiShaderResourceBinding::Data::MAX_TEX_SAMPLER_ARRAY_SIZE]
VkDescriptorSetLayout layout
void updateResources(UpdateFlags flags) override
QVkShaderResourceBindings(QRhiImplementation *rhi)
QVarLengthArray< QRhiShaderResourceBinding, 8 > sortedBindings
QVarLengthArray< BoundResourceData, 8 > boundResourceData[QVK_FRAMES_IN_FLIGHT]
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
VkDescriptorSet descSets[QVK_FRAMES_IN_FLIGHT]
QSize pixelSize() const override
int sampleCount() const override
float devicePixelRatio() const override
QVkRenderTargetData d
QVkSwapChainRenderTarget(QRhiImplementation *rhi, QRhiSwapChain *swapchain)
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
VkColorSpaceKHR colorSpace
VkSurfaceKHR lastConnectedSurface
bool createOrResize() override
Creates the swapchain if not already done and resizes the swapchain buffers to match the current size...
VkSwapchainKHR sc
bool isFormatSupported(Format f) override
QVkCommandBuffer cbWrapper
static const quint32 EXPECTED_MAX_BUFFER_COUNT
QRhiRenderPassDescriptor * newCompatibleRenderPassDescriptor() override
struct QVkSwapChain::FrameResources frameRes[QVK_FRAMES_IN_FLIGHT]
bool supportsReadback
QVkSwapChain(QRhiImplementation *rhi)
QVkRenderBuffer * ds
quint32 currentFrameSlot
QSize surfacePixelSize() override
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
VkDeviceMemory msaaImageMem
QRhiRenderTarget * currentFrameRenderTarget() override
quint32 currentImageIndex
QVarLengthArray< ImageResources, EXPECTED_MAX_BUFFER_COUNT > imageRes
VkSurfaceKHR surface
QVarLengthArray< VkPresentModeKHR, 8 > supportedPresentationModes
QWindow * window
QVkSwapChainRenderTarget rtWrapperRight
bool ensureSurface()
QVkSwapChainRenderTarget rtWrapper
QRhiCommandBuffer * currentFrameCommandBuffer() override
QVkTextureRenderTarget(QRhiImplementation *rhi, const QRhiTextureRenderTargetDescription &desc, Flags flags)
float devicePixelRatio() const override
VkImageView rtv[QVkRenderTargetData::MAX_COLOR_ATTACHMENTS]
bool create() override
Creates the corresponding native graphics resources.
int sampleCount() const override
QSize pixelSize() const override
QVkRenderTargetData d
VkImageView resrtv[QVkRenderTargetData::MAX_COLOR_ATTACHMENTS]
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
QRhiRenderPassDescriptor * newCompatibleRenderPassDescriptor() override
VkPipelineStageFlags stage
bool create() override
Creates the corresponding native graphics resources.
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
VkBuffer stagingBuffers[QVK_FRAMES_IN_FLIGHT]
VkFormat vkformat
bool finishCreate()
VkImageView perLevelImageViewForLoadStore(int level)
VkSampleCountFlagBits samples
int lastActiveFrameSlot
QVkAlloc stagingAllocations[QVK_FRAMES_IN_FLIGHT]
bool createFrom(NativeTexture src) override
Similar to create(), except that no new native textures are created.
VkFormat viewFormat
QVkAlloc imageAlloc
void setNativeLayout(int layout) override
With some graphics APIs, such as Vulkan, integrating custom rendering code that uses the graphics API...
VkFormat viewFormatForSampling
QVkTexture(QRhiImplementation *rhi, Format format, const QSize &pixelSize, int depth, int arraySize, int sampleCount, Flags flags)
VkImageView perLevelImageViews[QRhi::MAX_MIP_LEVELS]
NativeTexture nativeTexture() override
UsageState usageState
bool prepareCreate(QSize *adjustedSize=nullptr)
uint mipLevelCount
VkImageView imageView
Definition moc.h:23
struct QVkCommandBuffer::Command::Args::@329 setBlendConstants
struct QVkCommandBuffer::Command::Args::@328 setScissor
struct QVkCommandBuffer::Command::Args::@336 transitionResources
struct QVkCommandBuffer::Command::Args::@316 copyImage
struct QVkCommandBuffer::Command::Args::@314 copyBuffer
struct QVkCommandBuffer::Command::Args::@334 debugMarkerEnd
struct QVkCommandBuffer::Command::Args::@335 debugMarkerInsert
struct QVkCommandBuffer::Command::Args::@326 bindIndexBuffer
struct QVkCommandBuffer::Command::Args::@321 beginRenderPass
struct QVkCommandBuffer::Command::Args::@325 bindVertexBuffer
struct QVkCommandBuffer::Command::Args::@338 executeSecondary
struct QVkCommandBuffer::Command::Args::@333 debugMarkerBegin
struct QVkCommandBuffer::Command::Args::@319 bufferBarrier
VkPipelineStageFlags srcStageMask
struct QVkCommandBuffer::Command::Args::@322 endRenderPass
struct QVkCommandBuffer::Command::Args::@337 dispatch
VkPipelineStageFlags dstStageMask
struct QVkCommandBuffer::Command::Args::@330 setStencilRef
struct QVkCommandBuffer::Command::Args::@323 bindPipeline
struct QVkCommandBuffer::Command::Args::@315 copyBufferToImage
VkRenderPassBeginInfo desc
struct QVkCommandBuffer::Command::Args::@318 imageBarrier
struct QVkCommandBuffer::Command::Args::@317 copyImageToBuffer
struct QVkCommandBuffer::Command::Args::@327 setViewport
struct QVkCommandBuffer::Command::Args::@320 blitImage
struct QVkCommandBuffer::Command::Args::@324 bindDescriptorSet
VkPipelineBindPoint bindPoint
struct QVkCommandBuffer::Command::Args::@332 drawIndexed
struct QVkCommandBuffer::Command::Args::@331 draw