summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineD3D12
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2021-02-24 19:51:17 +0000
committerassiduous <assiduous@diligentgraphics.com>2021-03-19 00:38:11 +0000
commit8d7fa1948e3c9acecf369b4be0b575b440bb3189 (patch)
treefbf76f8e044a60145412ded0ffeae3e0e7235c23 /Graphics/GraphicsEngineD3D12
parentFixed clang/gcc error (diff)
downloadDiligentCore-8d7fa1948e3c9acecf369b4be0b575b440bb3189.tar.gz
DiligentCore-8d7fa1948e3c9acecf369b4be0b575b440bb3189.zip
Some updates to ShaderVariableD3D12
Diffstat (limited to 'Graphics/GraphicsEngineD3D12')
-rw-r--r--Graphics/GraphicsEngineD3D12/include/ShaderResourcesD3D12.hpp29
-rw-r--r--Graphics/GraphicsEngineD3D12/include/ShaderVariableD3D12.hpp56
-rw-r--r--Graphics/GraphicsEngineD3D12/src/ShaderVariableD3D12.cpp2
3 files changed, 31 insertions, 56 deletions
diff --git a/Graphics/GraphicsEngineD3D12/include/ShaderResourcesD3D12.hpp b/Graphics/GraphicsEngineD3D12/include/ShaderResourcesD3D12.hpp
index b3075ccf..4ad5256d 100644
--- a/Graphics/GraphicsEngineD3D12/include/ShaderResourcesD3D12.hpp
+++ b/Graphics/GraphicsEngineD3D12/include/ShaderResourcesD3D12.hpp
@@ -30,35 +30,6 @@
/// \file
/// Declaration of Diligent::ShaderResourcesD3D12 class
-// ShaderResourcesD3D12 are created by ShaderD3D12Impl instances. They are then used by ShaderResourceLayoutD3D12 objects, which are
-// created by instances of PipelineStatesD3D12Impl and ShaderD3D12Impl
-//
-// _________________
-// | |
-// | ShaderD3D12Impl |
-// |_________________|
-// |
-// |shared_ptr
-// ________V_____________ _____________________________________________________________________
-// | | unique_ptr | | | | | | |
-// | ShaderResourcesD3D12 |--------------->| CBs | TexSRVs | TexUAVs | BufSRVs | BufUAVs | Samplers |
-// |______________________| |________|___________|___________|___________|___________|____________|
-// A A A
-// \ / \
-// Copy Copy Copy
-// ___________________________ ________\________________________/_________________________\_________________________________________
-// | | unique_ptr | | | | | | |
-// | ShaderResourceLayoutD3D12 |--------------->| SRV_CBV_UAV[0] | SRV_CBV_UAV[1] | ... | Sampler[0] | Sampler[1] | ... |
-// |___________________________| |___________________|_________________|_______________|__________________|_________________|__________|
-// A | A
-// | |___________________SamplerId________________________|
-// |
-// __________|_____________
-// | |
-// | PipelineStateD3D12Impl |
-// |________________________|
-//
-
#include "ShaderResources.hpp"
namespace Diligent
diff --git a/Graphics/GraphicsEngineD3D12/include/ShaderVariableD3D12.hpp b/Graphics/GraphicsEngineD3D12/include/ShaderVariableD3D12.hpp
index 9c0b3ad0..6448ebd1 100644
--- a/Graphics/GraphicsEngineD3D12/include/ShaderVariableD3D12.hpp
+++ b/Graphics/GraphicsEngineD3D12/include/ShaderVariableD3D12.hpp
@@ -31,35 +31,32 @@
/// Declaration of Diligent::ShaderVariableManagerD3D12 and Diligent::ShaderVariableD3D12Impl classes
//
-// * ShaderVariableManagerD3D12 keeps list of variables of specific types
-// * Every ShaderVariableD3D12Impl references D3D12Resource from ShaderResourceLayoutD3D12
-// * ShaderVariableManagerD3D12 keeps pointer to ShaderResourceCacheD3D12
-// * ShaderVariableManagerD3D12 is used by PipelineStateD3D12Impl to manage static resources and by
+// * ShaderVariableManagerD3D12 keeps the list of variables of specific types
+// * Every ShaderVariableD3D12Impl references ResourceAttribs by index from PipelineResourceSignatureD3D12Impl
+// * ShaderVariableManagerD3D12 keeps reference to ShaderResourceCacheD3D12
+// * ShaderVariableManagerD3D12 is used by PipelineResourceSignatureD3D12Impl to manage static resources and by
// ShaderResourceBindingD3D12Impl to manage mutable and dynamic resources
//
// _____________________________ ________________________________________________________________________________
// | | | | | |
// .----| ShaderVariableManagerD3D12 |---------------->| ShaderVariableD3D12Impl[0] | ShaderVariableD3D12Impl[1] | ... |
// | |_____________________________| |______________________________|_______________________________|_________________|
-// | | \ |
-// | | Ref Ref
-// | | \ |
-// | ___________V_______________ ______________________V_______________________V_____________________________
-// | | | unique_ptr | | | | |
-// | | ShaderResourceLayoutD3D12 |--------------->| D3D12Resource[0] | D3D12Resource[1] | ... | D3D12Resource[s+m+d-1] |
-// | |___________________________| |__________________|__________________|_____________|________________________|
-// | | |
-// | | |
-// | | (RootTable, Offset) / (RootTable, Offset)
-// | \ /
-// | __________________________ ________V_______________________________________________________V_______
+// | | | |
+// | | m_ResIndex m_ResIndex
+// | | | |
+// | _____________V____________________ __________V_______________________________V_________________________________
+// | | | m_pResourceAttribs | | | | |
+// | |PipelineResourceSignatureD3D12Impl|------------------->| Resource[0] | Resource[1] | ... | Resource[s+m+d-1] |
+// | |__________________________________| |__________________|__________________|_____________|________________________|
+// | | |
+// | | |
+// | | (RootTable, Offset) / (RootTable, Offset)
+// | \ /
+// | __________________________ _______________V________________________________________________V_______
// | | | | |
// '--->| ShaderResourceCacheD3D12 |---------------->| Resources |
// |__________________________| |________________________________________________________________________|
//
-// Memory buffer is allocated through the allocator provided by the pipeline state. If allocation granularity > 1, fixed block
-// memory allocator is used. This ensures that all resources from different shader resource bindings reside in
-// continuous memory. If allocation granularity == 1, raw allocator is used.
#include <memory>
@@ -141,15 +138,15 @@ private:
IObject& m_Owner;
- // Variable mgr is owned by either Pipeline state object (in which case m_ResourceCache references
- // static resource cache owned by the same PSO object), or by SRB object (in which case
+ // Variable mgr is owned by either Pipeline Resource Signature (in which case m_ResourceCache references
+ // static resource cache owned by the same signature object), or by SRB object (in which case
// m_ResourceCache references the cache in the SRB). Thus the cache and the resource layout
// (which the variables reference) are guaranteed to be alive while the manager is alive.
ShaderResourceCacheD3D12& m_ResourceCache;
- // Memory is allocated through the allocator provided by the pipeline state. If allocation granularity > 1, fixed block
- // memory allocator is used. This ensures that all resources from different shader resource bindings reside in
- // continuous memory. If allocation granularity == 1, raw allocator is used.
+ // Memory is allocated through the allocator provided by the pipeline resource signature. If allocation
+ // granularity > 1, fixed block memory allocator is used. This ensures that all resources from different
+ // shader resource bindings reside in continuous memory. If allocation granularity == 1, raw allocator is used.
ShaderVariableD3D12Impl* m_pVariables = nullptr;
Uint32 m_NumVariables = 0;
@@ -229,8 +226,15 @@ public:
virtual HLSLShaderResourceDesc DILIGENT_CALL_TYPE GetHLSLResourceDesc() const override final
{
- // AZ TODO
- return {};
+ const auto& ResDesc = GetDesc();
+ const auto& ResAttribs = GetAttribs();
+
+ HLSLShaderResourceDesc HLSLResDesc;
+ HLSLResDesc.Name = ResDesc.Name;
+ HLSLResDesc.Type = ResDesc.ResourceType;
+ HLSLResDesc.ArraySize = ResDesc.ArraySize;
+ HLSLResDesc.ShaderRegister = ResAttribs.Register;
+ return HLSLResDesc;
}
private:
diff --git a/Graphics/GraphicsEngineD3D12/src/ShaderVariableD3D12.cpp b/Graphics/GraphicsEngineD3D12/src/ShaderVariableD3D12.cpp
index 08000a6e..d106388e 100644
--- a/Graphics/GraphicsEngineD3D12/src/ShaderVariableD3D12.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/ShaderVariableD3D12.cpp
@@ -97,7 +97,7 @@ void ShaderVariableManagerD3D12::Initialize(const PipelineResourceSignatureD3D12
const Uint32 AllowedTypeBits = GetAllowedTypeBits(AllowedVarTypes, NumAllowedTypes);
VERIFY_EXPR(m_NumVariables == 0);
- auto MemSize = GetRequiredMemorySize(Signature, AllowedVarTypes, NumAllowedTypes, ShaderType, m_NumVariables);
+ const auto MemSize = GetRequiredMemorySize(Signature, AllowedVarTypes, NumAllowedTypes, ShaderType, m_NumVariables);
if (m_NumVariables == 0)
return;