Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
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// Qt-Security score:significant reason:default
4
5#ifndef QRHIVULKAN_P_H
6#define QRHIVULKAN_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include "qrhi_p.h"
20
21#include <QtCore/private/qflatmap_p.h>
22
23#ifdef Q_OS_WIN
24#include "qdxgihdrinfo_p.h"
25#endif
26
28
29class QVulkanFunctions;
30class QVulkanDeviceFunctions;
31
32static const int QVK_FRAMES_IN_FLIGHT = 2;
33
34static const int QVK_DESC_SETS_PER_POOL = 128;
35static const int QVK_UNIFORM_BUFFERS_PER_POOL = 256;
37static const int QVK_SAMPLED_IMAGES_PER_POOL = 256;
38static const int QVK_SAMPLERS_PER_POOL = 256;
39static const int QVK_STORAGE_BUFFERS_PER_POOL = 128;
40static const int QVK_STORAGE_IMAGES_PER_POOL = 128;
41
42static const int QVK_MAX_ACTIVE_TIMESTAMP_PAIRS = 16;
43
44// no vk_mem_alloc.h available here, void* is good enough
45typedef void * QVkAlloc;
46typedef void * QVkAllocator;
47
76
78
79struct QVkTexture;
80
82{
83 QVkRenderBuffer(QRhiImplementation *rhi, Type type, const QSize &pixelSize,
84 int sampleCount, Flags flags,
85 QRhiTexture::Format backingFormatHint);
87 void destroy() override;
88 bool create() override;
89 QRhiTexture::Format backingFormat() const override;
90
98 uint generation = 0;
99 friend class QRhiVulkan;
100};
101
102struct QVkTexture : public QRhiTexture
103{
104 QVkTexture(QRhiImplementation *rhi, Format format, const QSize &pixelSize, int depth,
105 int arraySize, int sampleCount, Flags flags);
106 ~QVkTexture();
107 void destroy() override;
108 bool create() override;
109 bool createFrom(NativeTexture src) override;
110 NativeTexture nativeTexture() override;
111 void setNativeLayout(int layout) override;
112
113 bool prepareCreate(QSize *adjustedSize = nullptr);
114 bool finishCreate();
116
123 bool owns = true;
124 struct UsageState {
125 // no tracking of subresource layouts (some operations can keep
126 // subresources in different layouts for some time, but that does not
127 // need to be kept track of)
131 };
139 uint generation = 0;
140 friend class QRhiVulkan;
141};
142
143struct QVkSampler : public QRhiSampler
144{
145 QVkSampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilter, Filter mipmapMode,
146 AddressMode u, AddressMode v, AddressMode w);
147 ~QVkSampler();
148 void destroy() override;
149 bool create() override;
150
153 uint generation = 0;
154 friend class QRhiVulkan;
155};
156
158{
159 QVkShadingRateMap(QRhiImplementation *rhi);
161 void destroy() override;
162 bool createFrom(QRhiTexture *src) override;
163
164 QVkTexture *texture = nullptr; // not owned
165 friend class QRhiVulkan;
166};
167
197
214
216{
217 QVkSwapChainRenderTarget(QRhiImplementation *rhi, QRhiSwapChain *swapchain);
219 void destroy() override;
220
221 QSize pixelSize() const override;
222 float devicePixelRatio() const override;
223 int sampleCount() const override;
224
226};
227
250
252{
253 QVkShaderResourceBindings(QRhiImplementation *rhi);
255 void destroy() override;
256 bool create() override;
257 void updateResources(UpdateFlags flags) override;
258
261 int poolIndex = -1;
263 VkDescriptorSet descSets[QVK_FRAMES_IN_FLIGHT]; // multiple sets to support dynamic buffers
265 uint generation = 0;
266
267 // Keep track of the generation number of each referenced QRhi* to be able
268 // to detect that the underlying descriptor set became out of date and they
269 // need to be written again with the up-to-date VkBuffer etc. objects.
298
299 friend class QRhiVulkan;
300};
301
302
317
332
334{
335 QVkCommandBuffer(QRhiImplementation *rhi);
337 void destroy() override;
338
340
343
349
350 void resetState() {
352 passUsesSecondaryCb = false;
353 lastGpuTime = 0;
354 currentTarget = nullptr;
355 activeSecondaryCbStack.clear();
358 }
359
361 currentGraphicsPipeline = nullptr;
362 currentComputePipeline = nullptr;
364 currentGraphicsSrb = nullptr;
365 currentComputeSrb = nullptr;
368 currentIndexBuffer = VK_NULL_HANDLE;
369 currentIndexOffset = 0;
370 currentIndexFormat = VK_INDEX_TYPE_UINT16;
371 memset(currentVertexBuffers, 0, sizeof(currentVertexBuffers));
372 memset(currentVertexOffsets, 0, sizeof(currentVertexOffsets));
373 inExternal = false;
374 hasShadingRateSet = false;
375 hasCustomScissorSet = false;
376 currentViewport = {};
377 }
378
381 double lastGpuTime = 0;
393 static const int VERTEX_INPUT_RESOURCE_SLOT_COUNT = 32;
401
408 void reset() {
409 writtenResources.clear();
410 }
411 } computePassState;
412
413 struct Command {
452
453 union Args {
454 struct {
458 } copyBuffer;
459 struct {
460 VkBuffer dst;
464 } fillBuffer;
465 struct {
466 VkBuffer src;
469 int count;
471 } copyBufferToImage;
472 struct {
475 VkImage dst;
476 VkImageLayout dstLayout;
478 } copyImage;
479 struct {
480 VkImage src;
481 VkImageLayout srcLayout;
482 VkBuffer dst;
483 int count;
484 int bufferImageCopyIndex;
485 } copyImageToBuffer;
486 struct {
489 int count;
490 int index;
491 } imageBarrier;
492 struct {
493 VkPipelineStageFlags srcStageMask;
494 VkPipelineStageFlags dstStageMask;
498 } memoryBarrier;
499 struct {
500 VkPipelineStageFlags srcStageMask;
501 VkPipelineStageFlags dstStageMask;
502 int count;
503 int index;
504 } bufferBarrier;
505 struct {
506 VkPipelineStageFlags srcStageMask;
507 VkPipelineStageFlags dstStageMask;
512 } imageAndBufferBarrier;
513 struct {
514 VkImage src;
515 VkImageLayout srcLayout;
516 VkImage dst;
517 VkImageLayout dstLayout;
520 } blitImage;
521 struct {
525 } beginRenderPass;
526 struct {
527 } endRenderPass;
528 struct {
531 } bindPipeline;
532 struct {
533 VkPipelineBindPoint bindPoint;
538 } bindDescriptorSet;
539 struct {
541 int count;
544 } bindVertexBuffer;
545 struct {
549 } bindIndexBuffer;
550 struct {
552 } setViewport;
553 struct {
555 } setScissor;
556 struct {
557 float c[4];
558 } setBlendConstants;
559 struct {
561 } setStencilRef;
562 struct {
567 } draw;
568 struct {
570 uint32_t instanceCount;
573 uint32_t firstInstance;
574 } drawIndexed;
575 struct {
580 } drawIndirect;
581 struct {
582 VkBuffer indirectBuffer;
583 VkDeviceSize indirectBufferOffset;
584 uint32_t drawCount;
585 uint32_t stride;
586 } drawIndexedIndirect;
587 struct {
588 VkBuffer indirectBuffer;
589 VkDeviceSize indirectBufferOffset;
593 uint32_t stride;
594 } drawIndirectCount;
595 struct {
596 VkBuffer indirectBuffer;
597 VkDeviceSize indirectBufferOffset;
598 VkBuffer countBuffer;
599 VkDeviceSize countBufferOffset;
600 uint32_t maxDrawCount;
601 uint32_t stride;
602 } drawIndexedIndirectCount;
603 struct {
604#ifdef VK_EXT_debug_utils
605 VkDebugUtilsLabelEXT label;
606 int labelNameIndex;
607#endif
608 } debugMarkerBegin;
609 struct {
610 } debugMarkerEnd;
611 struct {
612#ifdef VK_EXT_debug_utils
613 VkDebugUtilsLabelEXT label;
614 int labelNameIndex;
615#endif
616 } debugMarkerInsert;
617 struct {
619 } transitionResources;
620 struct {
621 int x, y, z;
622 } dispatch;
623 struct {
624 VkBuffer indirectBuffer;
625 VkDeviceSize indirectBufferOffset;
626 } dispatchIndirect;
627 struct {
629 } executeSecondary;
630 struct {
633 } setShadingRate;
634 struct {
640 } setPushConstants;
641 } args;
642 };
643
647
649 commands.reset();
651
652 passResTrackers.clear();
654 }
655
656 void resetPools() {
657 pools.clearValue.clear();
658 pools.bufferImageCopy.clear();
659 pools.dynamicOffset.clear();
660 pools.vertexBuffer.clear();
661 pools.vertexBufferOffset.clear();
662 pools.debugMarkerData.clear();
663 pools.imageBarrier.clear();
664 pools.bufferBarrier.clear();
665 pools.pushConstantData.clear();
666 }
667
668 struct {
678 } pools;
679
680 friend class QRhiVulkan;
681};
682
684
686{
687 QVkSwapChain(QRhiImplementation *rhi);
688 ~QVkSwapChain();
689 void destroy() override;
690
691 QRhiCommandBuffer *currentFrameCommandBuffer() override;
693 QRhiRenderTarget *currentFrameRenderTarget(StereoTargetBuffer targetBuffer) override;
694
695 QSize surfacePixelSize() override;
696 bool isFormatSupported(Format f) override;
698
701
702 bool ensureSurface();
703
705
706 QWindow *window = nullptr;
708 bool supportsReadback = false;
709 bool stereo = false;
711 int bufferCount = 0;
718 QVkRenderBuffer *ds = nullptr;
726
742
752
753 quint32 currentImageIndex = 0; // index in imageRes
754 int frameCount = 0;
755
756 friend class QRhiVulkan;
757};
758
760{
761public:
762 QRhiDriverInfo info() const override;
763
766};
767
769{
770public:
771 QRhiVulkan(QRhiVulkanInitParams *params, QRhiVulkanNativeHandles *importParams = nullptr);
772
773 bool create(QRhi::Flags flags) override;
774 void destroy() override;
775 QRhi::AdapterList enumerateAdaptersBeforeCreate(QRhiNativeHandles *nativeHandles) const override;
776
780 QRhiBuffer *createBuffer(QRhiBuffer::Type type,
781 QRhiBuffer::UsageFlags usage,
782 quint32 size) override;
783 QRhiRenderBuffer *createRenderBuffer(QRhiRenderBuffer::Type type,
784 const QSize &pixelSize,
785 int sampleCount,
786 QRhiRenderBuffer::Flags flags,
787 QRhiTexture::Format backingFormatHint) override;
788 QRhiTexture *createTexture(QRhiTexture::Format format,
789 const QSize &pixelSize,
790 int depth,
791 int arraySize,
792 int sampleCount,
793 QRhiTexture::Flags flags) override;
794 QRhiSampler *createSampler(QRhiSampler::Filter magFilter,
795 QRhiSampler::Filter minFilter,
796 QRhiSampler::Filter mipmapMode,
797 QRhiSampler:: AddressMode u,
798 QRhiSampler::AddressMode v,
799 QRhiSampler::AddressMode w) override;
800
801 QRhiTextureRenderTarget *createTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc,
802 QRhiTextureRenderTarget::Flags flags) override;
803
804 QRhiShadingRateMap *createShadingRateMap() override;
805
806 QRhiSwapChain *createSwapChain() override;
807 QRhi::FrameOpResult beginFrame(QRhiSwapChain *swapChain, QRhi::BeginFrameFlags flags) override;
808 QRhi::FrameOpResult endFrame(QRhiSwapChain *swapChain, QRhi::EndFrameFlags flags) override;
809 QRhi::FrameOpResult beginOffscreenFrame(QRhiCommandBuffer **cb, QRhi::BeginFrameFlags flags) override;
810 QRhi::FrameOpResult endOffscreenFrame(QRhi::EndFrameFlags flags) override;
811 QRhi::FrameOpResult finish() override;
812
813 void resourceUpdate(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
814
815 void beginPass(QRhiCommandBuffer *cb,
816 QRhiRenderTarget *rt,
817 const QColor &colorClearValue,
818 const QRhiDepthStencilClearValue &depthStencilClearValue,
819 QRhiResourceUpdateBatch *resourceUpdates,
820 QRhiCommandBuffer::BeginPassFlags flags) override;
821 void endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
822
823 void setGraphicsPipeline(QRhiCommandBuffer *cb,
824 QRhiGraphicsPipeline *ps) override;
825
826 void setShaderResources(QRhiCommandBuffer *cb,
827 QRhiShaderResourceBindings *srb,
828 int dynamicOffsetCount,
829 const QRhiCommandBuffer::DynamicOffset *dynamicOffsets) override;
830
831 void setVertexInput(QRhiCommandBuffer *cb,
832 int startBinding, int bindingCount, const QRhiCommandBuffer::VertexInput *bindings,
833 QRhiBuffer *indexBuf, quint32 indexOffset,
834 QRhiCommandBuffer::IndexFormat indexFormat) override;
835
836 void setViewport(QRhiCommandBuffer *cb, const QRhiViewport &viewport) override;
837 void setScissor(QRhiCommandBuffer *cb, const QRhiScissor &scissor) override;
838 void setBlendConstants(QRhiCommandBuffer *cb, const QColor &c) override;
839 void setStencilRef(QRhiCommandBuffer *cb, quint32 refValue) override;
840 void setPushConstants(QRhiCommandBuffer *cb, quint32 offset, quint32 size, const void *data) override;
841 void setShadingRate(QRhiCommandBuffer *cb, const QSize &coarsePixelSize) override;
842
843 void draw(QRhiCommandBuffer *cb, quint32 vertexCount,
844 quint32 instanceCount, quint32 firstVertex, quint32 firstInstance) override;
845
846 void drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount,
847 quint32 instanceCount, quint32 firstIndex,
848 qint32 vertexOffset, quint32 firstInstance) override;
849
850 void drawIndirect(QRhiCommandBuffer *cb, QRhiBuffer *indirectBuffer,
851 quint32 indirectBufferOffset, quint32 drawCount, quint32 stride) override;
852
853 void drawIndexedIndirect(QRhiCommandBuffer *cb, QRhiBuffer *indirectBuffer,
854 quint32 indirectBufferOffset, quint32 drawCount, quint32 stride) override;
855
856 void drawIndirectCount(QRhiCommandBuffer *cb,
857 QRhiBuffer *indirectBuffer, quint32 indirectBufferOffset,
858 QRhiBuffer *countBuffer, quint32 countBufferOffset,
859 quint32 maxDrawCount, quint32 stride) override;
860 void drawIndexedIndirectCount(QRhiCommandBuffer *cb,
861 QRhiBuffer *indirectBuffer, quint32 indirectBufferOffset,
862 QRhiBuffer *countBuffer, quint32 countBufferOffset,
863 quint32 maxDrawCount, quint32 stride) override;
864
865 void dispatchIndirect(QRhiCommandBuffer *cb, QRhiBuffer *indirectBuffer,
866 quint32 indirectBufferOffset) override;
867
868 void debugMarkBegin(QRhiCommandBuffer *cb, const QByteArray &name) override;
869 void debugMarkEnd(QRhiCommandBuffer *cb) override;
870 void debugMarkMsg(QRhiCommandBuffer *cb, const QByteArray &msg) override;
871
872 void beginComputePass(QRhiCommandBuffer *cb,
873 QRhiResourceUpdateBatch *resourceUpdates,
874 QRhiCommandBuffer::BeginPassFlags flags) override;
875 void endComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
876 void setComputePipeline(QRhiCommandBuffer *cb, QRhiComputePipeline *ps) override;
877 void dispatch(QRhiCommandBuffer *cb, int x, int y, int z) override;
878
879 const QRhiNativeHandles *nativeHandles(QRhiCommandBuffer *cb) override;
880 void beginExternal(QRhiCommandBuffer *cb) override;
881 void endExternal(QRhiCommandBuffer *cb) override;
882 double lastCompletedGpuTime(QRhiCommandBuffer *cb) override;
883
884 QList<int> supportedSampleCounts() const override;
885 QList<QSize> supportedShadingRates(int sampleCount) const override;
886 int ubufAlignment() const override;
887 bool isYUpInFramebuffer() const override;
888 bool isYUpInNDC() const override;
889 bool isClipDepthZeroToOne() const override;
890 QMatrix4x4 clipSpaceCorrMatrix() const override;
891 bool isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture::Flags flags) const override;
892 bool isFeatureSupported(QRhi::Feature feature) const override;
893 int resourceLimit(QRhi::ResourceLimit limit) const override;
894 const QRhiNativeHandles *nativeHandles() override;
895 QRhiDriverInfo driverInfo() const override;
896 QRhiStats statistics() override;
898 void setQueueSubmitParams(QRhiNativeHandles *params) override;
900 bool isDeviceLost() const override;
901
902 QByteArray pipelineCacheData() override;
903 void setPipelineCacheData(const QByteArray &data) override;
904
905 VkResult createDescriptorPool(VkDescriptorPool *pool);
906 bool allocateDescriptorSet(VkDescriptorSetAllocateInfo *allocInfo, VkDescriptorSet *result, int *resultPoolIndex);
907 uint32_t chooseTransientImageMemType(VkImage img, uint32_t startIndex);
908 bool createTransientImage(VkFormat format, const QSize &pixelSize, VkImageUsageFlags usage,
909 VkImageAspectFlags aspectMask, VkSampleCountFlagBits samples,
910 VkDeviceMemory *mem, VkImage *images, VkImageView *views, int count);
911
912 bool recreateSwapChain(QRhiSwapChain *swapChain);
913 void releaseSwapChainResources(QRhiSwapChain *swapChain);
914
918 bool hasDepthStencil,
919 VkSampleCountFlagBits samples,
920 VkFormat colorFormat,
921 QRhiShadingRateMap *shadingRateMap);
923 const QRhiColorAttachment *colorAttachmentsBegin,
924 const QRhiColorAttachment *colorAttachmentsEnd,
925 bool preserveColor,
926 bool preserveDs,
927 bool storeDs,
928 QRhiRenderBuffer *depthStencilBuffer,
929 QRhiTexture *depthTexture,
930 QRhiTexture *depthResolveTexture,
931 int depthLayer,
932 QRhiShadingRateMap *shadingRateMap);
933 bool ensurePipelineCache(const void *initialData = nullptr, size_t initialDataSize = 0);
934 VkShaderModule createShader(const QByteArray &spirv);
935
936 void prepareNewFrame(QRhiCommandBuffer *cb);
938 void endAndEnqueueSecondaryCommandBuffer(VkCommandBuffer cb, QVkCommandBuffer *cbD);
939 QRhi::FrameOpResult startPrimaryCommandBuffer(VkCommandBuffer *cb);
940 QRhi::FrameOpResult endAndSubmitPrimaryCommandBuffer(VkCommandBuffer cb, VkFence cmdFence,
941 VkSemaphore *waitSem, VkSemaphore *signalSem);
943 VkDeviceSize subresUploadByteSize(const QRhiTextureSubresourceUploadDescription &subresDesc) const;
945 void prepareUploadSubres(QVkTexture *texD, int layer, int level,
946 const QRhiTextureSubresourceUploadDescription &subresDesc,
947 size_t *curOfs, void *mp,
948 BufferImageCopyList *copyInfos);
949 void enqueueResourceUpdates(QVkCommandBuffer *cbD, QRhiResourceUpdateBatch *resourceUpdates);
950 void executeBufferHostWritesForSlot(QVkBuffer *bufD, int slot);
954 QVkBuffer *bufD,
955 int slot,
959 QVkTexture *texD,
963 QVarLengthArray<VkImageMemoryBarrier, 8> *imageBarriers,
964 QVarLengthArray<VkBufferMemoryBarrier, 8> *bufferBarriers);
967 void executeDeferredReleases(bool forced = false);
968 void finishActiveReadbacks(bool forced = false);
969
970 void setAllocationName(QVkAlloc allocation, const QByteArray &name, int slot = -1);
971 void setObjectName(uint64_t object, VkObjectType type, const QByteArray &name, int slot = -1);
972 void trackedBufferBarrier(QVkCommandBuffer *cbD, QVkBuffer *bufD, int slot,
973 VkAccessFlags access, VkPipelineStageFlags stage);
975 VkImageLayout layout, VkAccessFlags access, VkPipelineStageFlags stage);
977 void subresourceBarrier(QVkCommandBuffer *cbD, VkImage image,
978 VkImageLayout oldLayout, VkImageLayout newLayout,
979 VkAccessFlags srcAccess, VkAccessFlags dstAccess,
980 VkPipelineStageFlags srcStage, VkPipelineStageFlags dstStage,
981 int startLayer, int layerCount,
982 int startLevel, int levelCount);
983 void updateShaderResourceBindings(QRhiShaderResourceBindings *srb);
985 double elapsedSecondsFromTimestamp(quint64 timestamp[2], bool *ok);
986 void printExtraErrorInfo(VkResult err);
988 void printDeviceLossErrorInfo() const;
990
992 QWindow *maybeWindow = nullptr;
994 bool importedDevice = false;
1003 bool importedAllocator = false;
1005 QVulkanFunctions *f = nullptr;
1006 QVulkanDeviceFunctions *df = nullptr;
1009#ifdef VK_VERSION_1_1
1012#endif
1013#ifdef VK_VERSION_1_2
1016#endif
1017#ifdef VK_VERSION_1_3
1019#endif
1020#ifdef VK_VERSION_1_4
1022#endif
1026 bool deviceLost = false;
1028
1029#ifdef Q_OS_WIN
1030 bool adapterLuidValid = false;
1032 QDxgiHdrInfo *dxgiHdrInfo = nullptr;
1033#endif
1034
1035#ifdef VK_EXT_debug_utils
1040#endif
1041
1050
1051#ifdef VK_KHR_create_renderpass2
1053#endif
1054
1055#ifdef VK_VERSION_1_2
1056 // Vulkan 1.2 core, not in QVulkanDeviceFunctions, so resolved manually.
1059#endif
1060
1061#ifdef VK_EXT_device_fault
1063#endif
1064
1065 struct {
1066 bool compute = false;
1067 bool depthClamp = false;
1068 bool wideLines = false;
1069 bool debugUtils = false;
1070 bool deviceFault = false;
1073 bool tessellation = false;
1074 bool geometryShader = false;
1076 bool multiView = false;
1077 bool renderPass2KHR = false;
1083 bool drawIndirectMulti = false;
1085 bool drawIndirectCount = false;
1086 } caps;
1087
1100
1103
1106
1111
1113 OffscreenFrame(QRhiImplementation *rhi)
1114 {
1115 for (int i = 0; i < QVK_FRAMES_IN_FLIGHT; ++i) {
1116 cbWrapper[i] = new QVkCommandBuffer(rhi);
1117 cmdFence[i] = VK_NULL_HANDLE;
1118 cmdFenceWaitable[i] = false;
1119 timestampQueryIndex[i] = -1;
1120 }
1121 }
1123 {
1124 for (int i = 0; i < QVK_FRAMES_IN_FLIGHT; ++i)
1125 delete cbWrapper[i];
1126 }
1127 bool active = false;
1132 } ofr;
1133
1153
1168 int lastActiveFrameSlot; // -1 if not used otherwise 0..FRAMES_IN_FLIGHT-1
1169 union {
1170 struct {
1173 } pipelineState;
1174 struct {
1177 } shaderResourceBindings;
1178 struct {
1183 } buffer;
1184 struct {
1188 } renderBuffer;
1189 struct {
1190 VkImage image;
1191 VkImageView imageView;
1193 VkBuffer stagingBuffers[QVK_FRAMES_IN_FLIGHT];
1194 QVkAlloc stagingAllocations[QVK_FRAMES_IN_FLIGHT];
1195 VkImageView extraImageViews[QRhi::MAX_MIP_LEVELS];
1196 } texture;
1197 struct {
1199 } sampler;
1200 struct {
1207 } textureRenderTarget;
1208 struct {
1210 } renderPass;
1211 struct {
1214 } stagingBuffer;
1215 struct {
1217 } secondaryCommandBuffer;
1218 };
1219 };
1221
1222#ifdef VK_KHR_fragment_shading_rate
1225#endif
1226
1231};
1232
1237
1238QT_END_NAMESPACE
1239
1240#endif
const char * constData() const
Definition qrhi_p.h:477
bool isEmpty() const
Definition qrhi.cpp:13656
const QRhiPassResourceMap< QRhiTexture *, Texture, 12 > & textures() const
Definition qrhi_p.h:967
void registerBuffer(QRhiBuffer *buf, int slot, BufferAccess *access, BufferStage *stage, const UsageState &state)
Definition qrhi.cpp:13673
void registerTexture(QRhiTexture *tex, TextureAccess *access, TextureStage *stage, const UsageState &state)
Definition qrhi.cpp:13713
const QRhiPassResourceMap< QRhiBuffer *, Buffer, 12 > & buffers() const
Definition qrhi_p.h:959
static QRhiResourceUpdateBatchPrivate * get(QRhiResourceUpdateBatch *b)
Definition qrhi_p.h:745
QVarLengthArray< DescriptorPoolData, 8 > descriptorPools
void recordTransitionPassResources(QVkCommandBuffer *cbD, const QRhiPassResourceTracker &tracker)
QVulkanFunctions * f
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
void collectComputeBarriers(QVkCommandBuffer *cbD, QVarLengthArray< VkImageMemoryBarrier, 8 > *imageBarriers, QVarLengthArray< VkBufferMemoryBarrier, 8 > *bufferBarriers)
bool geometryShader
bool importedDevice
QByteArrayList requestedDeviceExtensions
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
void updateShaderResourceBindings(QRhiShaderResourceBindings *srb)
void setPushConstants(QRhiCommandBuffer *cb, quint32 offset, quint32 size, const void *data) override
void dispatchIndirect(QRhiCommandBuffer *cb, QRhiBuffer *indirectBuffer, quint32 indirectBufferOffset) override
double elapsedSecondsFromTimestamp(quint64 timestamp[2], bool *ok)
VkFormat optimalDsFormat
QRhi::FrameOpResult beginOffscreenFrame(QRhiCommandBuffer **cb, QRhi::BeginFrameFlags flags) override
bool imageBasedShadingRate
VkDeviceQueueCreateFlags gfxQueueFlags
QVarLengthArray< VkSemaphore, 4 > waitSemaphoresForPresent
void drawIndexedIndirectCount(QRhiCommandBuffer *cb, QRhiBuffer *indirectBuffer, quint32 indirectBufferOffset, QRhiBuffer *countBuffer, quint32 countBufferOffset, quint32 maxDrawCount, quint32 stride) override
void trackedBufferBarrier(QVkCommandBuffer *cbD, QVkBuffer *bufD, int slot, VkAccessFlags access, VkPipelineStageFlags stage)
QRhi::FrameOpResult waitCommandCompletion(int frameSlot)
void endExternal(QRhiCommandBuffer *cb) override
QWindow * maybeWindow
void dispatch(QRhiCommandBuffer *cb, int x, int y, int z) override
VkPhysicalDeviceFeatures physDevFeatures
bool perDrawShadingRate
QRhiVulkanNativeHandles nativeHandlesStruct
bool allocateDescriptorSet(VkDescriptorSetAllocateInfo *allocInfo, VkDescriptorSet *result, int *resultPoolIndex)
bool shaderDrawParameters
bool drawIndirectMulti
bool isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture::Flags flags) const override
VkDevice dev
QVersionNumber apiVersion
void drawIndexedIndirect(QRhiCommandBuffer *cb, QRhiBuffer *indirectBuffer, quint32 indirectBufferOffset, quint32 drawCount, quint32 stride) override
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)
QList< QSize > supportedShadingRates(int sampleCount) const override
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
void setAllocationName(QVkAlloc allocation, const QByteArray &name, int slot=-1)
QRhiTexture * createTexture(QRhiTexture::Format format, const QSize &pixelSize, int depth, int arraySize, int sampleCount, QRhiTexture::Flags flags) override
void debugMarkBegin(QRhiCommandBuffer *cb, const QByteArray &name) override
const QRhiNativeHandles * nativeHandles(QRhiCommandBuffer *cb) override
PFN_vkGetPhysicalDeviceSurfacePresentModesKHR vkGetPhysicalDeviceSurfacePresentModesKHR
bool recreateSwapChain(QRhiSwapChain *swapChain)
PFN_vkQueuePresentKHR vkQueuePresentKHR
Q_DECL_COLD_FUNCTION void printDeviceLossErrorInfo() const
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
bool create(QRhi::Flags 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
int imageBasedShadingRateTileSize
void setShadingRate(QRhiCommandBuffer *cb, const QSize &coarsePixelSize) 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)
bool createOffscreenRenderPass(QVkRenderPassDescriptor *rpD, const QRhiColorAttachment *colorAttachmentsBegin, const QRhiColorAttachment *colorAttachmentsEnd, bool preserveColor, bool preserveDs, bool storeDs, QRhiRenderBuffer *depthStencilBuffer, QRhiTexture *depthTexture, QRhiTexture *depthResolveTexture, int depthLayer, QRhiShadingRateMap *shadingRateMap)
QVarLengthArray< VkSemaphore, 4 > signalSemaphoresForQueueSubmit
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 drawIndirect(QRhiCommandBuffer *cb, QRhiBuffer *indirectBuffer, quint32 indirectBufferOffset, quint32 drawCount, quint32 stride) override
void activateTextureRenderTarget(QVkCommandBuffer *cbD, QVkTextureRenderTarget *rtD)
PFN_vkDestroySwapchainKHR vkDestroySwapchainKHR
QRhi::AdapterList enumerateAdaptersBeforeCreate(QRhiNativeHandles *nativeHandles) const override
bool vertexAttribDivisor
QMatrix4x4 clipCorrectMatrix
void executeBufferHostWritesForSlot(QVkBuffer *bufD, int slot)
void setQueueSubmitParams(QRhiNativeHandles *params) override
void setDefaultScissor(QVkCommandBuffer *cbD)
bool isYUpInNDC() const override
const QRhiNativeHandles * nativeHandles() override
QVarLengthArray< VkPipelineStageFlags, 4 > semaphoresWaitMasksForQueueSubmit
QRhiShadingRateMap * createShadingRateMap() 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)
QVarLengthArray< VkSemaphore, 4 > waitSemaphoresForQueueSubmit
void beginPass(QRhiCommandBuffer *cb, QRhiRenderTarget *rt, const QColor &colorClearValue, const QRhiDepthStencilClearValue &depthStencilClearValue, QRhiResourceUpdateBatch *resourceUpdates, QRhiCommandBuffer::BeginPassFlags flags) override
void drawIndirectCount(QRhiCommandBuffer *cb, QRhiBuffer *indirectBuffer, quint32 indirectBufferOffset, QRhiBuffer *countBuffer, quint32 countBufferOffset, quint32 maxDrawCount, quint32 stride) 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
QSet< QVkSwapChain * > swapchains
int ubufAlignment() const override
QRhiDriverInfo driverInfo() const override
void beginExternal(QRhiCommandBuffer *cb) override
bool drawIndirectCount
void setViewport(QRhiCommandBuffer *cb, const QRhiViewport &viewport) override
bool createDefaultRenderPass(QVkRenderPassDescriptor *rpD, bool hasDepthStencil, VkSampleCountFlagBits samples, VkFormat colorFormat, QRhiShadingRateMap *shadingRateMap)
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
QRhiDriverInfo adapterInfo
QRhiDriverInfo info() const override
VkPhysicalDevice physDev
Combined button and popup list for selecting options.
@ UnBounded
Definition qrhi_p.h:390
@ Bounded
Definition qrhi_p.h:391
#define QRHI_RES_RHI(t)
Definition qrhi_p.h:33
#define QRHI_RES(t, x)
Definition qrhi_p.h:32
static VkPolygonMode toVkPolygonMode(QRhiGraphicsPipeline::PolygonMode mode)
static VkCullModeFlags toVkCullMode(QRhiGraphicsPipeline::CullMode c)
static bool accessIsWrite(VkAccessFlags access)
static VkCompareOp toVkTextureCompareOp(QRhiSampler::CompareOp op)
static QVulkanInstance * globalVulkanInstance
static VkBufferUsageFlagBits toVkBufferUsage(QRhiBuffer::UsageFlags usage)
static QRhiTexture::Format swapchainReadbackTextureFormat(VkFormat format, QRhiTexture::Flags *flags)
static VkStencilOp toVkStencilOp(QRhiGraphicsPipeline::StencilOp op)
static bool qvk_debug_filter(QVulkanInstance::DebugMessageSeverityFlags severity, QVulkanInstance::DebugMessageTypeFlags type, const void *callbackData)
static QVkBuffer::UsageState toVkBufferUsageState(QRhiPassResourceTracker::UsageState usage)
static bool attachmentDescriptionEquals(const VkAttachmentDescription &a, const VkAttachmentDescription &b)
static VkPipelineStageFlags toVkPipelineStage(QRhiPassResourceTracker::TextureStage stage)
static VkAccessFlags toVkAccess(QRhiPassResourceTracker::BufferAccess access)
static VkImageLayout toVkLayout(QRhiPassResourceTracker::TextureAccess access)
static VkFormat toVkAttributeFormat(QRhiVertexInputAttribute::Format format)
static QVkTexture::UsageState toVkTextureUsageState(QRhiPassResourceTracker::UsageState usage)
static VkPipelineStageFlags toVkPipelineStage(QRhiPassResourceTracker::BufferStage stage)
static QRhiDriverInfo::DeviceType toRhiDeviceType(VkPhysicalDeviceType type)
static QRhiPassResourceTracker::UsageState toPassTrackerUsageState(const QVkBuffer::UsageState &bufUsage)
static VkColorComponentFlags toVkColorComponents(QRhiGraphicsPipeline::ColorMask c)
static VkFilter toVkFilter(QRhiSampler::Filter f)
static VkPrimitiveTopology toVkTopology(QRhiGraphicsPipeline::Topology t)
static void qrhivk_releaseTexture(const QRhiVulkan::DeferredReleaseEntry &e, VkDevice dev, QVulkanDeviceFunctions *df, void *allocator)
static void qrhivk_releaseBuffer(const QRhiVulkan::DeferredReleaseEntry &e, void *allocator)
static VkAccessFlags toVkAccess(QRhiPassResourceTracker::TextureAccess access)
static VmaAllocator toVmaAllocator(QVkAllocator a)
static VkSamplerAddressMode toVkAddressMode(QRhiSampler::AddressMode m)
static constexpr bool isDepthTextureFormat(QRhiTexture::Format format)
static void fillVkStencilOpState(VkStencilOpState *dst, const QRhiGraphicsPipeline::StencilOpState &src)
VkSampleCountFlagBits mask
static VkShaderStageFlags toVkShaderStageFlags(QRhiShaderResourceBinding::StageFlags stage)
static constexpr VkImageAspectFlags aspectMaskForTextureFormat(QRhiTexture::Format format)
static VkDescriptorType toVkDescriptorType(const QRhiShaderResourceBinding::Data *b)
static VkBlendFactor toVkBlendFactor(QRhiGraphicsPipeline::BlendFactor f)
static void fillDriverInfo(QRhiDriverInfo *info, const VkPhysicalDeviceProperties &physDevProperties)
static VkBlendOp toVkBlendOp(QRhiGraphicsPipeline::BlendOp op)
static void qrhivk_releaseRenderBuffer(const QRhiVulkan::DeferredReleaseEntry &e, VkDevice dev, QVulkanDeviceFunctions *df)
static VkFrontFace toVkFrontFace(QRhiGraphicsPipeline::FrontFace f)
void qrhivk_accumulateComputeResource(T *writtenResources, QRhiResource *resource, QRhiShaderResourceBinding::Type bindingType, int loadTypeVal, int storeTypeVal, int loadStoreTypeVal)
static VkFormat toVkTextureFormat(QRhiTexture::Format format, QRhiTexture::Flags flags)
static VkCompareOp toVkCompareOp(QRhiGraphicsPipeline::CompareOp op)
static void fillRenderPassCreateInfo(VkRenderPassCreateInfo *rpInfo, VkSubpassDescription *subpassDesc, QVkRenderPassDescriptor *rpD)
static VkSamplerMipmapMode toVkMipmapMode(QRhiSampler::Filter f)
static void qrhivk_releaseSampler(const QRhiVulkan::DeferredReleaseEntry &e, VkDevice dev, QVulkanDeviceFunctions *df)
int count
static constexpr bool isStencilTextureFormat(QRhiTexture::Format format)
static QVkRenderTargetData * maybeRenderTargetData(QVkCommandBuffer *cbD)
static QRhiPassResourceTracker::UsageState toPassTrackerUsageState(const QVkTexture::UsageState &texUsage)
static VmaAllocation toVmaAllocation(QVkAlloc a)
static void addToChain(T *head, void *entry)
static VkShaderStageFlagBits toVkShaderStage(QRhiShaderStage::Type type)
static const int QVK_UNIFORM_BUFFERS_PER_POOL
static const int QVK_COMBINED_IMAGE_SAMPLERS_PER_POOL
Q_DECLARE_TYPEINFO(QVkCommandBuffer::ComputePassState::AccessFlagsAndIsNew, Q_RELOCATABLE_TYPE)
Q_DECLARE_TYPEINFO(QRhiVulkan::TextureReadback, Q_RELOCATABLE_TYPE)
static const int QVK_STORAGE_BUFFERS_PER_POOL
static const int QVK_STORAGE_IMAGES_PER_POOL
static const int QVK_SAMPLED_IMAGES_PER_POOL
void * QVkAllocator
Q_DECLARE_TYPEINFO(QRhiVulkan::DescriptorPoolData, Q_RELOCATABLE_TYPE)
Q_DECLARE_TYPEINFO(QVkBuffer::DynamicUpdate, Q_RELOCATABLE_TYPE)
Q_DECLARE_TYPEINFO(QRhiVulkan::DeferredReleaseEntry, Q_RELOCATABLE_TYPE)
static const int QVK_MAX_ACTIVE_TIMESTAMP_PAIRS
Q_DECLARE_TYPEINFO(QRhiVulkan::BufferReadback, Q_RELOCATABLE_TYPE)
static const int QVK_SAMPLERS_PER_POOL
static const int QVK_DESC_SETS_PER_POOL
void * QVkAlloc
static const int QVK_FRAMES_IN_FLIGHT
bool prepare(VkRenderPassCreateInfo *rpInfo, int multiViewCount, bool multiViewCap)
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1988
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1588
QRhiReadbackResult * result
VkBuffer stagingBuffers[QVK_FRAMES_IN_FLIGHT]
VkImageView rtv[QVkRenderTargetData::MAX_COLOR_ATTACHMENTS]
QVkAlloc allocations[QVK_FRAMES_IN_FLIGHT]
VkImageView extraImageViews[QRhi::MAX_MIP_LEVELS]
QVkAlloc stagingAllocations[QVK_FRAMES_IN_FLIGHT]
VkImageView resrtv[QVkRenderTargetData::MAX_COLOR_ATTACHMENTS]
VkBuffer buffers[QVK_FRAMES_IN_FLIGHT]
DescriptorPoolData(VkDescriptorPool pool_)
bool cmdFenceWaitable[QVK_FRAMES_IN_FLIGHT]
QVkCommandBuffer * cbWrapper[QVK_FRAMES_IN_FLIGHT]
int timestampQueryIndex[QVK_FRAMES_IN_FLIGHT]
VkFence cmdFence[QVK_FRAMES_IN_FLIGHT]
OffscreenFrame(QRhiImplementation *rhi)
QRhiTexture::Format format
QRhiReadbackDescription desc
QRhiReadbackResult * result
VkPipelineStageFlags stage
VkAccessFlags access
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
VkBuffer buffers[QVK_FRAMES_IN_FLIGHT]
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
QVarLengthFlatMap< QRhiResource *, AccessFlagsAndIsNew, 12 > writtenResources
VkBuffer currentVertexBuffers[VERTEX_INPUT_RESOURCE_SLOT_COUNT]
QVkCommandBuffer(QRhiImplementation *rhi)
QVector< QRhiPassResourceTracker > passResTrackers
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]
QVarLengthArray< char, 256 > pushConstantData
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
QRhiViewport currentViewport
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
VkIndexType currentIndexFormat
VkShaderStageFlags pushConstantStages
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)
VkShaderStageFlags pushConstantStages
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.
VkDeviceMemory memory
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
VkAttachmentReference shadingRateRef
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
VkSampler sampler
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)
VkDescriptorSetLayout layout
void updateResources(UpdateFlags flags) override
QVkShaderResourceBindings(QRhiImplementation *rhi)
bool create() override
Creates the corresponding resource binding set.
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
QVarLengthArray< QRhiShaderResourceBinding, BINDING_PREALLOC > sortedBindings
QVarLengthArray< BoundResourceData, BINDING_PREALLOC > boundResourceData[QVK_FRAMES_IN_FLIGHT]
QVarLengthArray< int, BINDING_PREALLOC > sortedDynamicOffsetBindingNumbers
VkDescriptorSet descSets[QVK_FRAMES_IN_FLIGHT]
bool createFrom(QRhiTexture *src) override
Sets up the shading rate map to use the texture src as the image containing the per-tile shading rate...
QVkShadingRateMap(QRhiImplementation *rhi)
QVkTexture * texture
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
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
QRhiRenderTarget * currentFrameRenderTarget(StereoTargetBuffer targetBuffer) override
VkFormat colorFormat
bool isFormatSupported(Format f) override
QVkCommandBuffer cbWrapper
static const quint32 EXPECTED_MAX_BUFFER_COUNT
const VkFormat defaultSrgbColorFormat
QRhiRenderPassDescriptor * newCompatibleRenderPassDescriptor() override
VkSampleCountFlagBits samples
bool supportsReadback
QVkSwapChain(QRhiImplementation *rhi)
QVkRenderBuffer * ds
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
VkImageView shadingRateMapView
bool ensureSurface()
QVkSwapChainRenderTarget rtWrapper
QRhiSwapChainHdrInfo hdrInfo() override
\variable QRhiSwapChainHdrInfo::limitsType
QRhiCommandBuffer * currentFrameCommandBuffer() override
const VkFormat defaultColorFormat
VkImageView shadingRateMapView
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
VkImage image
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
VkDependencyFlags dependencyFlags
VkPipelineStageFlags srcStageMask
VkPipelineStageFlags dstStageMask
VkRenderPassBeginInfo desc
VkPipelineBindPoint bindPoint