summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineD3D11
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-08-21 03:35:22 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-08-21 03:35:22 +0000
commit86c84f4f12d3b78678dfec7666d8aaf1d138ecc3 (patch)
tree3b90ca13bc1e5ca49f193621aa11caca209e3307 /Graphics/GraphicsEngineD3D11
parentReworked UAV handling in D3D11 device context implementation: fixed potential... (diff)
downloadDiligentCore-86c84f4f12d3b78678dfec7666d8aaf1d138ecc3.tar.gz
DiligentCore-86c84f4f12d3b78678dfec7666d8aaf1d138ecc3.zip
Removed dummy shader variable. Added final kw to implementation classes.
Fixed https://github.com/DiligentGraphics/DiligentCore/issues/22
Diffstat (limited to 'Graphics/GraphicsEngineD3D11')
-rw-r--r--Graphics/GraphicsEngineD3D11/include/BufferD3D11Impl.h2
-rw-r--r--Graphics/GraphicsEngineD3D11/include/BufferViewD3D11Impl.h2
-rw-r--r--Graphics/GraphicsEngineD3D11/include/CommandListD3D11Impl.h2
-rwxr-xr-xGraphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.h2
-rw-r--r--Graphics/GraphicsEngineD3D11/include/FenceD3D11Impl.h2
-rw-r--r--Graphics/GraphicsEngineD3D11/include/PipelineStateD3D11Impl.h6
-rw-r--r--Graphics/GraphicsEngineD3D11/include/RenderDeviceD3D11Impl.h2
-rw-r--r--Graphics/GraphicsEngineD3D11/include/SamplerD3D11Impl.h2
-rw-r--r--Graphics/GraphicsEngineD3D11/include/ShaderD3D11Impl.h29
-rw-r--r--Graphics/GraphicsEngineD3D11/include/SwapChainD3D11Impl.h2
-rw-r--r--Graphics/GraphicsEngineD3D11/include/Texture1D_D3D11.h2
-rw-r--r--Graphics/GraphicsEngineD3D11/include/Texture2D_D3D11.h2
-rw-r--r--Graphics/GraphicsEngineD3D11/include/Texture3D_D3D11.h2
-rw-r--r--Graphics/GraphicsEngineD3D11/include/TextureViewD3D11Impl.h2
-rw-r--r--Graphics/GraphicsEngineD3D11/src/PipelineStateD3D11Impl.cpp3
-rw-r--r--Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp27
-rw-r--r--Graphics/GraphicsEngineD3D11/src/ShaderResourceBindingD3D11Impl.cpp9
-rwxr-xr-xGraphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp10
18 files changed, 40 insertions, 68 deletions
diff --git a/Graphics/GraphicsEngineD3D11/include/BufferD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/BufferD3D11Impl.h
index b2b09730..da5e661c 100644
--- a/Graphics/GraphicsEngineD3D11/include/BufferD3D11Impl.h
+++ b/Graphics/GraphicsEngineD3D11/include/BufferD3D11Impl.h
@@ -49,7 +49,7 @@ enum class D3D11BufferState
};
/// Implementation of the Diligent::IBufferD3D11 interface
-class BufferD3D11Impl : public BufferBase<IBufferD3D11, RenderDeviceD3D11Impl, BufferViewD3D11Impl, FixedBlockMemoryAllocator>
+class BufferD3D11Impl final : public BufferBase<IBufferD3D11, RenderDeviceD3D11Impl, BufferViewD3D11Impl, FixedBlockMemoryAllocator>
{
public:
using TBufferBase = BufferBase<IBufferD3D11, RenderDeviceD3D11Impl, BufferViewD3D11Impl, FixedBlockMemoryAllocator>;
diff --git a/Graphics/GraphicsEngineD3D11/include/BufferViewD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/BufferViewD3D11Impl.h
index f1f48b93..25997d9f 100644
--- a/Graphics/GraphicsEngineD3D11/include/BufferViewD3D11Impl.h
+++ b/Graphics/GraphicsEngineD3D11/include/BufferViewD3D11Impl.h
@@ -36,7 +36,7 @@ namespace Diligent
class FixedBlockMemoryAllocator;
/// Implementation of the Diligent::IBufferViewD3D11 interface
-class BufferViewD3D11Impl : public BufferViewBase<IBufferViewD3D11, RenderDeviceD3D11Impl>
+class BufferViewD3D11Impl final : public BufferViewBase<IBufferViewD3D11, RenderDeviceD3D11Impl>
{
public:
using TBufferViewBase = BufferViewBase<IBufferViewD3D11, RenderDeviceD3D11Impl>;
diff --git a/Graphics/GraphicsEngineD3D11/include/CommandListD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/CommandListD3D11Impl.h
index 6dbe28bb..508e30c3 100644
--- a/Graphics/GraphicsEngineD3D11/include/CommandListD3D11Impl.h
+++ b/Graphics/GraphicsEngineD3D11/include/CommandListD3D11Impl.h
@@ -36,7 +36,7 @@ namespace Diligent
class FixedBlockMemoryAllocator;
/// Implementation of the Diligent::ICommandListD3D11 interface
-class CommandListD3D11Impl : public CommandListBase<ICommandList, RenderDeviceD3D11Impl>
+class CommandListD3D11Impl final : public CommandListBase<ICommandList, RenderDeviceD3D11Impl>
{
public:
using TCommandListBase = CommandListBase<ICommandList, RenderDeviceD3D11Impl>;
diff --git a/Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.h
index 66444597..e4aab32d 100755
--- a/Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.h
+++ b/Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.h
@@ -41,7 +41,7 @@ namespace Diligent
{
/// Implementation of the Diligent::IDeviceContextD3D11 interface
-class DeviceContextD3D11Impl : public DeviceContextBase<IDeviceContextD3D11, BufferD3D11Impl, TextureViewD3D11Impl, PipelineStateD3D11Impl>
+class DeviceContextD3D11Impl final : public DeviceContextBase<IDeviceContextD3D11, BufferD3D11Impl, TextureViewD3D11Impl, PipelineStateD3D11Impl>
{
public:
using TDeviceContextBase = DeviceContextBase<IDeviceContextD3D11, BufferD3D11Impl, TextureViewD3D11Impl, PipelineStateD3D11Impl>;
diff --git a/Graphics/GraphicsEngineD3D11/include/FenceD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/FenceD3D11Impl.h
index 0b84cbae..1faf6e9c 100644
--- a/Graphics/GraphicsEngineD3D11/include/FenceD3D11Impl.h
+++ b/Graphics/GraphicsEngineD3D11/include/FenceD3D11Impl.h
@@ -38,7 +38,7 @@ namespace Diligent
class FixedBlockMemoryAllocator;
/// Implementation of the Diligent::IFenceD3D11 interface
-class FenceD3D11Impl : public FenceBase<IFenceD3D11, RenderDeviceD3D11Impl>
+class FenceD3D11Impl final : public FenceBase<IFenceD3D11, RenderDeviceD3D11Impl>
{
public:
using TFenceBase = FenceBase<IFenceD3D11, RenderDeviceD3D11Impl>;
diff --git a/Graphics/GraphicsEngineD3D11/include/PipelineStateD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/PipelineStateD3D11Impl.h
index d52d66f2..2ea2d8da 100644
--- a/Graphics/GraphicsEngineD3D11/include/PipelineStateD3D11Impl.h
+++ b/Graphics/GraphicsEngineD3D11/include/PipelineStateD3D11Impl.h
@@ -38,7 +38,7 @@ namespace Diligent
class FixedBlockMemoryAllocator;
/// Implementation of the Diligent::IPipelineStateD3D11 interface
-class PipelineStateD3D11Impl : public PipelineStateBase<IPipelineStateD3D11, RenderDeviceD3D11Impl>
+class PipelineStateD3D11Impl final : public PipelineStateBase<IPipelineStateD3D11, RenderDeviceD3D11Impl>
{
public:
using TPipelineStateBase = PipelineStateBase<IPipelineStateD3D11, RenderDeviceD3D11Impl>;
@@ -79,8 +79,6 @@ public:
return m_SRBMemAllocator;
}
- IShaderVariable* GetDummyShaderVariable(){return &m_DummyShaderVar;}
-
private:
CComPtr<ID3D11BlendState> m_pd3d11BlendState;
CComPtr<ID3D11RasterizerState> m_pd3d11RasterizerState;
@@ -93,8 +91,6 @@ private:
// Do not use strong reference to avoid cyclic references
// Must be declared after the data allocators
std::unique_ptr<class ShaderResourceBindingD3D11Impl, STDDeleter<ShaderResourceBindingD3D11Impl, FixedBlockMemoryAllocator> > m_pDefaultShaderResBinding;
-
- DummyShaderVariable m_DummyShaderVar; ///< Dummy shader variable
};
}
diff --git a/Graphics/GraphicsEngineD3D11/include/RenderDeviceD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/RenderDeviceD3D11Impl.h
index 28f65829..4148577f 100644
--- a/Graphics/GraphicsEngineD3D11/include/RenderDeviceD3D11Impl.h
+++ b/Graphics/GraphicsEngineD3D11/include/RenderDeviceD3D11Impl.h
@@ -35,7 +35,7 @@ namespace Diligent
{
/// Implementation of the Diligent::IRenderDeviceD3D11 interface
-class RenderDeviceD3D11Impl : public RenderDeviceD3DBase<IRenderDeviceD3D11>
+class RenderDeviceD3D11Impl final : public RenderDeviceD3DBase<IRenderDeviceD3D11>
{
public:
using TRenderDeviceBase = RenderDeviceD3DBase<IRenderDeviceD3D11>;
diff --git a/Graphics/GraphicsEngineD3D11/include/SamplerD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/SamplerD3D11Impl.h
index 58b7250a..35c68720 100644
--- a/Graphics/GraphicsEngineD3D11/include/SamplerD3D11Impl.h
+++ b/Graphics/GraphicsEngineD3D11/include/SamplerD3D11Impl.h
@@ -36,7 +36,7 @@ namespace Diligent
class FixedBlockMemoryAllocator;
/// Implementation of the Diligent::ISamplerD3D11 interface
-class SamplerD3D11Impl : public SamplerBase<ISamplerD3D11, RenderDeviceD3D11Impl>
+class SamplerD3D11Impl final : public SamplerBase<ISamplerD3D11, RenderDeviceD3D11Impl>
{
public:
using TSamplerBase = SamplerBase<ISamplerD3D11, RenderDeviceD3D11Impl>;
diff --git a/Graphics/GraphicsEngineD3D11/include/ShaderD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/ShaderD3D11Impl.h
index 400a5d72..ac84a4a0 100644
--- a/Graphics/GraphicsEngineD3D11/include/ShaderD3D11Impl.h
+++ b/Graphics/GraphicsEngineD3D11/include/ShaderD3D11Impl.h
@@ -55,15 +55,31 @@ public:
virtual void QueryInterface( const Diligent::INTERFACE_ID &IID, IObject** ppInterface )override final;
- virtual void BindResources( IResourceMapping* pResourceMapping, Uint32 Flags )override final;
+ virtual void BindResources( IResourceMapping* pResourceMapping, Uint32 Flags )override final
+ {
+ m_StaticResLayout.BindResources(pResourceMapping, Flags, m_StaticResCache);
+ }
- virtual IShaderVariable* GetShaderVariable( const Char* Name )override final;
+ virtual IShaderVariable* GetShaderVariable( const Char* Name )override final
+ {
+ return m_StaticResLayout.GetShaderVariable(Name);
+ }
- virtual Uint32 GetVariableCount() const override final;
+ virtual Uint32 GetVariableCount() const override final
+ {
+ return m_StaticResLayout.GetTotalResourceCount();
+ }
- virtual IShaderVariable* GetShaderVariable(Uint32 Index)override final;
+ virtual IShaderVariable* GetShaderVariable(Uint32 Index)override final
+ {
+ return m_StaticResLayout.GetShaderVariable(Index);
+ }
- virtual ID3D11DeviceChild* GetD3D11Shader()override final{ return m_pShader; }
+
+ virtual ID3D11DeviceChild* GetD3D11Shader()override final
+ {
+ return m_pShader;
+ }
ID3DBlob* GetBytecode(){return m_pShaderByteCode;}
@@ -72,9 +88,6 @@ public:
Uint32 GetShaderTypeIndex()const{return m_ShaderTypeIndex;}
private:
-
- DummyShaderVariable m_DummyShaderVar; ///< Dummy shader variable
-
/// D3D11 shader
CComPtr<ID3D11DeviceChild> m_pShader;
diff --git a/Graphics/GraphicsEngineD3D11/include/SwapChainD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/SwapChainD3D11Impl.h
index cc9abd44..f72128cc 100644
--- a/Graphics/GraphicsEngineD3D11/include/SwapChainD3D11Impl.h
+++ b/Graphics/GraphicsEngineD3D11/include/SwapChainD3D11Impl.h
@@ -34,7 +34,7 @@ namespace Diligent
class IMemoryAllocator;
/// Implementation of the Diligent::ISwapChainD3D11 interface
-class SwapChainD3D11Impl : public SwapChainD3DBase<ISwapChainD3D11, IDXGISwapChain>
+class SwapChainD3D11Impl final : public SwapChainD3DBase<ISwapChainD3D11, IDXGISwapChain>
{
public:
using TSwapChainBase = SwapChainD3DBase<ISwapChainD3D11, IDXGISwapChain>;
diff --git a/Graphics/GraphicsEngineD3D11/include/Texture1D_D3D11.h b/Graphics/GraphicsEngineD3D11/include/Texture1D_D3D11.h
index d089cb42..6dd445c0 100644
--- a/Graphics/GraphicsEngineD3D11/include/Texture1D_D3D11.h
+++ b/Graphics/GraphicsEngineD3D11/include/Texture1D_D3D11.h
@@ -32,7 +32,7 @@ namespace Diligent
{
/// Implementation of a 1D texture
-class Texture1D_D3D11 : public TextureBaseD3D11
+class Texture1D_D3D11 final : public TextureBaseD3D11
{
public:
Texture1D_D3D11(IReferenceCounters* pRefCounters,
diff --git a/Graphics/GraphicsEngineD3D11/include/Texture2D_D3D11.h b/Graphics/GraphicsEngineD3D11/include/Texture2D_D3D11.h
index fd1f61d6..2108fecb 100644
--- a/Graphics/GraphicsEngineD3D11/include/Texture2D_D3D11.h
+++ b/Graphics/GraphicsEngineD3D11/include/Texture2D_D3D11.h
@@ -32,7 +32,7 @@ namespace Diligent
{
/// Implementation of a 2D texture
-class Texture2D_D3D11 : public TextureBaseD3D11
+class Texture2D_D3D11 final : public TextureBaseD3D11
{
public:
Texture2D_D3D11(IReferenceCounters* pRefCounters,
diff --git a/Graphics/GraphicsEngineD3D11/include/Texture3D_D3D11.h b/Graphics/GraphicsEngineD3D11/include/Texture3D_D3D11.h
index 8df510f3..e0283cbf 100644
--- a/Graphics/GraphicsEngineD3D11/include/Texture3D_D3D11.h
+++ b/Graphics/GraphicsEngineD3D11/include/Texture3D_D3D11.h
@@ -32,7 +32,7 @@ namespace Diligent
{
/// Implementation of a 3D texture
-class Texture3D_D3D11 : public TextureBaseD3D11
+class Texture3D_D3D11 final : public TextureBaseD3D11
{
public:
Texture3D_D3D11(IReferenceCounters* pRefCounters,
diff --git a/Graphics/GraphicsEngineD3D11/include/TextureViewD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/TextureViewD3D11Impl.h
index 9fcdf352..4c801b07 100644
--- a/Graphics/GraphicsEngineD3D11/include/TextureViewD3D11Impl.h
+++ b/Graphics/GraphicsEngineD3D11/include/TextureViewD3D11Impl.h
@@ -37,7 +37,7 @@ namespace Diligent
class FixedBlockMemoryAllocator;
/// Implementation of the Diligent::ITextureViewD3D11 interface
-class TextureViewD3D11Impl : public TextureViewBase<ITextureViewD3D11, RenderDeviceD3D11Impl>
+class TextureViewD3D11Impl final : public TextureViewBase<ITextureViewD3D11, RenderDeviceD3D11Impl>
{
public:
using TTextureViewBase = TextureViewBase<ITextureViewD3D11, RenderDeviceD3D11Impl>;
diff --git a/Graphics/GraphicsEngineD3D11/src/PipelineStateD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/PipelineStateD3D11Impl.cpp
index 437df242..a76e4fcf 100644
--- a/Graphics/GraphicsEngineD3D11/src/PipelineStateD3D11Impl.cpp
+++ b/Graphics/GraphicsEngineD3D11/src/PipelineStateD3D11Impl.cpp
@@ -36,8 +36,7 @@ PipelineStateD3D11Impl::PipelineStateD3D11Impl(IReferenceCounters* pRefCoun
const PipelineStateDesc& PipelineDesc) :
TPipelineStateBase(pRefCounters, pRenderDeviceD3D11, PipelineDesc),
m_SRBMemAllocator(GetRawAllocator()),
- m_pDefaultShaderResBinding( nullptr, STDDeleter<ShaderResourceBindingD3D11Impl, FixedBlockMemoryAllocator>(pRenderDeviceD3D11->GetSRBAllocator()) ),
- m_DummyShaderVar(*this)
+ m_pDefaultShaderResBinding( nullptr, STDDeleter<ShaderResourceBindingD3D11Impl, FixedBlockMemoryAllocator>(pRenderDeviceD3D11->GetSRBAllocator()) )
{
if (PipelineDesc.IsComputePipeline)
{
diff --git a/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp
index bc069883..fc428cd0 100644
--- a/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp
+++ b/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp
@@ -36,8 +36,7 @@ ShaderD3D11Impl::ShaderD3D11Impl(IReferenceCounters* pRefCounters,
TShaderBase(pRefCounters, pRenderDeviceD3D11, CreationAttribs.Desc),
ShaderD3DBase(CreationAttribs),
m_StaticResLayout(*this, GetRawAllocator()),
- m_ShaderTypeIndex(Diligent::GetShaderTypeIndex(CreationAttribs.Desc.ShaderType)),
- m_DummyShaderVar(*this)
+ m_ShaderTypeIndex(Diligent::GetShaderTypeIndex(CreationAttribs.Desc.ShaderType))
{
auto *pDeviceD3D11 = pRenderDeviceD3D11->GetD3D11Device();
switch(CreationAttribs.Desc.ShaderType)
@@ -96,28 +95,4 @@ ShaderD3D11Impl::~ShaderD3D11Impl()
IMPLEMENT_QUERY_INTERFACE( ShaderD3D11Impl, IID_ShaderD3D11, TShaderBase )
-IShaderVariable* ShaderD3D11Impl::GetShaderVariable( const Char* Name )
-{
- auto *pVar = m_StaticResLayout.GetShaderVariable(Name);
- if(pVar == nullptr)
- pVar = &m_DummyShaderVar;
- return pVar;
-}
-
-Uint32 ShaderD3D11Impl::GetVariableCount() const
-{
- return m_StaticResLayout.GetTotalResourceCount();
-}
-
-IShaderVariable* ShaderD3D11Impl::GetShaderVariable(Uint32 Index)
-{
- return m_StaticResLayout.GetShaderVariable(Index);
-}
-
-
-void ShaderD3D11Impl::BindResources(IResourceMapping* pResourceMapping, Uint32 Flags)
-{
- m_StaticResLayout.BindResources(pResourceMapping, Flags, m_StaticResCache);
-}
-
}
diff --git a/Graphics/GraphicsEngineD3D11/src/ShaderResourceBindingD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/ShaderResourceBindingD3D11Impl.cpp
index 9ff13e75..433ea149 100644
--- a/Graphics/GraphicsEngineD3D11/src/ShaderResourceBindingD3D11Impl.cpp
+++ b/Graphics/GraphicsEngineD3D11/src/ShaderResourceBindingD3D11Impl.cpp
@@ -149,14 +149,7 @@ IShaderVariable* ShaderResourceBindingD3D11Impl::GetVariable(SHADER_TYPE ShaderT
if( Ind >= 0 )
{
auto ResLayoutIndex = m_ResourceLayoutIndex[Ind];
- auto *pVar = m_pResourceLayouts[ResLayoutIndex].GetShaderVariable(Name);
- if(pVar != nullptr)
- return pVar;
- else
- {
- auto *pPSOD3D11 = ValidatedCast<PipelineStateD3D11Impl>(GetPipelineState());
- return pPSOD3D11->GetDummyShaderVariable();
- }
+ return m_pResourceLayouts[ResLayoutIndex].GetShaderVariable(Name);
}
else
{
diff --git a/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp b/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp
index 56cc2b70..3d7f549e 100755
--- a/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp
+++ b/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp
@@ -752,12 +752,11 @@ void ShaderResourceLayoutD3D11::BindResources( IResourceMapping* pResourceMappin
IShaderVariable* ShaderResourceLayoutD3D11::GetShaderVariable(const Char* Name)
{
- IShaderVariable *pVar = nullptr;
#if USE_VARIABLE_HASH_MAP
// Name will be implicitly converted to HashMapStringKey without making a copy
auto it = m_VariableHash.find( Name );
if( it != m_VariableHash.end() )
- pVar = it->second;
+ return it->second;
#else
for (Uint32 cb = 0; cb < m_NumCBs; ++cb)
if (strcmp(GetCB(cb).Attribs.Name, Name) == 0)
@@ -775,11 +774,8 @@ IShaderVariable* ShaderResourceLayoutD3D11::GetShaderVariable(const Char* Name)
if (strcmp(GetBufUAV(u).Attribs.Name, Name) == 0 )
return &GetBufUAV(u);
#endif
- if(pVar == nullptr)
- {
- LOG_ERROR_MESSAGE( "Unable to find variable \"", Name, "\". Attempts to set the variable will be silently ignored. Note that static variables are accessed through shader objects, while mutable and dynamic variables are accessed through Shader Resource Binding." );
- }
- return pVar;
+
+ return nullptr;
}
Uint32 ShaderResourceLayoutD3D11::GetVariableIndex(const ShaderVariableD3D11Base& Variable)const