summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineD3D12
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2020-12-21 23:40:29 +0000
committerassiduous <assiduous@diligentgraphics.com>2020-12-21 23:40:29 +0000
commit413569991bfb6debea4a0476279d656b44ba0acc (patch)
treedc73f9877162599032044fefee93c3408395199e /Graphics/GraphicsEngineD3D12
parentVulkan backend: code clean-up (diff)
downloadDiligentCore-413569991bfb6debea4a0476279d656b44ba0acc.tar.gz
DiligentCore-413569991bfb6debea4a0476279d656b44ba0acc.zip
Vulkan backend: few updates to shader resource layout initialization
Diffstat (limited to 'Graphics/GraphicsEngineD3D12')
-rw-r--r--Graphics/GraphicsEngineD3D12/include/ShaderResourceLayoutD3D12.hpp11
-rw-r--r--Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp4
-rw-r--r--Graphics/GraphicsEngineD3D12/src/ShaderResourceLayoutD3D12.cpp13
3 files changed, 11 insertions, 17 deletions
diff --git a/Graphics/GraphicsEngineD3D12/include/ShaderResourceLayoutD3D12.hpp b/Graphics/GraphicsEngineD3D12/include/ShaderResourceLayoutD3D12.hpp
index 7ca4a7a3..887ab9f6 100644
--- a/Graphics/GraphicsEngineD3D12/include/ShaderResourceLayoutD3D12.hpp
+++ b/Graphics/GraphicsEngineD3D12/include/ShaderResourceLayoutD3D12.hpp
@@ -137,14 +137,11 @@ public:
class RootSignatureBuilder& RootSgnBldr,
class LocalRootSignature* pLocalRootSig);
- // Copies the specified variable types from the source layout and initializes the
+ // Copies static resources from the source layout and initializes the
// resource cache. Uses bind points from the source layout.
- // \note This method is used to initialize static resource cache.
- void Initialize(const ShaderResourceLayoutD3D12& SrcLayout,
- IMemoryAllocator& LayoutDataAllocator,
- const SHADER_RESOURCE_VARIABLE_TYPE* const AllowedVarTypes,
- Uint32 NumAllowedTypes,
- ShaderResourceCacheD3D12& ResourceCache);
+ void InitializeStaticReourceLayout(const ShaderResourceLayoutD3D12& SrcLayout,
+ IMemoryAllocator& LayoutDataAllocator,
+ ShaderResourceCacheD3D12& ResourceCache);
// clang-format off
ShaderResourceLayoutD3D12 (const ShaderResourceLayoutD3D12&) = delete;
diff --git a/Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp
index 7c3f6489..187bab5a 100644
--- a/Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp
@@ -812,11 +812,9 @@ void PipelineStateD3D12Impl::InitResourceLayouts(const PipelineStateCreateInfo&
// general layout is initialized, because we will use the bind points that
// may have been assigned (for ray tracing shaders).
const SHADER_RESOURCE_VARIABLE_TYPE StaticVarType[] = {SHADER_RESOURCE_VARIABLE_TYPE_STATIC};
- m_pShaderResourceLayouts[GetNumShaderStages() + s].Initialize(
+ m_pShaderResourceLayouts[GetNumShaderStages() + s].InitializeStaticReourceLayout(
m_pShaderResourceLayouts[s],
GetRawAllocator(),
- StaticVarType,
- _countof(StaticVarType),
m_pStaticResourceCaches[s] //
);
diff --git a/Graphics/GraphicsEngineD3D12/src/ShaderResourceLayoutD3D12.cpp b/Graphics/GraphicsEngineD3D12/src/ShaderResourceLayoutD3D12.cpp
index c731e505..3b1b67a8 100644
--- a/Graphics/GraphicsEngineD3D12/src/ShaderResourceLayoutD3D12.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/ShaderResourceLayoutD3D12.cpp
@@ -146,7 +146,8 @@ void ShaderResourceLayoutD3D12::Initialize(PIPELINE_TYPE
std::array<Uint32, SHADER_RESOURCE_VARIABLE_TYPE_NUM_TYPES> CbvSrvUavCount = {};
std::array<Uint32, SHADER_RESOURCE_VARIABLE_TYPE_NUM_TYPES> SamplerCount = {};
- // Mapping from the resource name to its index in m_ResourceBuffer
+ // Mapping from the resource name to its index in m_ResourceBuffer that is used
+ // to de-duplicate resources.
std::unordered_map<HashMapStringKey, Uint32, HashMapStringKey::Hasher> ResourceNameToIndex;
// Construct shader or shader group name
@@ -389,16 +390,14 @@ void ShaderResourceLayoutD3D12::Initialize(PIPELINE_TYPE
#endif
}
-void ShaderResourceLayoutD3D12::Initialize(const ShaderResourceLayoutD3D12& SrcLayout,
- IMemoryAllocator& LayoutDataAllocator,
- const SHADER_RESOURCE_VARIABLE_TYPE* const AllowedVarTypes,
- Uint32 NumAllowedTypes,
- ShaderResourceCacheD3D12& ResourceCache)
+void ShaderResourceLayoutD3D12::InitializeStaticReourceLayout(const ShaderResourceLayoutD3D12& SrcLayout,
+ IMemoryAllocator& LayoutDataAllocator,
+ ShaderResourceCacheD3D12& ResourceCache)
{
m_IsUsingSeparateSamplers = SrcLayout.m_IsUsingSeparateSamplers;
m_ShaderType = SrcLayout.m_ShaderType;
- const auto AllowedTypeBits = GetAllowedTypeBits(AllowedVarTypes, NumAllowedTypes);
+ const auto AllowedTypeBits = GetAllowedTypeBit(SHADER_RESOURCE_VARIABLE_TYPE_STATIC);
const auto* const ShaderName = SrcLayout.GetShaderName();
std::array<Uint32, SHADER_RESOURCE_VARIABLE_TYPE_NUM_TYPES> CbvSrvUavCount = {};