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;
484 } copyImageToBuffer;
485 struct {
488 int count;
489 int index;
490 } imageBarrier;
491 struct {
492 VkPipelineStageFlags srcStageMask;
493 VkPipelineStageFlags dstStageMask;
497 } memoryBarrier;
498 struct {
499 VkPipelineStageFlags srcStageMask;
500 VkPipelineStageFlags dstStageMask;
501 int count;
502 int index;
503 } bufferBarrier;
504 struct {
505 VkPipelineStageFlags srcStageMask;
506 VkPipelineStageFlags dstStageMask;
511 } imageAndBufferBarrier;
512 struct {
513 VkImage src;
514 VkImageLayout srcLayout;
515 VkImage dst;
516 VkImageLayout dstLayout;
519 } blitImage;
520 struct {
524 } beginRenderPass;
525 struct {
526 } endRenderPass;
527 struct {
530 } bindPipeline;
531 struct {
532 VkPipelineBindPoint bindPoint;
537 } bindDescriptorSet;
538 struct {
540 int count;
543 } bindVertexBuffer;
544 struct {
548 } bindIndexBuffer;
549 struct {
551 } setViewport;
552 struct {
554 } setScissor;
555 struct {
556 float c[4];
557 } setBlendConstants;
558 struct {
560 } setStencilRef;
561 struct {
566 } draw;
567 struct {
569 uint32_t instanceCount;
572 uint32_t firstInstance;
573 } drawIndexed;
574 struct {
579 } drawIndirect;
580 struct {
581 VkBuffer indirectBuffer;
582 VkDeviceSize indirectBufferOffset;
583 uint32_t drawCount;
584 uint32_t stride;
585 } drawIndexedIndirect;
586 struct {
587 VkBuffer indirectBuffer;
588 VkDeviceSize indirectBufferOffset;
592 uint32_t stride;
593 } drawIndirectCount;
594 struct {
595 VkBuffer indirectBuffer;
596 VkDeviceSize indirectBufferOffset;
597 VkBuffer countBuffer;
598 VkDeviceSize countBufferOffset;
599 uint32_t maxDrawCount;
600 uint32_t stride;
601 } drawIndexedIndirectCount;
602 struct {
603#ifdef VK_EXT_debug_utils
604 VkDebugUtilsLabelEXT label;
605 int labelNameIndex;
606#endif
607 } debugMarkerBegin;
608 struct {
609 } debugMarkerEnd;
610 struct {
611#ifdef VK_EXT_debug_utils
612 VkDebugUtilsLabelEXT label;
613 int labelNameIndex;
614#endif
615 } debugMarkerInsert;
616 struct {
618 } transitionResources;
619 struct {
620 int x, y, z;
621 } dispatch;
622 struct {
623 VkBuffer indirectBuffer;
624 VkDeviceSize indirectBufferOffset;
625 } dispatchIndirect;
626 struct {
628 } executeSecondary;
629 struct {
632 } setShadingRate;
633 struct {
639 } setPushConstants;
640 } args;
641 };
642
646
648 commands.reset();
650
651 passResTrackers.clear();
653 }
654
655 void resetPools() {
656 pools.clearValue.clear();
657 pools.bufferImageCopy.clear();
658 pools.dynamicOffset.clear();
659 pools.vertexBuffer.clear();
660 pools.vertexBufferOffset.clear();
661 pools.debugMarkerData.clear();
662 pools.imageBarrier.clear();
663 pools.bufferBarrier.clear();
664 pools.pushConstantData.clear();
665 }
666
667 struct {
677 } pools;
678
679 friend class QRhiVulkan;
680};
681
683
685{
686 QVkSwapChain(QRhiImplementation *rhi);
687 ~QVkSwapChain();
688 void destroy() override;
689
690 QRhiCommandBuffer *currentFrameCommandBuffer() override;
692 QRhiRenderTarget *currentFrameRenderTarget(StereoTargetBuffer targetBuffer) override;
693
694 QSize surfacePixelSize() override;
695 bool isFormatSupported(Format f) override;
697
700
701 bool ensureSurface();
702
704
705 QWindow *window = nullptr;
707 bool supportsReadback = false;
708 bool stereo = false;
710 int bufferCount = 0;
717 QVkRenderBuffer *ds = nullptr;
725
741
751
752 quint32 currentImageIndex = 0; // index in imageRes
753 int frameCount = 0;
754
755 friend class QRhiVulkan;
756};
757
759{
760public:
761 QRhiDriverInfo info() const override;
762
765};
766
768{
769public:
770 QRhiVulkan(QRhiVulkanInitParams *params, QRhiVulkanNativeHandles *importParams = nullptr);
771
772 bool create(QRhi::Flags flags) override;
773 void destroy() override;
774 QRhi::AdapterList enumerateAdaptersBeforeCreate(QRhiNativeHandles *nativeHandles) const override;
775
779 QRhiBuffer *createBuffer(QRhiBuffer::Type type,
780 QRhiBuffer::UsageFlags usage,
781 quint32 size) override;
782 QRhiRenderBuffer *createRenderBuffer(QRhiRenderBuffer::Type type,
783 const QSize &pixelSize,
784 int sampleCount,
785 QRhiRenderBuffer::Flags flags,
786 QRhiTexture::Format backingFormatHint) override;
787 QRhiTexture *createTexture(QRhiTexture::Format format,
788 const QSize &pixelSize,
789 int depth,
790 int arraySize,
791 int sampleCount,
792 QRhiTexture::Flags flags) override;
793 QRhiSampler *createSampler(QRhiSampler::Filter magFilter,
794 QRhiSampler::Filter minFilter,
795 QRhiSampler::Filter mipmapMode,
796 QRhiSampler:: AddressMode u,
797 QRhiSampler::AddressMode v,
798 QRhiSampler::AddressMode w) override;
799
800 QRhiTextureRenderTarget *createTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc,
801 QRhiTextureRenderTarget::Flags flags) override;
802
803 QRhiShadingRateMap *createShadingRateMap() override;
804
805 QRhiSwapChain *createSwapChain() override;
806 QRhi::FrameOpResult beginFrame(QRhiSwapChain *swapChain, QRhi::BeginFrameFlags flags) override;
807 QRhi::FrameOpResult endFrame(QRhiSwapChain *swapChain, QRhi::EndFrameFlags flags) override;
808 QRhi::FrameOpResult beginOffscreenFrame(QRhiCommandBuffer **cb, QRhi::BeginFrameFlags flags) override;
809 QRhi::FrameOpResult endOffscreenFrame(QRhi::EndFrameFlags flags) override;
810 QRhi::FrameOpResult finish() override;
811
812 void resourceUpdate(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
813
814 void beginPass(QRhiCommandBuffer *cb,
815 QRhiRenderTarget *rt,
816 const QColor &colorClearValue,
817 const QRhiDepthStencilClearValue &depthStencilClearValue,
818 QRhiResourceUpdateBatch *resourceUpdates,
819 QRhiCommandBuffer::BeginPassFlags flags) override;
820 void endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
821
822 void setGraphicsPipeline(QRhiCommandBuffer *cb,
823 QRhiGraphicsPipeline *ps) override;
824
825 void setShaderResources(QRhiCommandBuffer *cb,
826 QRhiShaderResourceBindings *srb,
827 int dynamicOffsetCount,
828 const QRhiCommandBuffer::DynamicOffset *dynamicOffsets) override;
829
830 void setVertexInput(QRhiCommandBuffer *cb,
831 int startBinding, int bindingCount, const QRhiCommandBuffer::VertexInput *bindings,
832 QRhiBuffer *indexBuf, quint32 indexOffset,
833 QRhiCommandBuffer::IndexFormat indexFormat) override;
834
835 void setViewport(QRhiCommandBuffer *cb, const QRhiViewport &viewport) override;
836 void setScissor(QRhiCommandBuffer *cb, const QRhiScissor &scissor) override;
837 void setBlendConstants(QRhiCommandBuffer *cb, const QColor &c) override;
838 void setStencilRef(QRhiCommandBuffer *cb, quint32 refValue) override;
839 void setPushConstants(QRhiCommandBuffer *cb, quint32 offset, quint32 size, const void *data) override;
840 void setShadingRate(QRhiCommandBuffer *cb, const QSize &coarsePixelSize) override;
841
842 void draw(QRhiCommandBuffer *cb, quint32 vertexCount,
843 quint32 instanceCount, quint32 firstVertex, quint32 firstInstance) override;
844
845 void drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount,
846 quint32 instanceCount, quint32 firstIndex,
847 qint32 vertexOffset, quint32 firstInstance) override;
848
849 void drawIndirect(QRhiCommandBuffer *cb, QRhiBuffer *indirectBuffer,
850 quint32 indirectBufferOffset, quint32 drawCount, quint32 stride) override;
851
852 void drawIndexedIndirect(QRhiCommandBuffer *cb, QRhiBuffer *indirectBuffer,
853 quint32 indirectBufferOffset, quint32 drawCount, quint32 stride) override;
854
855 void drawIndirectCount(QRhiCommandBuffer *cb,
856 QRhiBuffer *indirectBuffer, quint32 indirectBufferOffset,
857 QRhiBuffer *countBuffer, quint32 countBufferOffset,
858 quint32 maxDrawCount, quint32 stride) override;
859 void drawIndexedIndirectCount(QRhiCommandBuffer *cb,
860 QRhiBuffer *indirectBuffer, quint32 indirectBufferOffset,
861 QRhiBuffer *countBuffer, quint32 countBufferOffset,
862 quint32 maxDrawCount, quint32 stride) override;
863
864 void dispatchIndirect(QRhiCommandBuffer *cb, QRhiBuffer *indirectBuffer,
865 quint32 indirectBufferOffset) override;
866
867 void debugMarkBegin(QRhiCommandBuffer *cb, const QByteArray &name) override;
868 void debugMarkEnd(QRhiCommandBuffer *cb) override;
869 void debugMarkMsg(QRhiCommandBuffer *cb, const QByteArray &msg) override;
870
871 void beginComputePass(QRhiCommandBuffer *cb,
872 QRhiResourceUpdateBatch *resourceUpdates,
873 QRhiCommandBuffer::BeginPassFlags flags) override;
874 void endComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
875 void setComputePipeline(QRhiCommandBuffer *cb, QRhiComputePipeline *ps) override;
876 void dispatch(QRhiCommandBuffer *cb, int x, int y, int z) override;
877
878 const QRhiNativeHandles *nativeHandles(QRhiCommandBuffer *cb) override;
879 void beginExternal(QRhiCommandBuffer *cb) override;
880 void endExternal(QRhiCommandBuffer *cb) override;
881 double lastCompletedGpuTime(QRhiCommandBuffer *cb) override;
882
883 QList<int> supportedSampleCounts() const override;
884 QList<QSize> supportedShadingRates(int sampleCount) const override;
885 int ubufAlignment() const override;
886 bool isYUpInFramebuffer() const override;
887 bool isYUpInNDC() const override;
888 bool isClipDepthZeroToOne() const override;
889 QMatrix4x4 clipSpaceCorrMatrix() const override;
890 bool isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture::Flags flags) const override;
891 bool isFeatureSupported(QRhi::Feature feature) const override;
892 int resourceLimit(QRhi::ResourceLimit limit) const override;
893 const QRhiNativeHandles *nativeHandles() override;
894 QRhiDriverInfo driverInfo() const override;
895 QRhiStats statistics() override;
897 void setQueueSubmitParams(QRhiNativeHandles *params) override;
899 bool isDeviceLost() const override;
900
901 QByteArray pipelineCacheData() override;
902 void setPipelineCacheData(const QByteArray &data) override;
903
904 VkResult createDescriptorPool(VkDescriptorPool *pool);
905 bool allocateDescriptorSet(VkDescriptorSetAllocateInfo *allocInfo, VkDescriptorSet *result, int *resultPoolIndex);
906 uint32_t chooseTransientImageMemType(VkImage img, uint32_t startIndex);
907 bool createTransientImage(VkFormat format, const QSize &pixelSize, VkImageUsageFlags usage,
908 VkImageAspectFlags aspectMask, VkSampleCountFlagBits samples,
909 VkDeviceMemory *mem, VkImage *images, VkImageView *views, int count);
910
911 bool recreateSwapChain(QRhiSwapChain *swapChain);
912 void releaseSwapChainResources(QRhiSwapChain *swapChain);
913
917 bool hasDepthStencil,
918 VkSampleCountFlagBits samples,
919 VkFormat colorFormat,
920 QRhiShadingRateMap *shadingRateMap);
922 const QRhiColorAttachment *colorAttachmentsBegin,
923 const QRhiColorAttachment *colorAttachmentsEnd,
924 bool preserveColor,
925 bool preserveDs,
926 bool storeDs,
927 QRhiRenderBuffer *depthStencilBuffer,
928 QRhiTexture *depthTexture,
929 QRhiTexture *depthResolveTexture,
930 int depthLayer,
931 QRhiShadingRateMap *shadingRateMap);
932 bool ensurePipelineCache(const void *initialData = nullptr, size_t initialDataSize = 0);
933 VkShaderModule createShader(const QByteArray &spirv);
934
935 void prepareNewFrame(QRhiCommandBuffer *cb);
937 void endAndEnqueueSecondaryCommandBuffer(VkCommandBuffer cb, QVkCommandBuffer *cbD);
938 QRhi::FrameOpResult startPrimaryCommandBuffer(VkCommandBuffer *cb);
939 QRhi::FrameOpResult endAndSubmitPrimaryCommandBuffer(VkCommandBuffer cb, VkFence cmdFence,
940 VkSemaphore *waitSem, VkSemaphore *signalSem);
942 VkDeviceSize subresUploadByteSize(const QRhiTextureSubresourceUploadDescription &subresDesc) const;
944 void prepareUploadSubres(QVkTexture *texD, int layer, int level,
945 const QRhiTextureSubresourceUploadDescription &subresDesc,
946 size_t *curOfs, void *mp,
947 BufferImageCopyList *copyInfos);
948 void enqueueResourceUpdates(QVkCommandBuffer *cbD, QRhiResourceUpdateBatch *resourceUpdates);
949 void executeBufferHostWritesForSlot(QVkBuffer *bufD, int slot);
953 QVkBuffer *bufD,
954 int slot,
958 QVkTexture *texD,
962 QVarLengthArray<VkImageMemoryBarrier, 8> *imageBarriers,
963 QVarLengthArray<VkBufferMemoryBarrier, 8> *bufferBarriers);
966 void executeDeferredReleases(bool forced = false);
967 void finishActiveReadbacks(bool forced = false);
968
969 void setAllocationName(QVkAlloc allocation, const QByteArray &name, int slot = -1);
970 void setObjectName(uint64_t object, VkObjectType type, const QByteArray &name, int slot = -1);
971 void trackedBufferBarrier(QVkCommandBuffer *cbD, QVkBuffer *bufD, int slot,
972 VkAccessFlags access, VkPipelineStageFlags stage);
974 VkImageLayout layout, VkAccessFlags access, VkPipelineStageFlags stage);
976 void subresourceBarrier(QVkCommandBuffer *cbD, VkImage image,
977 VkImageLayout oldLayout, VkImageLayout newLayout,
978 VkAccessFlags srcAccess, VkAccessFlags dstAccess,
979 VkPipelineStageFlags srcStage, VkPipelineStageFlags dstStage,
980 int startLayer, int layerCount,
981 int startLevel, int levelCount);
982 void updateShaderResourceBindings(QRhiShaderResourceBindings *srb);
984 double elapsedSecondsFromTimestamp(quint64 timestamp[2], bool *ok);
985 void printExtraErrorInfo(VkResult err);
987 void printDeviceLossErrorInfo() const;
989
991 QWindow *maybeWindow = nullptr;
993 bool importedDevice = false;
1002 bool importedAllocator = false;
1004 QVulkanFunctions *f = nullptr;
1005 QVulkanDeviceFunctions *df = nullptr;
1008#ifdef VK_VERSION_1_1
1011#endif
1012#ifdef VK_VERSION_1_2
1015#endif
1016#ifdef VK_VERSION_1_3
1018#endif
1019#ifdef VK_VERSION_1_4
1021#endif
1025 bool deviceLost = false;
1027
1028#ifdef Q_OS_WIN
1029 bool adapterLuidValid = false;
1031 QDxgiHdrInfo *dxgiHdrInfo = nullptr;
1032#endif
1033
1034#ifdef VK_EXT_debug_utils
1039#endif
1040
1049
1050#ifdef VK_KHR_create_renderpass2
1052#endif
1053
1054#ifdef VK_VERSION_1_2
1055 // Vulkan 1.2 core, not in QVulkanDeviceFunctions, so resolved manually.
1058#endif
1059
1060#ifdef VK_EXT_device_fault
1062#endif
1063
1064 struct {
1065 bool compute = false;
1066 bool depthClamp = false;
1067 bool wideLines = false;
1068 bool debugUtils = false;
1069 bool deviceFault = false;
1072 bool tessellation = false;
1073 bool geometryShader = false;
1075 bool multiView = false;
1076 bool renderPass2KHR = false;
1082 bool drawIndirectMulti = false;
1084 bool drawIndirectCount = false;
1085 } caps;
1086
1099
1102
1105
1110
1112 OffscreenFrame(QRhiImplementation *rhi)
1113 {
1114 for (int i = 0; i < QVK_FRAMES_IN_FLIGHT; ++i) {
1115 cbWrapper[i] = new QVkCommandBuffer(rhi);
1116 cmdFence[i] = VK_NULL_HANDLE;
1117 cmdFenceWaitable[i] = false;
1118 timestampQueryIndex[i] = -1;
1119 }
1120 }
1122 {
1123 for (int i = 0; i < QVK_FRAMES_IN_FLIGHT; ++i)
1124 delete cbWrapper[i];
1125 }
1126 bool active = false;
1131 } ofr;
1132
1152
1167 int lastActiveFrameSlot; // -1 if not used otherwise 0..FRAMES_IN_FLIGHT-1
1168 union {
1169 struct {
1172 } pipelineState;
1173 struct {
1176 } shaderResourceBindings;
1177 struct {
1182 } buffer;
1183 struct {
1187 } renderBuffer;
1188 struct {
1189 VkImage image;
1190 VkImageView imageView;
1192 VkBuffer stagingBuffers[QVK_FRAMES_IN_FLIGHT];
1193 QVkAlloc stagingAllocations[QVK_FRAMES_IN_FLIGHT];
1194 VkImageView extraImageViews[QRhi::MAX_MIP_LEVELS];
1195 } texture;
1196 struct {
1198 } sampler;
1199 struct {
1206 } textureRenderTarget;
1207 struct {
1209 } renderPass;
1210 struct {
1213 } stagingBuffer;
1214 struct {
1216 } secondaryCommandBuffer;
1217 };
1218 };
1220
1221#ifdef VK_KHR_fragment_shading_rate
1224#endif
1225
1230};
1231
1236
1237QT_END_NAMESPACE
1238
1239#endif
const char * constData() const
Definition qrhi_p.h:477
bool isEmpty() const
Definition qrhi.cpp:13634
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:13651
void registerTexture(QRhiTexture *tex, TextureAccess *access, TextureStage *stage, const UsageState &state)
Definition qrhi.cpp:13691
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