21#include "qdxgihdrinfo_p.h"
26class QVulkanFunctions;
27class QVulkanDeviceFunctions;
45 QVkBuffer(QRhiImplementation *rhi, Type type, UsageFlags usage, quint32 size);
78 QVkRenderBuffer(QRhiImplementation *rhi, Type type,
const QSize &pixelSize,
79 int sampleCount, Flags flags,
80 QRhiTexture::Format backingFormatHint);
99 QVkTexture(QRhiImplementation *rhi, Format format,
const QSize &pixelSize,
int depth,
100 int arraySize,
int sampleCount, Flags flags);
140 QVkSampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilter, Filter mipmapMode,
141 AddressMode u, AddressMode v, AddressMode w);
168 bool isCompatible(
const QRhiRenderPassDescriptor *other)
const override;
225 QVkTextureRenderTarget(QRhiImplementation *rhi,
const QRhiTextureRenderTargetDescription &desc, Flags flags);
276 } d[QRhiShaderResourceBinding::Data::MAX_TEX_SAMPLER_ARRAY_SIZE];
350 currentTarget =
nullptr;
351 activeSecondaryCbStack.clear();
357 currentGraphicsPipeline =
nullptr;
358 currentComputePipeline =
nullptr;
359 currentPipelineGeneration = 0;
360 currentGraphicsSrb =
nullptr;
361 currentComputeSrb =
nullptr;
362 currentSrbGeneration = 0;
364 currentIndexBuffer = VK_NULL_HANDLE;
365 currentIndexOffset = 0;
366 currentIndexFormat = VK_INDEX_TYPE_UINT16;
367 memset(currentVertexBuffers, 0,
sizeof(currentVertexBuffers));
368 memset(currentVertexOffsets, 0,
sizeof(currentVertexOffsets));
397 writtenResources.clear();
449 VkImageLayout dstLayout;
454 VkImageLayout srcLayout;
465 VkPipelineStageFlags srcStageMask;
466 VkPipelineStageFlags dstStageMask;
472 VkImageLayout srcLayout;
474 VkImageLayout dstLayout;
490 VkPipelineBindPoint bindPoint;
527 uint32_t instanceCount;
530 uint32_t firstInstance;
533#ifdef VK_EXT_debug_utils
534 VkDebugUtilsLabelEXT label;
541#ifdef VK_EXT_debug_utils
542 VkDebugUtilsLabelEXT label;
548 } transitionResources;
570 passResTrackers.clear();
575 pools.clearValue.clear();
576 pools.bufferImageCopy.clear();
577 pools.dynamicOffset.clear();
578 pools.vertexBuffer.clear();
579 pools.vertexBufferOffset.clear();
580 pools.debugMarkerData.clear();
581 pools.imageBarrier.clear();
582 pools.bufferBarrier.clear();
684 QRhiVulkan(QRhiVulkanInitParams *params, QRhiVulkanNativeHandles *importParams =
nullptr);
686 bool create(QRhi::Flags flags)
override;
694 QRhiBuffer::UsageFlags usage,
695 quint32 size)
override;
697 const QSize &pixelSize,
699 QRhiRenderBuffer::Flags flags,
700 QRhiTexture::Format backingFormatHint)
override;
702 const QSize &pixelSize,
706 QRhiTexture::Flags flags)
override;
708 QRhiSampler::Filter minFilter,
709 QRhiSampler::Filter mipmapMode,
710 QRhiSampler:: AddressMode u,
711 QRhiSampler::AddressMode v,
712 QRhiSampler::AddressMode w)
override;
715 QRhiTextureRenderTarget::Flags flags)
override;
729 QRhiRenderTarget *rt,
730 const QColor &colorClearValue,
731 const QRhiDepthStencilClearValue &depthStencilClearValue,
732 QRhiResourceUpdateBatch *resourceUpdates,
733 QRhiCommandBuffer::BeginPassFlags flags)
override;
734 void endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates)
override;
737 QRhiGraphicsPipeline *ps)
override;
740 QRhiShaderResourceBindings *srb,
741 int dynamicOffsetCount,
742 const QRhiCommandBuffer::DynamicOffset *dynamicOffsets)
override;
745 int startBinding,
int bindingCount,
const QRhiCommandBuffer::VertexInput *bindings,
746 QRhiBuffer *indexBuf, quint32 indexOffset,
747 QRhiCommandBuffer::IndexFormat indexFormat)
override;
749 void setViewport(QRhiCommandBuffer *cb,
const QRhiViewport &viewport)
override;
750 void setScissor(QRhiCommandBuffer *cb,
const QRhiScissor &scissor)
override;
752 void setStencilRef(QRhiCommandBuffer *cb, quint32 refValue)
override;
753 void setShadingRate(QRhiCommandBuffer *cb,
const QSize &coarsePixelSize)
override;
755 void draw(QRhiCommandBuffer *cb, quint32 vertexCount,
756 quint32 instanceCount, quint32 firstVertex, quint32 firstInstance)
override;
758 void drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount,
759 quint32 instanceCount, quint32 firstIndex,
760 qint32 vertexOffset, quint32 firstInstance)
override;
762 void debugMarkBegin(QRhiCommandBuffer *cb,
const QByteArray &name)
override;
764 void debugMarkMsg(QRhiCommandBuffer *cb,
const QByteArray &msg)
override;
767 QRhiResourceUpdateBatch *resourceUpdates,
768 QRhiCommandBuffer::BeginPassFlags flags)
override;
800 bool allocateDescriptorSet(VkDescriptorSetAllocateInfo *allocInfo, VkDescriptorSet *result,
int *resultPoolIndex);
803 VkImageAspectFlags aspectMask, VkSampleCountFlagBits samples,
804 VkDeviceMemory *mem, VkImage *images, VkImageView *views,
int count);
812 bool hasDepthStencil,
813 VkSampleCountFlagBits samples,
814 VkFormat colorFormat,
815 QRhiShadingRateMap *shadingRateMap);
817 const QRhiColorAttachment *colorAttachmentsBegin,
818 const QRhiColorAttachment *colorAttachmentsEnd,
822 QRhiRenderBuffer *depthStencilBuffer,
823 QRhiTexture *depthTexture,
824 QRhiTexture *depthResolveTexture,
825 QRhiShadingRateMap *shadingRateMap);
834 VkSemaphore *waitSem, VkSemaphore *signalSem);
839 const QRhiTextureSubresourceUploadDescription &subresDesc,
840 size_t *curOfs,
void *mp,
841 BufferImageCopyList *copyInfos);
861 void setObjectName(uint64_t object, VkObjectType type,
const QByteArray &name,
int slot = -1);
863 VkAccessFlags access, VkPipelineStageFlags stage);
865 VkImageLayout layout, VkAccessFlags access, VkPipelineStageFlags stage);
868 VkImageLayout oldLayout, VkImageLayout newLayout,
869 VkAccessFlags srcAccess, VkAccessFlags dstAccess,
870 VkPipelineStageFlags srcStage, VkPipelineStageFlags dstStage,
871 int startLayer,
int layerCount,
872 int startLevel,
int levelCount);
891 QVulkanFunctions *
f =
nullptr;
892 QVulkanDeviceFunctions *
df =
nullptr;
917#ifdef VK_EXT_debug_utils
933#ifdef VK_KHR_create_renderpass2
1039 } shaderResourceBindings;
1053 VkImageView imageView;
1069 } textureRenderTarget;
1079 } secondaryCommandBuffer;
1084#ifdef VK_KHR_fragment_shading_rate
void registerBuffer(QRhiBuffer *buf, int slot, BufferAccess *access, BufferStage *stage, const UsageState &state)
void registerTexture(QRhiTexture *tex, TextureAccess *access, TextureStage *stage, const UsageState &state)
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
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)
double elapsedSecondsFromTimestamp(quint64 timestamp[2], bool *ok)
QRhi::FrameOpResult beginOffscreenFrame(QRhiCommandBuffer **cb, QRhi::BeginFrameFlags flags) override
bool imageBasedShadingRate
bool createOffscreenRenderPass(QVkRenderPassDescriptor *rpD, const QRhiColorAttachment *colorAttachmentsBegin, const QRhiColorAttachment *colorAttachmentsEnd, bool preserveColor, bool preserveDs, bool storeDs, QRhiRenderBuffer *depthStencilBuffer, QRhiTexture *depthTexture, QRhiTexture *depthResolveTexture, QRhiShadingRateMap *shadingRateMap)
QVarLengthArray< VkSemaphore, 4 > waitSemaphoresForPresent
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
QVersionNumber apiVersion
VkResult createDescriptorPool(VkDescriptorPool *pool)
void prepareNewFrame(QRhiCommandBuffer *cb)
void subresourceBarrier(QVkCommandBuffer *cbD, VkImage image, VkImageLayout oldLayout, VkImageLayout newLayout, VkAccessFlags srcAccess, VkAccessFlags dstAccess, VkPipelineStageFlags srcStage, VkPipelineStageFlags dstStage, int startLayer, int layerCount, int startLevel, int levelCount)
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
bool depthStencilResolveKHR
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
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
int imageBasedShadingRateTileSize
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)
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 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
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 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
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)
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(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
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_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
VkBuffer stagingBuffers[QVK_FRAMES_IN_FLIGHT]
VkImageView rtv[QVkRenderTargetData::MAX_COLOR_ATTACHMENTS]
VkImageView shadingRateMapView
QVkAlloc allocations[QVK_FRAMES_IN_FLIGHT]
VkImageView extraImageViews[QRhi::MAX_MIP_LEVELS]
VkDescriptorSetLayout layout
QVkAlloc stagingAllocations[QVK_FRAMES_IN_FLIGHT]
QVkAlloc stagingAllocation
VkImageView resrtv[QVkRenderTargetData::MAX_COLOR_ATTACHMENTS]
VkBuffer buffers[QVK_FRAMES_IN_FLIGHT]
DescriptorPoolData(VkDescriptorPool pool_)
QVkCommandBuffer * cbWrapper[QVK_FRAMES_IN_FLIGHT]
OffscreenFrame(QRhiImplementation *rhi)
QRhiTexture::Format format
QRhiReadbackDescription desc
QRhiReadbackResult * result
VkPipelineStageFlags stage
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
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
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
QVarLengthArray< VkDeviceSize, 4 > vertexBufferOffset
VkBuffer currentIndexBuffer
uint currentSrbGeneration
QVarLengthArray< VkBuffer, 4 > vertexBuffer
QRhiGraphicsPipeline * currentGraphicsPipeline
int currentPassResTrackerIndex
QVarLengthArray< VkClearValue, 4 > clearValue
uint currentPipelineGeneration
quint32 currentIndexOffset
QVarLengthArray< uint32_t, 4 > dynamicOffset
QVarLengthArray< QByteArray, 4 > debugMarkerData
QHash< QRhiResource *, std::pair< VkAccessFlags, bool > > writtenResources
VkIndexType currentIndexFormat
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
QVkComputePipeline(QRhiImplementation *rhi)
QVkGraphicsPipeline(QRhiImplementation *rhi)
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
VkDescriptorSetLayout layout
void updateResources(UpdateFlags flags) override
QVkShaderResourceBindings(QRhiImplementation *rhi)
bool create() override
Creates the corresponding resource binding set.
QVarLengthArray< QRhiShaderResourceBinding, 8 > sortedBindings
QVarLengthArray< BoundResourceData, 8 > boundResourceData[QVK_FRAMES_IN_FLIGHT]
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
VkDescriptorSet descSets[QVK_FRAMES_IN_FLIGHT]
~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
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
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)
int vertexBufferOffsetIndex
VkPipelineLayout pipelineLayout
VkPipelineStageFlags srcStageMask
VkPipelineStageFlags dstStageMask
VkRenderPassBeginInfo desc
VkPipelineBindPoint bindPoint