summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineVulkan
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/GraphicsEngineVulkan
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/GraphicsEngineVulkan')
-rw-r--r--Graphics/GraphicsEngineVulkan/include/BufferViewVkImpl.h2
-rw-r--r--Graphics/GraphicsEngineVulkan/include/BufferVkImpl.h2
-rw-r--r--Graphics/GraphicsEngineVulkan/include/CommandListVkImpl.h2
-rw-r--r--Graphics/GraphicsEngineVulkan/include/CommandQueueVkImpl.h2
-rw-r--r--Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.h2
-rw-r--r--Graphics/GraphicsEngineVulkan/include/FenceVkImpl.h2
-rw-r--r--Graphics/GraphicsEngineVulkan/include/PipelineStateVkImpl.h9
-rw-r--r--Graphics/GraphicsEngineVulkan/include/RenderDeviceVkImpl.h2
-rw-r--r--Graphics/GraphicsEngineVulkan/include/SamplerVkImpl.h2
-rw-r--r--Graphics/GraphicsEngineVulkan/include/ShaderVkImpl.h25
-rw-r--r--Graphics/GraphicsEngineVulkan/include/SwapChainVkImpl.h2
-rw-r--r--Graphics/GraphicsEngineVulkan/include/TextureViewVkImpl.h2
-rw-r--r--Graphics/GraphicsEngineVulkan/include/TextureVkImpl.h2
-rw-r--r--Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp1
-rw-r--r--Graphics/GraphicsEngineVulkan/src/ShaderResourceBindingVkImpl.cpp16
-rw-r--r--Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp29
16 files changed, 33 insertions, 69 deletions
diff --git a/Graphics/GraphicsEngineVulkan/include/BufferViewVkImpl.h b/Graphics/GraphicsEngineVulkan/include/BufferViewVkImpl.h
index 1108597d..ca57e3e8 100644
--- a/Graphics/GraphicsEngineVulkan/include/BufferViewVkImpl.h
+++ b/Graphics/GraphicsEngineVulkan/include/BufferViewVkImpl.h
@@ -39,7 +39,7 @@ class FixedBlockMemoryAllocator;
class BufferVkImpl;
/// Implementation of the Diligent::IBufferViewVk interface
-class BufferViewVkImpl : public BufferViewBase<IBufferViewVk, RenderDeviceVkImpl>
+class BufferViewVkImpl final : public BufferViewBase<IBufferViewVk, RenderDeviceVkImpl>
{
public:
using TBufferViewBase = BufferViewBase<IBufferViewVk, RenderDeviceVkImpl>;
diff --git a/Graphics/GraphicsEngineVulkan/include/BufferVkImpl.h b/Graphics/GraphicsEngineVulkan/include/BufferVkImpl.h
index 90148d2b..72b5e217 100644
--- a/Graphics/GraphicsEngineVulkan/include/BufferVkImpl.h
+++ b/Graphics/GraphicsEngineVulkan/include/BufferVkImpl.h
@@ -44,7 +44,7 @@ class FixedBlockMemoryAllocator;
class DeviceContextVkImpl;
/// Implementation of the Diligent::IBufferVk interface
-class BufferVkImpl : public BufferBase<IBufferVk, RenderDeviceVkImpl, BufferViewVkImpl, FixedBlockMemoryAllocator>
+class BufferVkImpl final : public BufferBase<IBufferVk, RenderDeviceVkImpl, BufferViewVkImpl, FixedBlockMemoryAllocator>
{
public:
using TBufferBase = BufferBase<IBufferVk, RenderDeviceVkImpl, BufferViewVkImpl, FixedBlockMemoryAllocator>;
diff --git a/Graphics/GraphicsEngineVulkan/include/CommandListVkImpl.h b/Graphics/GraphicsEngineVulkan/include/CommandListVkImpl.h
index 19051478..b64f32bb 100644
--- a/Graphics/GraphicsEngineVulkan/include/CommandListVkImpl.h
+++ b/Graphics/GraphicsEngineVulkan/include/CommandListVkImpl.h
@@ -34,7 +34,7 @@ namespace Diligent
{
/// Implementation of the Diligent::ICommandList interface
-class CommandListVkImpl : public CommandListBase<ICommandList, RenderDeviceVkImpl>
+class CommandListVkImpl final : public CommandListBase<ICommandList, RenderDeviceVkImpl>
{
public:
using TCommandListBase = CommandListBase<ICommandList, RenderDeviceVkImpl>;
diff --git a/Graphics/GraphicsEngineVulkan/include/CommandQueueVkImpl.h b/Graphics/GraphicsEngineVulkan/include/CommandQueueVkImpl.h
index 8e2bb941..5e31bf01 100644
--- a/Graphics/GraphicsEngineVulkan/include/CommandQueueVkImpl.h
+++ b/Graphics/GraphicsEngineVulkan/include/CommandQueueVkImpl.h
@@ -38,7 +38,7 @@ namespace Diligent
{
/// Implementation of the Diligent::ICommandQueueVk interface
-class CommandQueueVkImpl : public ObjectBase<ICommandQueueVk>
+class CommandQueueVkImpl final : public ObjectBase<ICommandQueueVk>
{
public:
using TBase = ObjectBase<ICommandQueueVk>;
diff --git a/Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.h b/Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.h
index 94c0a3c8..9b8ad516 100644
--- a/Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.h
+++ b/Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.h
@@ -45,7 +45,7 @@ namespace Diligent
{
/// Implementation of the Diligent::IDeviceContext interface
-class DeviceContextVkImpl : public DeviceContextBase<IDeviceContextVk, BufferVkImpl, TextureViewVkImpl, PipelineStateVkImpl>
+class DeviceContextVkImpl final : public DeviceContextBase<IDeviceContextVk, BufferVkImpl, TextureViewVkImpl, PipelineStateVkImpl>
{
public:
using TDeviceContextBase = DeviceContextBase<IDeviceContextVk, BufferVkImpl, TextureViewVkImpl, PipelineStateVkImpl>;
diff --git a/Graphics/GraphicsEngineVulkan/include/FenceVkImpl.h b/Graphics/GraphicsEngineVulkan/include/FenceVkImpl.h
index 7883d268..d1cb588d 100644
--- a/Graphics/GraphicsEngineVulkan/include/FenceVkImpl.h
+++ b/Graphics/GraphicsEngineVulkan/include/FenceVkImpl.h
@@ -38,7 +38,7 @@ namespace Diligent
class FixedBlockMemoryAllocator;
/// Implementation of the Diligent::IFenceVk interface
-class FenceVkImpl : public FenceBase<IFenceVk, RenderDeviceVkImpl>
+class FenceVkImpl final : public FenceBase<IFenceVk, RenderDeviceVkImpl>
{
public:
using TFenceBase = FenceBase<IFenceVk, RenderDeviceVkImpl>;
diff --git a/Graphics/GraphicsEngineVulkan/include/PipelineStateVkImpl.h b/Graphics/GraphicsEngineVulkan/include/PipelineStateVkImpl.h
index bb5bdd3f..1475c9ff 100644
--- a/Graphics/GraphicsEngineVulkan/include/PipelineStateVkImpl.h
+++ b/Graphics/GraphicsEngineVulkan/include/PipelineStateVkImpl.h
@@ -46,7 +46,7 @@ namespace Diligent
class FixedBlockMemoryAllocator;
/// Implementation of the Diligent::IRenderDeviceVk interface
-class PipelineStateVkImpl : public PipelineStateBase<IPipelineStateVk, RenderDeviceVkImpl>
+class PipelineStateVkImpl final : public PipelineStateBase<IPipelineStateVk, RenderDeviceVkImpl>
{
public:
using TPipelineStateBase = PipelineStateBase<IPipelineStateVk, RenderDeviceVkImpl>;
@@ -88,9 +88,7 @@ public:
{
return m_SRBMemAllocator;
}
-
- IShaderVariable *GetDummyShaderVar(){return &m_DummyVar;}
-
+
static VkRenderPassCreateInfo GetRenderPassCreateInfo(Uint32 NumRenderTargets,
const TEXTURE_FORMAT RTVFormats[],
TEXTURE_FORMAT DSVFormat,
@@ -101,9 +99,6 @@ public:
private:
-
- DummyShaderVariable m_DummyVar;
-
ShaderResourceLayoutVk* m_ShaderResourceLayouts = nullptr;
// SRB memory allocator must be declared before m_pDefaultShaderResBinding
diff --git a/Graphics/GraphicsEngineVulkan/include/RenderDeviceVkImpl.h b/Graphics/GraphicsEngineVulkan/include/RenderDeviceVkImpl.h
index 5dc4514d..227526b2 100644
--- a/Graphics/GraphicsEngineVulkan/include/RenderDeviceVkImpl.h
+++ b/Graphics/GraphicsEngineVulkan/include/RenderDeviceVkImpl.h
@@ -51,7 +51,7 @@ namespace Diligent
{
/// Implementation of the Diligent::IRenderDeviceVk interface
-class RenderDeviceVkImpl : public RenderDeviceBase<IRenderDeviceVk>
+class RenderDeviceVkImpl final : public RenderDeviceBase<IRenderDeviceVk>
{
public:
using TRenderDeviceBase = RenderDeviceBase<IRenderDeviceVk>;
diff --git a/Graphics/GraphicsEngineVulkan/include/SamplerVkImpl.h b/Graphics/GraphicsEngineVulkan/include/SamplerVkImpl.h
index 290ce87c..d8adb0a9 100644
--- a/Graphics/GraphicsEngineVulkan/include/SamplerVkImpl.h
+++ b/Graphics/GraphicsEngineVulkan/include/SamplerVkImpl.h
@@ -37,7 +37,7 @@ namespace Diligent
class FixedBlockMemoryAllocator;
/// Implementation of the Diligent::ISamplerVk interface
-class SamplerVkImpl : public SamplerBase<ISamplerVk, RenderDeviceVkImpl>
+class SamplerVkImpl final : public SamplerBase<ISamplerVk, RenderDeviceVkImpl>
{
public:
using TSamplerBase = SamplerBase<ISamplerVk, RenderDeviceVkImpl>;
diff --git a/Graphics/GraphicsEngineVulkan/include/ShaderVkImpl.h b/Graphics/GraphicsEngineVulkan/include/ShaderVkImpl.h
index 9daeb665..f2febb53 100644
--- a/Graphics/GraphicsEngineVulkan/include/ShaderVkImpl.h
+++ b/Graphics/GraphicsEngineVulkan/include/ShaderVkImpl.h
@@ -51,13 +51,25 @@ public:
//virtual void QueryInterface( const Diligent::INTERFACE_ID &IID, IObject **ppInterface )override;
- virtual void BindResources( IResourceMapping* pResourceMapping, Uint32 Flags )override;
-
- virtual IShaderVariable* GetShaderVariable(const Char* Name)override;
+ virtual void BindResources( IResourceMapping* pResourceMapping, Uint32 Flags )override
+ {
+ m_StaticVarsMgr.BindResources(pResourceMapping, Flags);
+ }
+
+ virtual IShaderVariable* GetShaderVariable(const Char* Name)override
+ {
+ return m_StaticVarsMgr.GetVariable(Name);
+ }
- virtual Uint32 GetVariableCount() const override final;
+ virtual Uint32 GetVariableCount() const override final
+ {
+ return m_StaticVarsMgr.GetVariableCount();
+ }
- virtual IShaderVariable* GetShaderVariable(Uint32 Index)override final;
+ virtual IShaderVariable* GetShaderVariable(Uint32 Index)override final
+ {
+ return m_StaticVarsMgr.GetVariable(Index);
+ }
virtual const std::vector<uint32_t>& GetSPIRV()const override final
{
@@ -73,9 +85,6 @@ public:
#endif
private:
-
- DummyShaderVariable m_DummyShaderVar; ///< Dummy shader variable
-
// ShaderResources class instance must be referenced through the shared pointer, because
// it is referenced by ShaderResourceLayoutVk class instances
std::shared_ptr<const SPIRVShaderResources> m_pShaderResources;
diff --git a/Graphics/GraphicsEngineVulkan/include/SwapChainVkImpl.h b/Graphics/GraphicsEngineVulkan/include/SwapChainVkImpl.h
index dcb62ab5..9c448ce1 100644
--- a/Graphics/GraphicsEngineVulkan/include/SwapChainVkImpl.h
+++ b/Graphics/GraphicsEngineVulkan/include/SwapChainVkImpl.h
@@ -37,7 +37,7 @@ namespace Diligent
class ITextureViewVk;
class IMemoryAllocator;
/// Implementation of the Diligent::ISwapChainVk interface
-class SwapChainVkImpl : public SwapChainBase<ISwapChainVk>
+class SwapChainVkImpl final : public SwapChainBase<ISwapChainVk>
{
public:
using TSwapChainBase = SwapChainBase<ISwapChainVk>;
diff --git a/Graphics/GraphicsEngineVulkan/include/TextureViewVkImpl.h b/Graphics/GraphicsEngineVulkan/include/TextureViewVkImpl.h
index 4d283d51..467a2241 100644
--- a/Graphics/GraphicsEngineVulkan/include/TextureViewVkImpl.h
+++ b/Graphics/GraphicsEngineVulkan/include/TextureViewVkImpl.h
@@ -37,7 +37,7 @@ namespace Diligent
class FixedBlockMemoryAllocator;
/// Implementation of the Diligent::ITextureViewVk interface
-class TextureViewVkImpl : public TextureViewBase<ITextureViewVk, RenderDeviceVkImpl>
+class TextureViewVkImpl final : public TextureViewBase<ITextureViewVk, RenderDeviceVkImpl>
{
public:
using TTextureViewBase = TextureViewBase<ITextureViewVk, RenderDeviceVkImpl>;
diff --git a/Graphics/GraphicsEngineVulkan/include/TextureVkImpl.h b/Graphics/GraphicsEngineVulkan/include/TextureVkImpl.h
index b027710a..eee1a938 100644
--- a/Graphics/GraphicsEngineVulkan/include/TextureVkImpl.h
+++ b/Graphics/GraphicsEngineVulkan/include/TextureVkImpl.h
@@ -39,7 +39,7 @@ namespace Diligent
class FixedBlockMemoryAllocator;
/// Base implementation of the Diligent::ITextureVk interface
-class TextureVkImpl : public TextureBase<ITextureVk, RenderDeviceVkImpl, TextureViewVkImpl, FixedBlockMemoryAllocator>
+class TextureVkImpl final : public TextureBase<ITextureVk, RenderDeviceVkImpl, TextureViewVkImpl, FixedBlockMemoryAllocator>
{
public:
using TTextureBase = TextureBase<ITextureVk, RenderDeviceVkImpl, TextureViewVkImpl, FixedBlockMemoryAllocator>;
diff --git a/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp
index 399adcbc..f379d25f 100644
--- a/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp
@@ -130,7 +130,6 @@ PipelineStateVkImpl :: PipelineStateVkImpl(IReferenceCounters* pRefCounters
RenderDeviceVkImpl* pDeviceVk,
const PipelineStateDesc& PipelineDesc) :
TPipelineStateBase(pRefCounters, pDeviceVk, PipelineDesc),
- m_DummyVar(*this),
m_SRBMemAllocator(GetRawAllocator()),
m_pDefaultShaderResBinding(nullptr, STDDeleter<ShaderResourceBindingVkImpl, FixedBlockMemoryAllocator>(pDeviceVk->GetSRBAllocator()) )
{
diff --git a/Graphics/GraphicsEngineVulkan/src/ShaderResourceBindingVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/ShaderResourceBindingVkImpl.cpp
index 0d13319e..f91eea9b 100644
--- a/Graphics/GraphicsEngineVulkan/src/ShaderResourceBindingVkImpl.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/ShaderResourceBindingVkImpl.cpp
@@ -108,19 +108,9 @@ IShaderVariable* ShaderResourceBindingVkImpl::GetVariable(SHADER_TYPE ShaderType
if (ResLayoutInd < 0)
{
LOG_ERROR("Failed to find variable \"", Name,"\" in shader resource binding: shader type ", GetShaderTypeLiteralName(ShaderType), " is not initialized");
- return ValidatedCast<PipelineStateVkImpl>(GetPipelineState())->GetDummyShaderVar();
- }
- auto *pVar = m_pShaderVarMgrs[ResLayoutInd].GetVariable(Name);
- if(pVar == nullptr)
- {
- LOG_ERROR("Failed to find variable \"", Name,"\" in shader resource binding. Note that only dynamic and mutable variables can be accessed through SRB object.");
- return ValidatedCast<PipelineStateVkImpl>(GetPipelineState())->GetDummyShaderVar();
- }
- else
- {
- VERIFY(pVar->GetResource().SpirvAttribs.VarType != SHADER_VARIABLE_TYPE_STATIC, "Static variables cannot be accessed through shader resource binding");
- return pVar;
+ return nullptr;
}
+ return m_pShaderVarMgrs[ResLayoutInd].GetVariable(Name);
}
Uint32 ShaderResourceBindingVkImpl::GetVariableCount(SHADER_TYPE ShaderType) const
@@ -142,7 +132,7 @@ IShaderVariable* ShaderResourceBindingVkImpl::GetVariable(SHADER_TYPE ShaderType
if (ResLayoutInd < 0)
{
LOG_ERROR("Failed to find variable at index \"", Index, "\" in shader resource binding: shader type ", GetShaderTypeLiteralName(ShaderType), " is not initialized");
- return ValidatedCast<PipelineStateVkImpl>(GetPipelineState())->GetDummyShaderVar();
+ return nullptr;
}
return m_pShaderVarMgrs[ResLayoutInd].GetVariable(Index);
}
diff --git a/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp
index 0db36dee..8117aa30 100644
--- a/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp
@@ -38,7 +38,6 @@ namespace Diligent
ShaderVkImpl::ShaderVkImpl(IReferenceCounters* pRefCounters, RenderDeviceVkImpl* pRenderDeviceVk, const ShaderCreationAttribs& CreationAttribs) :
TShaderBase(pRefCounters, pRenderDeviceVk, CreationAttribs.Desc),
- m_DummyShaderVar(*this),
m_StaticResLayout(*this, pRenderDeviceVk->GetLogicalDevice(), GetRawAllocator()),
m_StaticResCache(ShaderResourceCacheVk::DbgCacheContentType::StaticShaderResources),
m_StaticVarsMgr(*this)
@@ -69,34 +68,6 @@ ShaderVkImpl::~ShaderVkImpl()
m_StaticVarsMgr.Destroy(GetRawAllocator());
}
-void ShaderVkImpl::BindResources(IResourceMapping* pResourceMapping, Uint32 Flags)
-{
- m_StaticVarsMgr.BindResources(pResourceMapping, Flags);
-}
-
-IShaderVariable* ShaderVkImpl::GetShaderVariable(const Char* Name)
-{
- IShaderVariable *pVar = m_StaticVarsMgr.GetVariable(Name);
- if (pVar == nullptr)
- {
- LOG_ERROR_MESSAGE("Shader variable \"", Name, "\" is not found in shader \"", m_Desc.Name, "\". Note that only static variables can be accessed through shader object.");
- return &m_DummyShaderVar;
- }
- else
- return pVar;
-}
-
-Uint32 ShaderVkImpl::GetVariableCount()const
-{
- return m_StaticVarsMgr.GetVariableCount();
-}
-
-IShaderVariable* ShaderVkImpl::GetShaderVariable(Uint32 Index)
-{
- return m_StaticVarsMgr.GetVariable(Index);
-}
-
-
#ifdef DEVELOPMENT
void ShaderVkImpl::DvpVerifyStaticResourceBindings()
{