21#include <QtCore/private/qflatmap_p.h>
24#include "qdxgihdrinfo_p.h"
29class QVulkanFunctions;
30class QVulkanDeviceFunctions;
50 QVkBuffer(QRhiImplementation *rhi, Type type, UsageFlags usage, quint32 size);
83 QVkRenderBuffer(QRhiImplementation *rhi, Type type,
const QSize &pixelSize,
84 int sampleCount, Flags flags,
85 QRhiTexture::Format backingFormatHint);
104 QVkTexture(QRhiImplementation *rhi, Format format,
const QSize &pixelSize,
int depth,
105 int arraySize,
int sampleCount, Flags flags);
145 QVkSampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilter, Filter mipmapMode,
146 AddressMode u, AddressMode v, AddressMode w);
173 bool isCompatible(
const QRhiRenderPassDescriptor *other)
const override;
230 QVkTextureRenderTarget(QRhiImplementation *rhi,
const QRhiTextureRenderTargetDescription &desc, Flags flags);
354 currentTarget =
nullptr;
355 activeSecondaryCbStack.clear();
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));
376 currentViewport = {};
377 currentStencilRef = 0;
413 writtenResources.clear();
472 VkImageLayout dstLayout;
474 int bufferImageCopyIndex;
478 VkImageLayout srcLayout;
480 VkImageLayout dstLayout;
485 VkImageLayout srcLayout;
488 int bufferImageCopyIndex;
491 VkPipelineStageFlags srcStageMask;
492 VkPipelineStageFlags dstStageMask;
497 VkPipelineStageFlags srcStageMask;
498 VkPipelineStageFlags dstStageMask;
499 VkAccessFlags srcAccessMask;
500 VkAccessFlags dstAccessMask;
501 VkDependencyFlags dependencyFlags;
504 VkPipelineStageFlags srcStageMask;
505 VkPipelineStageFlags dstStageMask;
510 VkPipelineStageFlags srcStageMask;
511 VkPipelineStageFlags dstStageMask;
516 } imageAndBufferBarrier;
519 VkImageLayout srcLayout;
521 VkImageLayout dstLayout;
526 VkRenderPassBeginInfo desc;
533 VkPipelineBindPoint bindPoint;
537 VkPipelineBindPoint bindPoint;
538 VkPipelineLayout pipelineLayout;
539 VkDescriptorSet descSet;
540 int dynamicOffsetCount;
541 int dynamicOffsetIndex;
546 int vertexBufferIndex;
547 int vertexBufferOffsetIndex;
567 uint32_t vertexCount;
568 uint32_t instanceCount;
569 uint32_t firstVertex;
570 uint32_t firstInstance;
574 uint32_t instanceCount;
576 int32_t vertexOffset;
577 uint32_t firstInstance;
580 VkBuffer indirectBuffer;
581 VkDeviceSize indirectBufferOffset;
586 VkBuffer indirectBuffer;
587 VkDeviceSize indirectBufferOffset;
590 } drawIndexedIndirect;
592 VkBuffer indirectBuffer;
593 VkDeviceSize indirectBufferOffset;
594 VkBuffer countBuffer;
595 VkDeviceSize countBufferOffset;
596 uint32_t maxDrawCount;
600 VkBuffer indirectBuffer;
601 VkDeviceSize indirectBufferOffset;
602 VkBuffer countBuffer;
603 VkDeviceSize countBufferOffset;
604 uint32_t maxDrawCount;
606 } drawIndexedIndirectCount;
608#ifdef VK_EXT_debug_utils
609 VkDebugUtilsLabelEXT label;
616#ifdef VK_EXT_debug_utils
617 VkDebugUtilsLabelEXT label;
623 } transitionResources;
628 VkBuffer indirectBuffer;
629 VkDeviceSize indirectBufferOffset;
639 VkPipelineLayout layout;
640 VkShaderStageFlags stages;
656 passResTrackers.clear();
661 pools.clearValue.clear();
662 pools.bufferImageCopy.clear();
663 pools.dynamicOffset.clear();
664 pools.vertexBuffer.clear();
665 pools.vertexBufferOffset.clear();
666 pools.debugMarkerData.clear();
667 pools.imageBarrier.clear();
668 pools.bufferBarrier.clear();
669 pools.pushConstantData.clear();
673 QVarLengthArray<VkClearValue, 4> clearValue;
674 QVarLengthArray<VkBufferImageCopy, 16> bufferImageCopy;
675 QVarLengthArray<uint32_t, 4> dynamicOffset;
676 QVarLengthArray<VkBuffer, 4> vertexBuffer;
677 QVarLengthArray<VkDeviceSize, 4> vertexBufferOffset;
678 QVarLengthArray<QByteArray, 4> debugMarkerData;
679 QVarLengthArray<VkImageMemoryBarrier, 8> imageBarrier;
680 QVarLengthArray<VkBufferMemoryBarrier, 8> bufferBarrier;
681 QVarLengthArray<
char, 256> pushConstantData;
775 QRhiVulkan(QRhiVulkanInitParams *params, QRhiVulkanNativeHandles *importParams =
nullptr);
777 bool create(QRhi::Flags flags)
override;
785 QRhiBuffer::UsageFlags usage,
786 quint32 size)
override;
788 const QSize &pixelSize,
790 QRhiRenderBuffer::Flags flags,
791 QRhiTexture::Format backingFormatHint)
override;
793 const QSize &pixelSize,
797 QRhiTexture::Flags flags)
override;
799 QRhiSampler::Filter minFilter,
800 QRhiSampler::Filter mipmapMode,
801 QRhiSampler:: AddressMode u,
802 QRhiSampler::AddressMode v,
803 QRhiSampler::AddressMode w)
override;
806 QRhiTextureRenderTarget::Flags flags)
override;
820 QRhiRenderTarget *rt,
821 const QColor &colorClearValue,
822 const QRhiDepthStencilClearValue &depthStencilClearValue,
823 QRhiResourceUpdateBatch *resourceUpdates,
824 QRhiCommandBuffer::BeginPassFlags flags)
override;
825 void endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates)
override;
828 QRhiGraphicsPipeline *ps)
override;
831 QRhiShaderResourceBindings *srb,
832 int dynamicOffsetCount,
833 const QRhiCommandBuffer::DynamicOffset *dynamicOffsets)
override;
836 int startBinding,
int bindingCount,
const QRhiCommandBuffer::VertexInput *bindings,
837 QRhiBuffer *indexBuf, quint32 indexOffset,
838 QRhiCommandBuffer::IndexFormat indexFormat)
override;
840 void setViewport(QRhiCommandBuffer *cb,
const QRhiViewport &viewport)
override;
841 void setScissor(QRhiCommandBuffer *cb,
const QRhiScissor &scissor)
override;
843 void setStencilRef(QRhiCommandBuffer *cb, quint32 refValue)
override;
844 void setPushConstants(QRhiCommandBuffer *cb, quint32 offset, quint32 size,
const void *data)
override;
845 void setShadingRate(QRhiCommandBuffer *cb,
const QSize &coarsePixelSize)
override;
847 void draw(QRhiCommandBuffer *cb, quint32 vertexCount,
848 quint32 instanceCount, quint32 firstVertex, quint32 firstInstance)
override;
850 void drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount,
851 quint32 instanceCount, quint32 firstIndex,
852 qint32 vertexOffset, quint32 firstInstance)
override;
854 void drawIndirect(QRhiCommandBuffer *cb, QRhiBuffer *indirectBuffer,
855 quint32 indirectBufferOffset, quint32 drawCount, quint32 stride)
override;
858 quint32 indirectBufferOffset, quint32 drawCount, quint32 stride)
override;
861 QRhiBuffer *indirectBuffer, quint32 indirectBufferOffset,
862 QRhiBuffer *countBuffer, quint32 countBufferOffset,
863 quint32 maxDrawCount, quint32 stride)
override;
865 QRhiBuffer *indirectBuffer, quint32 indirectBufferOffset,
866 QRhiBuffer *countBuffer, quint32 countBufferOffset,
867 quint32 maxDrawCount, quint32 stride)
override;
870 quint32 indirectBufferOffset)
override;
872 void debugMarkBegin(QRhiCommandBuffer *cb,
const QByteArray &name)
override;
874 void debugMarkMsg(QRhiCommandBuffer *cb,
const QByteArray &msg)
override;
877 QRhiResourceUpdateBatch *resourceUpdates,
878 QRhiCommandBuffer::BeginPassFlags flags)
override;
910 bool allocateDescriptorSet(VkDescriptorSetAllocateInfo *allocInfo, VkDescriptorSet *result,
int *resultPoolIndex);
913 VkImageAspectFlags aspectMask, VkSampleCountFlagBits samples,
914 VkDeviceMemory *mem, VkImage *images, VkImageView *views,
int count);
922 bool hasDepthStencil,
923 VkSampleCountFlagBits samples,
924 VkFormat colorFormat,
925 QRhiShadingRateMap *shadingRateMap);
927 const QRhiColorAttachment *colorAttachmentsBegin,
928 const QRhiColorAttachment *colorAttachmentsEnd,
932 QRhiRenderBuffer *depthStencilBuffer,
933 QRhiTexture *depthTexture,
934 QRhiTexture *depthResolveTexture,
936 QRhiShadingRateMap *shadingRateMap);
945 VkSemaphore *waitSem, VkSemaphore *signalSem);
950 const QRhiTextureSubresourceUploadDescription &subresDesc,
951 size_t *curOfs,
void *mp,
952 BufferImageCopyList *copyInfos);
967 QVarLengthArray<VkImageMemoryBarrier, 8> *imageBarriers,
968 QVarLengthArray<VkBufferMemoryBarrier, 8> *bufferBarriers);
975 void setObjectName(uint64_t object, VkObjectType type,
const QByteArray &name,
int slot = -1);
977 VkAccessFlags access, VkPipelineStageFlags stage);
979 VkImageLayout layout, VkAccessFlags access, VkPipelineStageFlags stage);
982 VkImageLayout oldLayout, VkImageLayout newLayout,
983 VkAccessFlags srcAccess, VkAccessFlags dstAccess,
984 VkPipelineStageFlags srcStage, VkPipelineStageFlags dstStage,
985 int startLayer,
int layerCount,
986 int startLevel,
int levelCount);
1010 QVulkanFunctions *
f =
nullptr;
1011 QVulkanDeviceFunctions *
df =
nullptr;
1014#ifdef VK_VERSION_1_1
1018#ifdef VK_VERSION_1_2
1022#ifdef VK_VERSION_1_3
1025#ifdef VK_VERSION_1_4
1040#ifdef VK_EXT_debug_utils
1056#ifdef VK_KHR_create_renderpass2
1060#ifdef VK_VERSION_1_2
1066#ifdef VK_EXT_device_fault
1071 bool compute =
false;
1072 bool depthClamp =
false;
1073 bool wideLines =
false;
1074 bool debugUtils =
false;
1075 bool deviceFault =
false;
1076 bool vertexAttribDivisor =
false;
1077 bool texture3DSliceAs2D =
false;
1078 bool tessellation =
false;
1079 bool geometryShader =
false;
1080 bool nonFillPolygonMode =
false;
1081 bool multiView =
false;
1082 bool renderPass2KHR =
false;
1083 bool depthStencilResolveKHR =
false;
1084 bool perDrawShadingRate =
false;
1085 bool imageBasedShadingRate =
false;
1086 QVersionNumber apiVersion;
1087 int imageBasedShadingRateTileSize = 0;
1088 bool drawIndirectMulti =
false;
1089 bool shaderDrawParameters =
false;
1090 bool drawIndirectCount =
false;
1122 cmdFence[i] = VK_NULL_HANDLE;
1176 VkPipeline pipeline;
1177 VkPipelineLayout layout;
1181 VkDescriptorSetLayout layout;
1182 } shaderResourceBindings;
1190 VkDeviceMemory memory;
1192 VkImageView imageView;
1196 VkImageView imageView;
1200 VkImageView extraImageViews[QRhi::MAX_MIP_LEVELS];
1211 VkImageView shadingRateMapView;
1212 } textureRenderTarget;
1217 VkBuffer stagingBuffer;
1222 } secondaryCommandBuffer;
1227#ifdef VK_KHR_fragment_shading_rate
const QRhiPassResourceMap< QRhiTexture *, Texture, 12 > & textures() const
void registerBuffer(QRhiBuffer *buf, int slot, BufferAccess *access, BufferStage *stage, const UsageState &state)
void registerTexture(QRhiTexture *tex, TextureAccess *access, TextureStage *stage, const UsageState &state)
const QRhiPassResourceMap< QRhiBuffer *, Buffer, 12 > & buffers() const
static QRhiResourceUpdateBatchPrivate * get(QRhiResourceUpdateBatch *b)
QVarLengthArray< DescriptorPoolData, 8 > descriptorPools
void recordTransitionPassResources(QVkCommandBuffer *cbD, const QRhiPassResourceTracker &tracker)
quint32 gfxQueueFamilyIdx
VkCommandBuffer startSecondaryCommandBuffer(QVkRenderTargetData *rtD=nullptr)
QRhiSwapChain * createSwapChain() override
PFN_vkGetSwapchainImagesKHR vkGetSwapchainImagesKHR
void debugMarkMsg(QRhiCommandBuffer *cb, const QByteArray &msg) override
int resourceLimit(QRhi::ResourceLimit limit) const override
bool isDeviceLost() const override
void prepareUploadSubres(QVkTexture *texD, int layer, int level, const QRhiTextureSubresourceUploadDescription &subresDesc, size_t *curOfs, void *mp, BufferImageCopyList *copyInfos)
VkPhysicalDeviceProperties physDevProperties
void executeDeferredReleases(bool forced=false)
uint32_t chooseTransientImageMemType(VkImage img, uint32_t startIndex)
QRhi::FrameOpResult finish() override
quint32 timestampValidBits
QRhiTextureRenderTarget * createTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc, QRhiTextureRenderTarget::Flags flags) override
bool createTransientImage(VkFormat format, const QSize &pixelSize, VkImageUsageFlags usage, VkImageAspectFlags aspectMask, VkSampleCountFlagBits samples, VkDeviceMemory *mem, VkImage *images, VkImageView *views, int count)
void setScissor(QRhiCommandBuffer *cb, const QRhiScissor &scissor) override
void releaseCachedResources() override
QVkSwapChain * currentSwapChain
void collectComputeBarriers(QVkCommandBuffer *cbD, QVarLengthArray< VkImageMemoryBarrier, 8 > *imageBarriers, QVarLengthArray< VkBufferMemoryBarrier, 8 > *bufferBarriers)
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
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)
QRhi::FrameOpResult beginOffscreenFrame(QRhiCommandBuffer **cb, QRhi::BeginFrameFlags flags) override
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
void dispatch(QRhiCommandBuffer *cb, int x, int y, int z) override
VkPhysicalDeviceFeatures physDevFeatures
QRhiVulkanNativeHandles nativeHandlesStruct
bool allocateDescriptorSet(VkDescriptorSetAllocateInfo *allocInfo, VkDescriptorSet *result, int *resultPoolIndex)
bool isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture::Flags flags) const override
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)
double lastCompletedGpuTime(QRhiCommandBuffer *cb) override
void recordStencilRef(QVkCommandBuffer *cbD, quint32 refValue)
void trackedRegisterTexture(QRhiPassResourceTracker *passResTracker, QVkTexture *texD, QRhiPassResourceTracker::TextureAccess access, QRhiPassResourceTracker::TextureStage stage)
bool releaseCachedResourcesCalledBeforeFrameStart
PFN_vkCreateSwapchainKHR vkCreateSwapchainKHR
QRhiGraphicsPipeline * createGraphicsPipeline() override
QRhiComputePipeline * createComputePipeline() override
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
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
void setShadingRate(QRhiCommandBuffer *cb, const QSize &coarsePixelSize) override
void debugMarkEnd(QRhiCommandBuffer *cb) override
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
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
void finishActiveReadbacks(bool forced=false)
void ensureCommandPoolForNewFrame()
QByteArray pipelineCacheData() override
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
PFN_vkAcquireNextImageKHR vkAcquireNextImageKHR
QMatrix4x4 clipSpaceCorrMatrix() const override
QSet< QVkSwapChain * > swapchains
int ubufAlignment() const override
QRhiDriverInfo driverInfo() const override
void beginExternal(QRhiCommandBuffer *cb) override
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)
bool makeThreadLocalNativeContextCurrent() override
QRhiDriverInfo adapterInfo
QRhiDriverInfo info() const override
Combined button and popup list for selecting options.
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)
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)
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 void addSelfDependency(QVkRenderPassDescriptor *rpD)
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
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
static const int QVK_FRAMES_IN_FLIGHT
bool prepare(VkRenderPassCreateInfo *rpInfo, int multiViewCount, bool multiViewCap)
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
QRhiReadbackResult * result
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
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]
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
@ TransitionPassResources
@ DrawIndexedIndirectCount
VkAccessFlags accessFlags
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
QRhiVulkanCommandBufferNativeHandles nativeHandlesStruct
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
VkBuffer currentIndexBuffer
uint currentSrbGeneration
quint32 currentStencilRef
QRhiGraphicsPipeline * currentGraphicsPipeline
int currentPassResTrackerIndex
uint currentPipelineGeneration
quint32 currentIndexOffset
VkIndexType currentIndexFormat
VkShaderStageFlags pushConstantStages
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
QVkComputePipeline(QRhiImplementation *rhi)
QVkGraphicsPipeline(QRhiImplementation *rhi)
VkShaderStageFlags pushConstantStages
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
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)
VkSampleCountFlagBits samples
QRhiTexture::Format backingFormat() const override
bool create() override
Creates the corresponding native graphics resources.
QVkTexture * backingTexture
QVarLengthArray< VkSubpassDependency, 2 > subpassDeps
const QRhiNativeHandles * nativeHandles() override
void updateSerializedFormat()
QVector< quint32 > serializedFormatData
bool hasDepthStencilResolve
QVarLengthArray< VkAttachmentReference, 8 > colorRefs
~QVkRenderPassDescriptor()
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
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)
BoundStorageImageData simage
BoundStorageBufferData sbuf
BoundSampledTextureData stex
BoundUniformBufferData ubuf
QVarLengthArray< Entry, 1 > d
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]
~QVkShaderResourceBindings()
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)
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
~QVkSwapChainRenderTarget()
QVkSwapChainRenderTarget(QRhiImplementation *rhi, QRhiSwapChain *swapchain)
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
@ ScImageUseTransferSource
VkImageView msaaImageView
VkColorSpaceKHR colorSpace
VkSurfaceKHR lastConnectedSurface
bool createOrResize() override
Creates the swapchain if not already done and resizes the swapchain buffers to match the current size...
QRhiRenderTarget * currentFrameRenderTarget(StereoTargetBuffer targetBuffer) override
bool isFormatSupported(Format f) override
QVkCommandBuffer cbWrapper
static const quint32 EXPECTED_MAX_BUFFER_COUNT
const VkFormat defaultSrgbColorFormat
QRhiRenderPassDescriptor * newCompatibleRenderPassDescriptor() override
VkSampleCountFlagBits samples
QVkSwapChain(QRhiImplementation *rhi)
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
QVarLengthArray< VkPresentModeKHR, 8 > supportedPresentationModes
QVkSwapChainRenderTarget rtWrapperRight
VkImageView shadingRateMapView
QVkSwapChainRenderTarget rtWrapper
QRhiSwapChainHdrInfo hdrInfo() override
\variable QRhiSwapChainHdrInfo::limitsType
QRhiCommandBuffer * currentFrameCommandBuffer() override
const VkFormat defaultColorFormat
VkImageView shadingRateMapView
QVkTextureRenderTarget(QRhiImplementation *rhi, const QRhiTextureRenderTargetDescription &desc, Flags flags)
~QVkTextureRenderTarget()
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
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]
VkImageView perLevelImageViewForLoadStore(int level)
VkSampleCountFlagBits samples
QVkAlloc stagingAllocations[QVK_FRAMES_IN_FLIGHT]
bool createFrom(NativeTexture src) override
Similar to create(), except that no new native textures are created.
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
bool prepareCreate(QSize *adjustedSize=nullptr)