summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineD3D12
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2021-03-11 04:58:49 +0000
committerassiduous <assiduous@diligentgraphics.com>2021-03-19 00:38:20 +0000
commit6e54a0840da780c3b208bc72294aa33eecc64738 (patch)
tree2b3cd3d88cf89a3fb7e16a73692c25af15f2273a /Graphics/GraphicsEngineD3D12
parentVk backend: moved resource binding logic to variable manager and cache (diff)
downloadDiligentCore-6e54a0840da780c3b208bc72294aa33eecc64738.tar.gz
DiligentCore-6e54a0840da780c3b208bc72294aa33eecc64738.zip
Moved duplicate shader variable functionality to ShaderVariableBase
Diffstat (limited to 'Graphics/GraphicsEngineD3D12')
-rw-r--r--Graphics/GraphicsEngineD3D12/include/ShaderVariableManagerD3D12.hpp37
-rw-r--r--Graphics/GraphicsEngineD3D12/src/ShaderVariableManagerD3D12.cpp11
2 files changed, 6 insertions, 42 deletions
diff --git a/Graphics/GraphicsEngineD3D12/include/ShaderVariableManagerD3D12.hpp b/Graphics/GraphicsEngineD3D12/include/ShaderVariableManagerD3D12.hpp
index a067592e..4b53fe89 100644
--- a/Graphics/GraphicsEngineD3D12/include/ShaderVariableManagerD3D12.hpp
+++ b/Graphics/GraphicsEngineD3D12/include/ShaderVariableManagerD3D12.hpp
@@ -120,6 +120,8 @@ public:
private:
friend ShaderVariableD3D12Impl;
+ friend ShaderVariableBase<ShaderVariableD3D12Impl, ShaderVariableManagerD3D12, IShaderResourceVariableD3D>;
+
using ResourceAttribs = PipelineResourceAttribsD3D12;
Uint32 GetVariableIndex(const ShaderVariableD3D12Impl& Variable);
@@ -151,14 +153,13 @@ private:
};
// sizeof(ShaderVariableD3D12Impl) == 24 (x64)
-class ShaderVariableD3D12Impl final : public ShaderVariableBase<ShaderVariableManagerD3D12, IShaderResourceVariableD3D>
+class ShaderVariableD3D12Impl final : public ShaderVariableBase<ShaderVariableD3D12Impl, ShaderVariableManagerD3D12, IShaderResourceVariableD3D>
{
public:
- using TBase = ShaderVariableBase<ShaderVariableManagerD3D12, IShaderResourceVariableD3D>;
+ using TBase = ShaderVariableBase<ShaderVariableD3D12Impl, ShaderVariableManagerD3D12, IShaderResourceVariableD3D>;
ShaderVariableD3D12Impl(ShaderVariableManagerD3D12& ParentManager,
Uint32 ResIndex) :
- TBase{ParentManager},
- m_ResIndex{ResIndex}
+ TBase{ParentManager, ResIndex}
{}
// clang-format off
@@ -181,31 +182,6 @@ public:
}
}
- virtual SHADER_RESOURCE_VARIABLE_TYPE DILIGENT_CALL_TYPE GetType() const override final
- {
- return GetDesc().VarType;
- }
-
- virtual void DILIGENT_CALL_TYPE Set(IDeviceObject* pObject) override final
- {
- BindResource(pObject, 0);
- }
-
- virtual void DILIGENT_CALL_TYPE SetArray(IDeviceObject* const* ppObjects, Uint32 FirstElement, Uint32 NumElements) override final;
-
- virtual void DILIGENT_CALL_TYPE GetResourceDesc(ShaderResourceDesc& ResourceDesc) const override final
- {
- const auto& Desc = GetDesc();
- ResourceDesc.Name = Desc.Name;
- ResourceDesc.Type = Desc.ResourceType;
- ResourceDesc.ArraySize = Desc.ArraySize;
- }
-
- virtual Uint32 DILIGENT_CALL_TYPE GetIndex() const override final
- {
- return m_ParentManager.GetVariableIndex(*this);
- }
-
virtual bool DILIGENT_CALL_TYPE IsBound(Uint32 ArrayIndex) const override final
{
return m_ParentManager.IsBound(ArrayIndex, m_ResIndex);
@@ -233,9 +209,6 @@ private:
{
return m_ParentManager.GetResourceAttribs(m_ResIndex);
}
-
-private:
- const Uint32 m_ResIndex;
};
} // namespace Diligent
diff --git a/Graphics/GraphicsEngineD3D12/src/ShaderVariableManagerD3D12.cpp b/Graphics/GraphicsEngineD3D12/src/ShaderVariableManagerD3D12.cpp
index a47583a1..2d335863 100644
--- a/Graphics/GraphicsEngineD3D12/src/ShaderVariableManagerD3D12.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/ShaderVariableManagerD3D12.cpp
@@ -198,19 +198,10 @@ void ShaderVariableManagerD3D12::BindResources(IResourceMapping* pResourceMappin
for (Uint32 v = 0; v < m_NumVariables; ++v)
{
- m_pVariables[v].BindResources<ShaderVariableD3D12Impl>(pResourceMapping, Flags);
+ m_pVariables[v].BindResources(pResourceMapping, Flags);
}
}
-void ShaderVariableD3D12Impl::SetArray(IDeviceObject* const* ppObjects, Uint32 FirstElement, Uint32 NumElements)
-{
- const auto& ResDesc = GetDesc();
- VerifyAndCorrectSetArrayArguments(ResDesc.Name, ResDesc.ArraySize, FirstElement, NumElements);
-
- for (Uint32 Elem = 0; Elem < NumElements; ++Elem)
- BindResource(ppObjects[Elem], FirstElement + Elem);
-}
-
namespace
{