summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineVulkan
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2021-03-07 21:21:43 +0000
committerassiduous <assiduous@diligentgraphics.com>2021-03-19 00:38:17 +0000
commit68bb8ce116ce83bc94d2af87563e8dc1c9fab0b4 (patch)
tree0a015869da0e3b1c3c45276be8aca3aabeaa76b0 /Graphics/GraphicsEngineVulkan
parentFixed ShaderResourceLayoutTest for non-separable programs (diff)
downloadDiligentCore-68bb8ce116ce83bc94d2af87563e8dc1c9fab0b4.tar.gz
DiligentCore-68bb8ce116ce83bc94d2af87563e8dc1c9fab0b4.zip
Replaced duplicate CacheContentType enums with the common ResourceCacheContentType
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
-rw-r--r--Graphics/GraphicsEngineVulkan/include/PipelineResourceSignatureVkImpl.hpp11
-rw-r--r--Graphics/GraphicsEngineVulkan/include/ShaderResourceCacheVk.hpp7
-rw-r--r--Graphics/GraphicsEngineVulkan/src/PipelineResourceSignatureVkImpl.cpp17
-rw-r--r--Graphics/GraphicsEngineVulkan/src/ShaderResourceBindingVkImpl.cpp2
4 files changed, 15 insertions, 22 deletions
diff --git a/Graphics/GraphicsEngineVulkan/include/PipelineResourceSignatureVkImpl.hpp b/Graphics/GraphicsEngineVulkan/include/PipelineResourceSignatureVkImpl.hpp
index 57173a57..a1513c03 100644
--- a/Graphics/GraphicsEngineVulkan/include/PipelineResourceSignatureVkImpl.hpp
+++ b/Graphics/GraphicsEngineVulkan/include/PipelineResourceSignatureVkImpl.hpp
@@ -36,6 +36,7 @@
#include "PipelineResourceSignatureBase.hpp"
#include "VulkanUtilities/VulkanObjectWrappers.hpp"
#include "SRBMemoryAllocator.hpp"
+#include "ShaderResourceCacheCommon.hpp"
namespace Diligent
{
@@ -102,12 +103,6 @@ public:
return (HasDescriptorSet(DESCRIPTOR_SET_ID_STATIC_MUTABLE) ? 1 : 0) + (HasDescriptorSet(DESCRIPTOR_SET_ID_DYNAMIC) ? 1 : 0);
}
- enum class CacheContentType
- {
- Signature = 0, // only static resources
- SRB = 1 // in SRB
- };
-
// sizeof(ResourceAttribs) == 16, x64
struct ResourceAttribs
{
@@ -167,9 +162,9 @@ public:
VERIFY(DescrSet == _DescrSet, "Descriptor set (", _DescrSet, ") exceeds maximum representable value");
}
- Uint32 CacheOffset(CacheContentType CacheType) const
+ Uint32 CacheOffset(ResourceCacheContentType CacheType) const
{
- return CacheType == CacheContentType::SRB ? SRBCacheOffset : StaticCacheOffset;
+ return CacheType == ResourceCacheContentType::SRB ? SRBCacheOffset : StaticCacheOffset;
}
DescriptorType GetDescriptorType() const { return static_cast<DescriptorType>(DescrType); }
diff --git a/Graphics/GraphicsEngineVulkan/include/ShaderResourceCacheVk.hpp b/Graphics/GraphicsEngineVulkan/include/ShaderResourceCacheVk.hpp
index a508ccaf..7c8621c0 100644
--- a/Graphics/GraphicsEngineVulkan/include/ShaderResourceCacheVk.hpp
+++ b/Graphics/GraphicsEngineVulkan/include/ShaderResourceCacheVk.hpp
@@ -60,6 +60,7 @@
#include "SPIRVShaderResources.hpp"
#include "BufferVkImpl.hpp"
#include "PipelineResourceSignatureVkImpl.hpp"
+#include "ShaderResourceCacheCommon.hpp"
namespace Diligent
{
@@ -70,9 +71,7 @@ class DeviceContextVkImpl;
class ShaderResourceCacheVk
{
public:
- using CacheContentType = PipelineResourceSignatureVkImpl::CacheContentType;
-
- explicit ShaderResourceCacheVk(CacheContentType ContentType) noexcept :
+ explicit ShaderResourceCacheVk(ResourceCacheContentType ContentType) noexcept :
m_TotalResources{0},
m_ContentType{static_cast<Uint32>(ContentType)}
{
@@ -186,7 +185,7 @@ public:
Uint16& GetDynamicBuffersCounter() { return m_NumDynamicBuffers; }
- CacheContentType GetContentType() const { return static_cast<CacheContentType>(m_ContentType); }
+ ResourceCacheContentType GetContentType() const { return static_cast<ResourceCacheContentType>(m_ContentType); }
#ifdef DILIGENT_DEBUG
// Only for debug purposes: indicates what types of resources are stored in the cache
diff --git a/Graphics/GraphicsEngineVulkan/src/PipelineResourceSignatureVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/PipelineResourceSignatureVkImpl.cpp
index 5c57d040..799d98db 100644
--- a/Graphics/GraphicsEngineVulkan/src/PipelineResourceSignatureVkImpl.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/PipelineResourceSignatureVkImpl.cpp
@@ -241,7 +241,7 @@ PipelineResourceSignatureVkImpl::PipelineResourceSignatureVkImpl(IReferenceCount
const auto NumStaticResStages = GetNumStaticResStages();
if (NumStaticResStages > 0)
{
- m_pStaticResCache = MemPool.Construct<ShaderResourceCacheVk>(CacheContentType::Signature);
+ m_pStaticResCache = MemPool.Construct<ShaderResourceCacheVk>(ResourceCacheContentType::Signature);
m_StaticVarsMgrs = MemPool.ConstructArray<ShaderVariableManagerVk>(NumStaticResStages, std::ref(*this), std::ref(*m_pStaticResCache));
Uint32 StaticResourceCount = 0; // The total number of static resources in all stages
@@ -764,7 +764,7 @@ void PipelineResourceSignatureVkImpl::CommitDynamicResources(const ShaderResourc
{
VERIFY(HasDescriptorSet(DESCRIPTOR_SET_ID_DYNAMIC), "This signature does not contain dynamic resources");
VERIFY_EXPR(vkDynamicDescriptorSet != VK_NULL_HANDLE);
- VERIFY_EXPR(ResourceCache.GetContentType() == CacheContentType::SRB);
+ VERIFY_EXPR(ResourceCache.GetContentType() == ResourceCacheContentType::SRB);
#ifdef DILIGENT_DEBUG
static constexpr size_t ImgUpdateBatchSize = 4;
@@ -798,7 +798,7 @@ void PipelineResourceSignatureVkImpl::CommitDynamicResources(const ShaderResourc
const auto& LogicalDevice = GetDevice()->GetLogicalDevice();
const auto DynResIdxRange = GetResourceIndexRange(SHADER_RESOURCE_VARIABLE_TYPE_DYNAMIC);
- constexpr auto CacheType = CacheContentType::SRB;
+ constexpr auto CacheType = ResourceCacheContentType::SRB;
for (Uint32 ResIdx = DynResIdxRange.first, ArrElem = 0; ResIdx < DynResIdxRange.second;)
{
@@ -993,14 +993,13 @@ private:
const VkWriteDescriptorSetAccelerationStructureKHR* pAccelStructInfo = nullptr) const;
private:
- using CacheContentType = ShaderResourceCacheVk::CacheContentType;
- using ResourceAttribs = PipelineResourceSignatureVkImpl::ResourceAttribs;
- using CachedSet = ShaderResourceCacheVk::DescriptorSet;
+ using ResourceAttribs = PipelineResourceSignatureVkImpl::ResourceAttribs;
+ using CachedSet = ShaderResourceCacheVk::DescriptorSet;
const PipelineResourceSignatureVkImpl& m_Signature;
ShaderResourceCacheVk& m_ResourceCache;
const Uint32 m_ArrayIndex;
- const CacheContentType m_CacheType;
+ const ResourceCacheContentType m_CacheType;
const PipelineResourceDesc& m_ResDesc;
const ResourceAttribs& m_Attribs;
CachedSet& m_CachedSet;
@@ -1026,7 +1025,7 @@ BindResourceHelper::BindResourceHelper(const PipelineResourceSignatureVkImpl& Si
VERIFY(m_DstRes.Type == m_Attribs.GetDescriptorType(), "Inconsistent types");
#ifdef DILIGENT_DEBUG
- if (m_CacheType == CacheContentType::SRB)
+ if (m_CacheType == ResourceCacheContentType::SRB)
{
if (m_ResDesc.VarType == SHADER_RESOURCE_VARIABLE_TYPE_STATIC || m_ResDesc.VarType == SHADER_RESOURCE_VARIABLE_TYPE_MUTABLE)
{
@@ -1034,7 +1033,7 @@ BindResourceHelper::BindResourceHelper(const PipelineResourceSignatureVkImpl& Si
// Dynamic variables do not have vulkan descriptor set only until they are assigned one the first time
}
}
- else if (m_CacheType == CacheContentType::Signature)
+ else if (m_CacheType == ResourceCacheContentType::Signature)
{
VERIFY(m_vkDescrSet == VK_NULL_HANDLE, "Static shader resource cache should not have vulkan descriptor set allocation");
}
diff --git a/Graphics/GraphicsEngineVulkan/src/ShaderResourceBindingVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/ShaderResourceBindingVkImpl.cpp
index 15722f79..797718fd 100644
--- a/Graphics/GraphicsEngineVulkan/src/ShaderResourceBindingVkImpl.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/ShaderResourceBindingVkImpl.cpp
@@ -43,7 +43,7 @@ ShaderResourceBindingVkImpl::ShaderResourceBindingVkImpl(IReferenceCounters*
pRefCounters,
pPRS
},
- m_ShaderResourceCache{ShaderResourceCacheVk::CacheContentType::SRB}
+ m_ShaderResourceCache{ResourceCacheContentType::SRB}
// clang-format on
{
try