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#ifdef Q_OS_WIN
22#include "qdxgihdrinfo_p.h"
23#endif
24
26
27class QVulkanFunctions;
28class QVulkanDeviceFunctions;
29
30static const int QVK_FRAMES_IN_FLIGHT = 2;
31
32static const int QVK_DESC_SETS_PER_POOL = 128;
33static const int QVK_UNIFORM_BUFFERS_PER_POOL = 256;
35static const int QVK_SAMPLED_IMAGES_PER_POOL = 256;
36static const int QVK_SAMPLERS_PER_POOL = 256;
37static const int QVK_STORAGE_BUFFERS_PER_POOL = 128;
38static const int QVK_STORAGE_IMAGES_PER_POOL = 128;
39
40static const int QVK_MAX_ACTIVE_TIMESTAMP_PAIRS = 16;
41
42// no vk_mem_alloc.h available here, void* is good enough
43typedef void * QVkAlloc;
44typedef void * QVkAllocator;
45
74
76
77struct QVkTexture;
78
80{
81 QVkRenderBuffer(QRhiImplementation *rhi, Type type, const QSize &pixelSize,
82 int sampleCount, Flags flags,
83 QRhiTexture::Format backingFormatHint);
85 void destroy() override;
86 bool create() override;
87 QRhiTexture::Format backingFormat() const override;
88
97 friend class QRhiVulkan;
98};
99
100struct QVkTexture : public QRhiTexture
101{
102 QVkTexture(QRhiImplementation *rhi, Format format, const QSize &pixelSize, int depth,
103 int arraySize, int sampleCount, Flags flags);
104 ~QVkTexture();
105 void destroy() override;
106 bool create() override;
107 bool createFrom(NativeTexture src) override;
108 NativeTexture nativeTexture() override;
109 void setNativeLayout(int layout) override;
110
111 bool prepareCreate(QSize *adjustedSize = nullptr);
112 bool finishCreate();
114
121 bool owns = true;
122 struct UsageState {
123 // no tracking of subresource layouts (some operations can keep
124 // subresources in different layouts for some time, but that does not
125 // need to be kept track of)
129 };
138 friend class QRhiVulkan;
139};
140
141struct QVkSampler : public QRhiSampler
142{
143 QVkSampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilter, Filter mipmapMode,
144 AddressMode u, AddressMode v, AddressMode w);
145 ~QVkSampler();
146 void destroy() override;
147 bool create() override;
148
152 friend class QRhiVulkan;
153};
154
156{
157 QVkShadingRateMap(QRhiImplementation *rhi);
159 void destroy() override;
160 bool createFrom(QRhiTexture *src) override;
161
162 QVkTexture *texture = nullptr; // not owned
163 friend class QRhiVulkan;
164};
165
195
212
214{
215 QVkSwapChainRenderTarget(QRhiImplementation *rhi, QRhiSwapChain *swapchain);
217 void destroy() override;
218
219 QSize pixelSize() const override;
220 float devicePixelRatio() const override;
221 int sampleCount() const override;
222
224};
225
248
250{
251 QVkShaderResourceBindings(QRhiImplementation *rhi);
253 void destroy() override;
254 bool create() override;
255 void updateResources(UpdateFlags flags) override;
256
259 int poolIndex = -1;
261 VkDescriptorSet descSets[QVK_FRAMES_IN_FLIGHT]; // multiple sets to support dynamic buffers
264
265 // Keep track of the generation number of each referenced QRhi* to be able
266 // to detect that the underlying descriptor set became out of date and they
267 // need to be written again with the up-to-date VkBuffer etc. objects.
273 int count;
274 struct {
279 } d[QRhiShaderResourceBinding::Data::MAX_TEX_SAMPLER_ARRAY_SIZE];
280 };
298
299 friend class QRhiVulkan;
300};
301
303
317
331
333{
334 QVkCommandBuffer(QRhiImplementation *rhi);
336 void destroy() override;
337
339
342
348
349 void resetState() {
351 passUsesSecondaryCb = false;
352 lastGpuTime = 0;
353 currentTarget = nullptr;
354 activeSecondaryCbStack.clear();
357 }
358
360 currentGraphicsPipeline = nullptr;
361 currentComputePipeline = nullptr;
362 currentPipelineGeneration = 0;
363 currentGraphicsSrb = nullptr;
364 currentComputeSrb = nullptr;
365 currentSrbGeneration = 0;
367 currentIndexBuffer = VK_NULL_HANDLE;
368 currentIndexOffset = 0;
369 currentIndexFormat = VK_INDEX_TYPE_UINT16;
370 memset(currentVertexBuffers, 0, sizeof(currentVertexBuffers));
371 memset(currentVertexOffsets, 0, sizeof(currentVertexOffsets));
372 inExternal = false;
373 hasShadingRateSet = false;
374 hasCustomScissorSet = false;
375 currentViewport = {};
376 }
377
380 double lastGpuTime = 0;
392 static const int VERTEX_INPUT_RESOURCE_SLOT_COUNT = 32;
400
407 void reset() {
408 writtenResources.clear();
409 }
410 } computePassState;
411
412 struct Command {
449
450 union Args {
451 struct {
455 } copyBuffer;
456 struct {
457 VkBuffer src;
460 int count;
462 } copyBufferToImage;
463 struct {
466 VkImage dst;
467 VkImageLayout dstLayout;
469 } copyImage;
470 struct {
471 VkImage src;
472 VkImageLayout srcLayout;
473 VkBuffer dst;
475 } copyImageToBuffer;
476 struct {
479 int count;
480 int index;
481 } imageBarrier;
482 struct {
483 VkPipelineStageFlags srcStageMask;
484 VkPipelineStageFlags dstStageMask;
488 } memoryBarrier;
489 struct {
490 VkPipelineStageFlags srcStageMask;
491 VkPipelineStageFlags dstStageMask;
492 int count;
493 int index;
494 } bufferBarrier;
495 struct {
496 VkPipelineStageFlags srcStageMask;
497 VkPipelineStageFlags dstStageMask;
502 } imageAndBufferBarrier;
503 struct {
504 VkImage src;
505 VkImageLayout srcLayout;
506 VkImage dst;
507 VkImageLayout dstLayout;
510 } blitImage;
511 struct {
515 } beginRenderPass;
516 struct {
517 } endRenderPass;
518 struct {
521 } bindPipeline;
522 struct {
523 VkPipelineBindPoint bindPoint;
528 } bindDescriptorSet;
529 struct {
531 int count;
534 } bindVertexBuffer;
535 struct {
539 } bindIndexBuffer;
540 struct {
542 } setViewport;
543 struct {
545 } setScissor;
546 struct {
547 float c[4];
548 } setBlendConstants;
549 struct {
551 } setStencilRef;
552 struct {
557 } draw;
558 struct {
560 uint32_t instanceCount;
563 uint32_t firstInstance;
564 } drawIndexed;
565 struct {
570 } drawIndirect;
571 struct {
572 VkBuffer indirectBuffer;
573 VkDeviceSize indirectBufferOffset;
574 uint32_t drawCount;
575 uint32_t stride;
576 } drawIndexedIndirect;
577 struct {
578 VkBuffer indirectBuffer;
579 VkDeviceSize indirectBufferOffset;
583 uint32_t stride;
584 } drawIndirectCount;
585 struct {
586 VkBuffer indirectBuffer;
587 VkDeviceSize indirectBufferOffset;
588 VkBuffer countBuffer;
589 VkDeviceSize countBufferOffset;
590 uint32_t maxDrawCount;
591 uint32_t stride;
592 } drawIndexedIndirectCount;
593 struct {
594#ifdef VK_EXT_debug_utils
595 VkDebugUtilsLabelEXT label;
596 int labelNameIndex;
597#endif
598 } debugMarkerBegin;
599 struct {
600 } debugMarkerEnd;
601 struct {
602#ifdef VK_EXT_debug_utils
603 VkDebugUtilsLabelEXT label;
604 int labelNameIndex;
605#endif
606 } debugMarkerInsert;
607 struct {
609 } transitionResources;
610 struct {
611 int x, y, z;
612 } dispatch;
613 struct {
614 VkBuffer indirectBuffer;
615 VkDeviceSize indirectBufferOffset;
616 } dispatchIndirect;
617 struct {
619 } executeSecondary;
620 struct {
623 } setShadingRate;
624 } args;
625 };
626
630
632 commands.reset();
634
635 passResTrackers.clear();
637 }
638
639 void resetPools() {
640 pools.clearValue.clear();
641 pools.bufferImageCopy.clear();
642 pools.dynamicOffset.clear();
643 pools.vertexBuffer.clear();
644 pools.vertexBufferOffset.clear();
645 pools.debugMarkerData.clear();
646 pools.imageBarrier.clear();
647 pools.bufferBarrier.clear();
648 }
649
650 struct {
659 } pools;
660
661 friend class QRhiVulkan;
662};
663
665
667{
668 QVkSwapChain(QRhiImplementation *rhi);
669 ~QVkSwapChain();
670 void destroy() override;
671
672 QRhiCommandBuffer *currentFrameCommandBuffer() override;
674 QRhiRenderTarget *currentFrameRenderTarget(StereoTargetBuffer targetBuffer) override;
675
676 QSize surfacePixelSize() override;
677 bool isFormatSupported(Format f) override;
679
682
683 bool ensureSurface();
684
686
687 QWindow *window = nullptr;
689 bool supportsReadback = false;
690 bool stereo = false;
692 int bufferCount = 0;
699 QVkRenderBuffer *ds = nullptr;
707
723
733
734 quint32 currentImageIndex = 0; // index in imageRes
735 int frameCount = 0;
736
737 friend class QRhiVulkan;
738};
739
741{
742public:
743 QRhiDriverInfo info() const override;
744
747};
748
750{
751public:
752 QRhiVulkan(QRhiVulkanInitParams *params, QRhiVulkanNativeHandles *importParams = nullptr);
753
754 bool create(QRhi::Flags flags) override;
755 void destroy() override;
756 QRhi::AdapterList enumerateAdaptersBeforeCreate(QRhiNativeHandles *nativeHandles) const override;
757
761 QRhiBuffer *createBuffer(QRhiBuffer::Type type,
762 QRhiBuffer::UsageFlags usage,
763 quint32 size) override;
764 QRhiRenderBuffer *createRenderBuffer(QRhiRenderBuffer::Type type,
765 const QSize &pixelSize,
766 int sampleCount,
767 QRhiRenderBuffer::Flags flags,
768 QRhiTexture::Format backingFormatHint) override;
769 QRhiTexture *createTexture(QRhiTexture::Format format,
770 const QSize &pixelSize,
771 int depth,
772 int arraySize,
773 int sampleCount,
774 QRhiTexture::Flags flags) override;
775 QRhiSampler *createSampler(QRhiSampler::Filter magFilter,
776 QRhiSampler::Filter minFilter,
777 QRhiSampler::Filter mipmapMode,
778 QRhiSampler:: AddressMode u,
779 QRhiSampler::AddressMode v,
780 QRhiSampler::AddressMode w) override;
781
782 QRhiTextureRenderTarget *createTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc,
783 QRhiTextureRenderTarget::Flags flags) override;
784
785 QRhiShadingRateMap *createShadingRateMap() override;
786
787 QRhiSwapChain *createSwapChain() override;
788 QRhi::FrameOpResult beginFrame(QRhiSwapChain *swapChain, QRhi::BeginFrameFlags flags) override;
789 QRhi::FrameOpResult endFrame(QRhiSwapChain *swapChain, QRhi::EndFrameFlags flags) override;
790 QRhi::FrameOpResult beginOffscreenFrame(QRhiCommandBuffer **cb, QRhi::BeginFrameFlags flags) override;
791 QRhi::FrameOpResult endOffscreenFrame(QRhi::EndFrameFlags flags) override;
792 QRhi::FrameOpResult finish() override;
793
794 void resourceUpdate(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
795
796 void beginPass(QRhiCommandBuffer *cb,
797 QRhiRenderTarget *rt,
798 const QColor &colorClearValue,
799 const QRhiDepthStencilClearValue &depthStencilClearValue,
800 QRhiResourceUpdateBatch *resourceUpdates,
801 QRhiCommandBuffer::BeginPassFlags flags) override;
802 void endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
803
804 void setGraphicsPipeline(QRhiCommandBuffer *cb,
805 QRhiGraphicsPipeline *ps) override;
806
807 void setShaderResources(QRhiCommandBuffer *cb,
808 QRhiShaderResourceBindings *srb,
809 int dynamicOffsetCount,
810 const QRhiCommandBuffer::DynamicOffset *dynamicOffsets) override;
811
812 void setVertexInput(QRhiCommandBuffer *cb,
813 int startBinding, int bindingCount, const QRhiCommandBuffer::VertexInput *bindings,
814 QRhiBuffer *indexBuf, quint32 indexOffset,
815 QRhiCommandBuffer::IndexFormat indexFormat) override;
816
817 void setViewport(QRhiCommandBuffer *cb, const QRhiViewport &viewport) override;
818 void setScissor(QRhiCommandBuffer *cb, const QRhiScissor &scissor) override;
819 void setBlendConstants(QRhiCommandBuffer *cb, const QColor &c) override;
820 void setStencilRef(QRhiCommandBuffer *cb, quint32 refValue) override;
821 void setShadingRate(QRhiCommandBuffer *cb, const QSize &coarsePixelSize) override;
822
823 void draw(QRhiCommandBuffer *cb, quint32 vertexCount,
824 quint32 instanceCount, quint32 firstVertex, quint32 firstInstance) override;
825
826 void drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount,
827 quint32 instanceCount, quint32 firstIndex,
828 qint32 vertexOffset, quint32 firstInstance) override;
829
830 void drawIndirect(QRhiCommandBuffer *cb, QRhiBuffer *indirectBuffer,
831 quint32 indirectBufferOffset, quint32 drawCount, quint32 stride) override;
832
833 void drawIndexedIndirect(QRhiCommandBuffer *cb, QRhiBuffer *indirectBuffer,
834 quint32 indirectBufferOffset, quint32 drawCount, quint32 stride) override;
835
836 void drawIndirectCount(QRhiCommandBuffer *cb,
837 QRhiBuffer *indirectBuffer, quint32 indirectBufferOffset,
838 QRhiBuffer *countBuffer, quint32 countBufferOffset,
839 quint32 maxDrawCount, quint32 stride) override;
840 void drawIndexedIndirectCount(QRhiCommandBuffer *cb,
841 QRhiBuffer *indirectBuffer, quint32 indirectBufferOffset,
842 QRhiBuffer *countBuffer, quint32 countBufferOffset,
843 quint32 maxDrawCount, quint32 stride) override;
844
845 void dispatchIndirect(QRhiCommandBuffer *cb, QRhiBuffer *indirectBuffer,
846 quint32 indirectBufferOffset) override;
847
848 void debugMarkBegin(QRhiCommandBuffer *cb, const QByteArray &name) override;
849 void debugMarkEnd(QRhiCommandBuffer *cb) override;
850 void debugMarkMsg(QRhiCommandBuffer *cb, const QByteArray &msg) override;
851
852 void beginComputePass(QRhiCommandBuffer *cb,
853 QRhiResourceUpdateBatch *resourceUpdates,
854 QRhiCommandBuffer::BeginPassFlags flags) override;
855 void endComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
856 void setComputePipeline(QRhiCommandBuffer *cb, QRhiComputePipeline *ps) override;
857 void dispatch(QRhiCommandBuffer *cb, int x, int y, int z) override;
858
859 const QRhiNativeHandles *nativeHandles(QRhiCommandBuffer *cb) override;
860 void beginExternal(QRhiCommandBuffer *cb) override;
861 void endExternal(QRhiCommandBuffer *cb) override;
862 double lastCompletedGpuTime(QRhiCommandBuffer *cb) override;
863
864 QList<int> supportedSampleCounts() const override;
865 QList<QSize> supportedShadingRates(int sampleCount) const override;
866 int ubufAlignment() const override;
867 bool isYUpInFramebuffer() const override;
868 bool isYUpInNDC() const override;
869 bool isClipDepthZeroToOne() const override;
870 QMatrix4x4 clipSpaceCorrMatrix() const override;
871 bool isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture::Flags flags) const override;
872 bool isFeatureSupported(QRhi::Feature feature) const override;
873 int resourceLimit(QRhi::ResourceLimit limit) const override;
874 const QRhiNativeHandles *nativeHandles() override;
875 QRhiDriverInfo driverInfo() const override;
876 QRhiStats statistics() override;
878 void setQueueSubmitParams(QRhiNativeHandles *params) override;
880 bool isDeviceLost() const override;
881
882 QByteArray pipelineCacheData() override;
883 void setPipelineCacheData(const QByteArray &data) override;
884
885 VkResult createDescriptorPool(VkDescriptorPool *pool);
886 bool allocateDescriptorSet(VkDescriptorSetAllocateInfo *allocInfo, VkDescriptorSet *result, int *resultPoolIndex);
887 uint32_t chooseTransientImageMemType(VkImage img, uint32_t startIndex);
888 bool createTransientImage(VkFormat format, const QSize &pixelSize, VkImageUsageFlags usage,
889 VkImageAspectFlags aspectMask, VkSampleCountFlagBits samples,
890 VkDeviceMemory *mem, VkImage *images, VkImageView *views, int count);
891
892 bool recreateSwapChain(QRhiSwapChain *swapChain);
893 void releaseSwapChainResources(QRhiSwapChain *swapChain);
894
898 bool hasDepthStencil,
899 VkSampleCountFlagBits samples,
900 VkFormat colorFormat,
901 QRhiShadingRateMap *shadingRateMap);
903 const QRhiColorAttachment *colorAttachmentsBegin,
904 const QRhiColorAttachment *colorAttachmentsEnd,
905 bool preserveColor,
906 bool preserveDs,
907 bool storeDs,
908 QRhiRenderBuffer *depthStencilBuffer,
909 QRhiTexture *depthTexture,
910 QRhiTexture *depthResolveTexture,
911 int depthLayer,
912 QRhiShadingRateMap *shadingRateMap);
913 bool ensurePipelineCache(const void *initialData = nullptr, size_t initialDataSize = 0);
914 VkShaderModule createShader(const QByteArray &spirv);
915
916 void prepareNewFrame(QRhiCommandBuffer *cb);
918 void endAndEnqueueSecondaryCommandBuffer(VkCommandBuffer cb, QVkCommandBuffer *cbD);
919 QRhi::FrameOpResult startPrimaryCommandBuffer(VkCommandBuffer *cb);
920 QRhi::FrameOpResult endAndSubmitPrimaryCommandBuffer(VkCommandBuffer cb, VkFence cmdFence,
921 VkSemaphore *waitSem, VkSemaphore *signalSem);
923 VkDeviceSize subresUploadByteSize(const QRhiTextureSubresourceUploadDescription &subresDesc) const;
925 void prepareUploadSubres(QVkTexture *texD, int layer, int level,
926 const QRhiTextureSubresourceUploadDescription &subresDesc,
927 size_t *curOfs, void *mp,
928 BufferImageCopyList *copyInfos);
929 void enqueueResourceUpdates(QVkCommandBuffer *cbD, QRhiResourceUpdateBatch *resourceUpdates);
930 void executeBufferHostWritesForSlot(QVkBuffer *bufD, int slot);
934 QVkBuffer *bufD,
935 int slot,
939 QVkTexture *texD,
943 QVarLengthArray<VkImageMemoryBarrier, 8> *imageBarriers,
944 QVarLengthArray<VkBufferMemoryBarrier, 8> *bufferBarriers);
947 void executeDeferredReleases(bool forced = false);
948 void finishActiveReadbacks(bool forced = false);
949
950 void setAllocationName(QVkAlloc allocation, const QByteArray &name, int slot = -1);
951 void setObjectName(uint64_t object, VkObjectType type, const QByteArray &name, int slot = -1);
952 void trackedBufferBarrier(QVkCommandBuffer *cbD, QVkBuffer *bufD, int slot,
953 VkAccessFlags access, VkPipelineStageFlags stage);
955 VkImageLayout layout, VkAccessFlags access, VkPipelineStageFlags stage);
957 void subresourceBarrier(QVkCommandBuffer *cbD, VkImage image,
958 VkImageLayout oldLayout, VkImageLayout newLayout,
959 VkAccessFlags srcAccess, VkAccessFlags dstAccess,
960 VkPipelineStageFlags srcStage, VkPipelineStageFlags dstStage,
961 int startLayer, int layerCount,
962 int startLevel, int levelCount);
963 void updateShaderResourceBindings(QRhiShaderResourceBindings *srb);
965 double elapsedSecondsFromTimestamp(quint64 timestamp[2], bool *ok);
966 void printExtraErrorInfo(VkResult err);
968 void printDeviceLossErrorInfo() const;
970
972 QWindow *maybeWindow = nullptr;
974 bool importedDevice = false;
983 bool importedAllocator = false;
985 QVulkanFunctions *f = nullptr;
986 QVulkanDeviceFunctions *df = nullptr;
989#ifdef VK_VERSION_1_1
992#endif
993#ifdef VK_VERSION_1_2
996#endif
997#ifdef VK_VERSION_1_3
999#endif
1000#ifdef VK_VERSION_1_4
1002#endif
1006 bool deviceLost = false;
1008
1009#ifdef Q_OS_WIN
1010 bool adapterLuidValid = false;
1012 QDxgiHdrInfo *dxgiHdrInfo = nullptr;
1013#endif
1014
1015#ifdef VK_EXT_debug_utils
1020#endif
1021
1030
1031#ifdef VK_KHR_create_renderpass2
1033#endif
1034
1035#ifdef VK_VERSION_1_2
1036 // Vulkan 1.2 core, not in QVulkanDeviceFunctions, so resolved manually.
1039#endif
1040
1041#ifdef VK_EXT_device_fault
1043#endif
1044
1045 struct {
1046 bool compute = false;
1047 bool depthClamp = false;
1048 bool wideLines = false;
1049 bool debugUtils = false;
1050 bool deviceFault = false;
1053 bool tessellation = false;
1054 bool geometryShader = false;
1056 bool multiView = false;
1057 bool renderPass2KHR = false;
1063 bool drawIndirectMulti = false;
1065 bool drawIndirectCount = false;
1066 } caps;
1067
1080
1083
1086
1091
1093 OffscreenFrame(QRhiImplementation *rhi)
1094 {
1095 for (int i = 0; i < QVK_FRAMES_IN_FLIGHT; ++i) {
1096 cbWrapper[i] = new QVkCommandBuffer(rhi);
1097 cmdFence[i] = VK_NULL_HANDLE;
1098 cmdFenceWaitable[i] = false;
1099 timestampQueryIndex[i] = -1;
1100 }
1101 }
1103 {
1104 for (int i = 0; i < QVK_FRAMES_IN_FLIGHT; ++i)
1105 delete cbWrapper[i];
1106 }
1107 bool active = false;
1112 } ofr;
1113
1133
1148 int lastActiveFrameSlot; // -1 if not used otherwise 0..FRAMES_IN_FLIGHT-1
1149 union {
1150 struct {
1153 } pipelineState;
1154 struct {
1157 } shaderResourceBindings;
1158 struct {
1163 } buffer;
1164 struct {
1168 } renderBuffer;
1169 struct {
1170 VkImage image;
1171 VkImageView imageView;
1173 VkBuffer stagingBuffers[QVK_FRAMES_IN_FLIGHT];
1174 QVkAlloc stagingAllocations[QVK_FRAMES_IN_FLIGHT];
1175 VkImageView extraImageViews[QRhi::MAX_MIP_LEVELS];
1176 } texture;
1177 struct {
1179 } sampler;
1180 struct {
1187 } textureRenderTarget;
1188 struct {
1190 } renderPass;
1191 struct {
1194 } stagingBuffer;
1195 struct {
1197 } secondaryCommandBuffer;
1198 };
1199 };
1201
1202#ifdef VK_KHR_fragment_shading_rate
1205#endif
1206
1211};
1212
1217
1218QT_END_NAMESPACE
1219
1220#endif
const char * constData() const
Definition qrhi_p.h:414
bool isEmpty() const
Definition qrhi.cpp:13217
void registerBuffer(QRhiBuffer *buf, int slot, BufferAccess *access, BufferStage *stage, const UsageState &state)
Definition qrhi.cpp:13234
void registerTexture(QRhiTexture *tex, TextureAccess *access, TextureStage *stage, const UsageState &state)
Definition qrhi.cpp:13274
static QRhiResourceUpdateBatchPrivate * get(QRhiResourceUpdateBatch *b)
Definition qrhi_p.h:639
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 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:327
@ Bounded
Definition qrhi_p.h:328
#define QRHI_RES_RHI(t)
Definition qrhi_p.h:31
#define QRHI_RES(t, x)
Definition qrhi_p.h:30
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 bool isSrgbFormat(VkFormat format)
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 bool hdrFormatMatchesVkSurfaceFormat(QRhiSwapChain::Format f, const VkSurfaceFormatKHR &s)
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(QVkShaderResourceBindings::BoundResourceData, 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:1962
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1566
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]
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
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
QVkComputePipeline(QRhiImplementation *rhi)
bool create() override
VkPipelineLayout layout
QVkGraphicsPipeline(QRhiImplementation *rhi)
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
VkPipelineLayout layout
bool create() override
Creates the corresponding native graphics resources.
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
QVkRenderBuffer(QRhiImplementation *rhi, Type type, const QSize &pixelSize, int sampleCount, Flags flags, QRhiTexture::Format backingFormatHint)
VkFormat vkformat
VkSampleCountFlagBits samples
QRhiTexture::Format backingFormat() const override
bool create() override
Creates the corresponding native graphics resources.
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