Go to the documentation of this file.
69 class DeviceContextVkImpl;
77 m_ContentType{
static_cast<Uint32>(ContentType)}
104 "Immutable sampler can only be assigned to a combined image sampler or a separate sampler");
137 m_pResources {pResources }
149 return m_pResources[CacheOffset];
167 return m_pResources[CacheOffset];
170 Resource*
const m_pResources =
nullptr;
179 return reinterpret_cast<const DescriptorSet*
>(m_pMemory.get())[Index];
185 VERIFY(DescrSet.GetSize() > 0,
"Descriptor set is empty");
186 VERIFY(!DescrSet.m_DescriptorSetAllocation,
"Descriptor set alloction has already been initialized");
187 DescrSet.m_DescriptorSetAllocation = std::move(Allocation);
209 #ifdef DILIGENT_DEBUG
211 void DbgVerifyResourceInitialization()
const;
212 void DbgVerifyDynamicBuffersCounter()
const;
215 template <
bool VerifyOnly>
221 Resource* GetFirstResourcePtr()
223 return reinterpret_cast<Resource*
>(
reinterpret_cast<DescriptorSet*
>(m_pMemory.get()) + m_NumSets);
225 const Resource* GetFirstResourcePtr()
const
227 return reinterpret_cast<const Resource*
>(
reinterpret_cast<const DescriptorSet*
>(m_pMemory.get()) + m_NumSets);
233 return reinterpret_cast<DescriptorSet*
>(m_pMemory.get())[Index];
236 std::unique_ptr<void, STDDeleter<void, IMemoryAllocator>> m_pMemory;
242 Uint16 m_NumDynamicBuffers = 0;
243 Uint32 m_TotalResources : 31;
246 const Uint32 m_ContentType : 1;
248 #ifdef DILIGENT_DEBUG
250 std::vector<std::vector<bool>> m_DbgInitializedResources;
256 std::vector<uint32_t>& Offsets)
const
273 const auto SetSize = DescrSet.GetSize();
276 while (res < SetSize)
278 const auto& Res = DescrSet.GetResource(res);
281 const auto* pBufferVk = Res.pObject.RawPtr<
const BufferVkImpl>();
282 const auto Offset = pBufferVk !=
nullptr ? pBufferVk->
GetDynamicOffset(CtxId, pCtxVkImpl) : 0;
283 Offsets[OffsetInd++] = Offset;
290 while (res < SetSize)
292 const auto& Res = DescrSet.GetResource(res);
297 const auto* pBufferVk = pBufferVkView !=
nullptr ? pBufferVkView->
GetBuffer<
const BufferVkImpl>() :
nullptr;
298 const auto Offset = pBufferVk !=
nullptr ? pBufferVk->GetDynamicOffset(CtxId, pCtxVkImpl) : 0;
299 Offsets[OffsetInd++] = Offset;
306 #ifdef DILIGENT_DEBUG
307 for (; res < SetSize; ++res)
309 const auto& Res = DescrSet.GetResource(res);
313 "All dynamic uniform and storage buffers are expected to go first in the beginning of each descriptor set");
ResourceCacheContentType
The type of the content that is stored in the shader resource cache.
Definition: ShaderResourceCacheCommon.hpp:39
VkDescriptorImageInfo GetSamplerDescriptorWriteInfo() const
Definition: ShaderResourceCacheVk.cpp:689
const Resource & GetResource(Uint32 CacheOffset) const
Definition: ShaderResourceCacheVk.hpp:146
Definition: ShaderResourceCacheVk.hpp:97
const DescriptorType Type
Definition: ShaderResourceCacheVk.hpp:113
VkDescriptorImageInfo GetImageDescriptorWriteInfo() const
Definition: ShaderResourceCacheVk.cpp:619
void TransitionResources(DeviceContextVkImpl *pCtxVkImpl)
Definition: ShaderResourceCacheVk.cpp:340
void InitializeSets(IMemoryAllocator &MemAllocator, Uint32 NumSets, const Uint32 *SetSizes)
Definition: ShaderResourceCacheVk.cpp:53
bool IsNull() const
Definition: ShaderResourceCacheVk.hpp:127
const Resource & ResetResource(Uint32 SetIndex, Uint32 Offset)
Definition: ShaderResourceCacheVk.hpp:198
Definition: VulkanLogicalDevice.hpp:88
@ StorageBufferDynamic_ReadOnly
Resource(DescriptorType _Type, bool _HasImmutableSampler) noexcept
Definition: ShaderResourceCacheVk.hpp:99
Uint32 GetDynamicOffset(Uint32 CtxId, DeviceContextVkImpl *pCtx) const
Definition: BufferVkImpl.hpp:71
VkBufferView GetBufferViewWriteInfo() const
Definition: ShaderResourceCacheVk.cpp:674
ResourceCacheContentType GetContentType() const
Definition: ShaderResourceCacheVk.hpp:207
Uint32 GetSize() const
Definition: ShaderResourceCacheVk.hpp:152
VkDescriptorImageInfo GetInputAttachmentDescriptorWriteInfo() const
Definition: ShaderResourceCacheVk.cpp:705
Resource & operator=(const Resource &)=delete
Definition: ShaderResourceCacheVk.hpp:72
~ShaderResourceCacheVk()
Definition: ShaderResourceCacheVk.cpp:165
__forceinline Uint32 GetDynamicBufferOffsets(Uint32 CtxId, DeviceContextVkImpl *pCtxVkImpl, std::vector< uint32_t > &Offsets) const
Definition: ShaderResourceCacheVk.hpp:254
virtual IBuffer * GetBuffer() const override final
Implementation of IBufferView::GetBuffer()
Definition: BufferViewBase.hpp:83
VkWriteDescriptorSetAccelerationStructureKHR GetAccelerationStructureWriteInfo() const
Definition: ShaderResourceCacheVk.cpp:721
Definition: DescriptorPoolManager.hpp:50
const bool HasImmutableSampler
Definition: ShaderResourceCacheVk.hpp:114
Template class that implements reference counting.
Definition: RefCntAutoPtr.hpp:73
DescriptorSet(Uint32 NumResources, Resource *pResources)
Definition: ShaderResourceCacheVk.hpp:135
const D3D12_PIPELINE_STATE_SUBOBJECT_TYPE Type
Definition: PipelineStateD3D12Impl.cpp:69
uint32_t Uint32
32-bit unsigned integer
Definition: BasicTypes.h:51
Device context implementation in Vulkan backend.
Definition: DeviceContextVkImpl.hpp:67
VkDescriptorBufferInfo GetUniformBufferDescriptorWriteInfo() const
Definition: ShaderResourceCacheVk.cpp:548
Definition: ShaderResourceCacheVk.hpp:131
DescriptorType
Definition: PipelineResourceAttribsVk.hpp:42
VkDescriptorBufferInfo GetStorageBufferDescriptorWriteInfo() const
Definition: ShaderResourceCacheVk.cpp:571
static size_t GetRequiredMemorySize(Uint32 NumSets, const Uint32 *SetSizes)
Definition: ShaderResourceCacheVk.cpp:44
Buffer object implementation in Vulkan backend.
Definition: BufferVkImpl.hpp:46
uint16_t Uint16
16-bit unsigned integer
Definition: BasicTypes.h:52
Uint32 GetNumDescriptorSets() const
Definition: ShaderResourceCacheVk.hpp:204
DescriptorSet & operator=(const DescriptorSet &)=delete
ShaderResourceCacheVk(ResourceCacheContentType ContentType) noexcept
Definition: ShaderResourceCacheVk.hpp:75
#define VERIFY_EXPR(...)
Definition: DebugUtilities.hpp:79
const Resource & SetResource(const VulkanUtilities::VulkanLogicalDevice *pLogicalDevice, Uint32 SetIndex, Uint32 Offset, Uint32 BindingIndex, Uint32 ArrayIndex, RefCntAutoPtr< IDeviceObject > &&pObject)
Definition: ShaderResourceCacheVk.cpp:177
#define VERIFY(...)
Definition: DebugUtilities.hpp:76
void AssignDescriptorSetAllocation(Uint32 SetIndex, DescriptorSetAllocation &&Allocation)
Definition: ShaderResourceCacheVk.hpp:182
VkDescriptorSet GetVkDescriptorSet() const
Definition: DescriptorPoolManager.hpp:112
VkDescriptorSet GetVkDescriptorSet() const
Definition: ShaderResourceCacheVk.hpp:154
void InitializeResources(Uint32 Set, Uint32 Offset, Uint32 ArraySize, DescriptorType Type, bool HasImmutableSampler)
Definition: ShaderResourceCacheVk.cpp:103
RefCntAutoPtr< IDeviceObject > pObject
Definition: ShaderResourceCacheVk.hpp:116
ShaderResourceCacheVk & operator=(const ShaderResourceCacheVk &)=delete
Buffer view implementation in Vulkan backend.
Definition: BufferViewVkImpl.hpp:41
The library uses Direct3D-style math:
Definition: AdvancedMath.hpp:37
const DescriptorSet & GetDescriptorSet(Uint32 Index) const
Definition: ShaderResourceCacheVk.hpp:176
const Uint32 m_NumResources
Definition: ShaderResourceCacheVk.hpp:160
Uint32 GetNumDynamicBuffers() const
Definition: ShaderResourceCacheVk.hpp:205