From 86c84f4f12d3b78678dfec7666d8aaf1d138ecc3 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Mon, 20 Aug 2018 20:35:22 -0700 Subject: Removed dummy shader variable. Added final kw to implementation classes. Fixed https://github.com/DiligentGraphics/DiligentCore/issues/22 --- Graphics/GraphicsEngineOpenGL/include/BufferGLImpl.h | 2 +- Graphics/GraphicsEngineOpenGL/include/BufferViewGLImpl.h | 2 +- Graphics/GraphicsEngineOpenGL/include/DeviceContextGLImpl.h | 2 +- Graphics/GraphicsEngineOpenGL/include/FenceGLImpl.h | 2 +- Graphics/GraphicsEngineOpenGL/include/PipelineStateGLImpl.h | 2 +- Graphics/GraphicsEngineOpenGL/include/RenderDeviceGLESImpl.h | 2 +- Graphics/GraphicsEngineOpenGL/include/RenderDeviceGLImpl.h | 1 + Graphics/GraphicsEngineOpenGL/include/SamplerGLImpl.h | 2 +- .../GraphicsEngineOpenGL/include/ShaderResourceBindingGLImpl.h | 1 - Graphics/GraphicsEngineOpenGL/include/Texture1DArray_OGL.h | 2 +- Graphics/GraphicsEngineOpenGL/include/Texture1D_OGL.h | 2 +- Graphics/GraphicsEngineOpenGL/include/Texture2DArray_OGL.h | 2 +- Graphics/GraphicsEngineOpenGL/include/Texture2D_OGL.h | 2 +- Graphics/GraphicsEngineOpenGL/include/Texture3D_OGL.h | 2 +- Graphics/GraphicsEngineOpenGL/include/TextureCubeArray_OGL.h | 2 +- Graphics/GraphicsEngineOpenGL/include/TextureCube_OGL.h | 2 +- Graphics/GraphicsEngineOpenGL/include/TextureViewGLImpl.h | 2 +- Graphics/GraphicsEngineOpenGL/src/ShaderGLImpl.cpp | 8 +------- .../GraphicsEngineOpenGL/src/ShaderResourceBindingGLImpl.cpp | 9 +-------- 19 files changed, 18 insertions(+), 31 deletions(-) (limited to 'Graphics/GraphicsEngineOpenGL') diff --git a/Graphics/GraphicsEngineOpenGL/include/BufferGLImpl.h b/Graphics/GraphicsEngineOpenGL/include/BufferGLImpl.h index 69b6d7f9..1d990493 100644 --- a/Graphics/GraphicsEngineOpenGL/include/BufferGLImpl.h +++ b/Graphics/GraphicsEngineOpenGL/include/BufferGLImpl.h @@ -37,7 +37,7 @@ namespace Diligent class FixedBlockMemoryAllocator; /// Implementation of the Diligent::IBufferGL interface -class BufferGLImpl : public BufferBase, public AsyncWritableResource +class BufferGLImpl final : public BufferBase, public AsyncWritableResource { public: using TBufferBase = BufferBase; diff --git a/Graphics/GraphicsEngineOpenGL/include/BufferViewGLImpl.h b/Graphics/GraphicsEngineOpenGL/include/BufferViewGLImpl.h index f30e44b7..4d86e21f 100644 --- a/Graphics/GraphicsEngineOpenGL/include/BufferViewGLImpl.h +++ b/Graphics/GraphicsEngineOpenGL/include/BufferViewGLImpl.h @@ -40,7 +40,7 @@ class BufferGLImpl; struct BufferViewDesc; /// Implementation of the Diligent::IBufferViewGL interface -class BufferViewGLImpl : public BufferViewBase +class BufferViewGLImpl final : public BufferViewBase { public: using TBuffViewBase = BufferViewBase; diff --git a/Graphics/GraphicsEngineOpenGL/include/DeviceContextGLImpl.h b/Graphics/GraphicsEngineOpenGL/include/DeviceContextGLImpl.h index 6967f15a..a33ff3a3 100644 --- a/Graphics/GraphicsEngineOpenGL/include/DeviceContextGLImpl.h +++ b/Graphics/GraphicsEngineOpenGL/include/DeviceContextGLImpl.h @@ -36,7 +36,7 @@ namespace Diligent { /// Implementation of the Diligent::IDeviceContextGL interface -class DeviceContextGLImpl : public DeviceContextBase +class DeviceContextGLImpl final : public DeviceContextBase { public: using TDeviceContextBase = DeviceContextBase; diff --git a/Graphics/GraphicsEngineOpenGL/include/FenceGLImpl.h b/Graphics/GraphicsEngineOpenGL/include/FenceGLImpl.h index a87e8eb1..e6f4423a 100644 --- a/Graphics/GraphicsEngineOpenGL/include/FenceGLImpl.h +++ b/Graphics/GraphicsEngineOpenGL/include/FenceGLImpl.h @@ -39,7 +39,7 @@ namespace Diligent class FixedBlockMemoryAllocator; /// Implementation of the Diligent::IFenceGL interface -class FenceGLImpl : public FenceBase +class FenceGLImpl final : public FenceBase { public: using TFenceBase = FenceBase; diff --git a/Graphics/GraphicsEngineOpenGL/include/PipelineStateGLImpl.h b/Graphics/GraphicsEngineOpenGL/include/PipelineStateGLImpl.h index 6730e89e..c6f54964 100644 --- a/Graphics/GraphicsEngineOpenGL/include/PipelineStateGLImpl.h +++ b/Graphics/GraphicsEngineOpenGL/include/PipelineStateGLImpl.h @@ -37,7 +37,7 @@ namespace Diligent class FixedBlockMemoryAllocator; /// Implementation of the Diligent::IPipelineStateGL interface -class PipelineStateGLImpl : public PipelineStateBase +class PipelineStateGLImpl final : public PipelineStateBase { public: using TPipelineStateBase = PipelineStateBase; diff --git a/Graphics/GraphicsEngineOpenGL/include/RenderDeviceGLESImpl.h b/Graphics/GraphicsEngineOpenGL/include/RenderDeviceGLESImpl.h index 973e31b9..b34ebeaa 100644 --- a/Graphics/GraphicsEngineOpenGL/include/RenderDeviceGLESImpl.h +++ b/Graphics/GraphicsEngineOpenGL/include/RenderDeviceGLESImpl.h @@ -28,7 +28,7 @@ namespace Diligent { -class RenderDeviceGLESImpl : public RenderDeviceGLImpl +class RenderDeviceGLESImpl final : public RenderDeviceGLImpl { public: RenderDeviceGLESImpl( IReferenceCounters *pRefCounters, IMemoryAllocator &RawMemAllocator, const EngineGLAttribs &InitAttribs ); diff --git a/Graphics/GraphicsEngineOpenGL/include/RenderDeviceGLImpl.h b/Graphics/GraphicsEngineOpenGL/include/RenderDeviceGLImpl.h index adb0f833..3f93f22d 100644 --- a/Graphics/GraphicsEngineOpenGL/include/RenderDeviceGLImpl.h +++ b/Graphics/GraphicsEngineOpenGL/include/RenderDeviceGLImpl.h @@ -49,6 +49,7 @@ namespace Diligent { /// Implementation of the render device interface in OpenGL +// RenderDeviceGLESImpl is inherited from RenderDeviceGLImpl class RenderDeviceGLImpl : public RenderDeviceBase { public: diff --git a/Graphics/GraphicsEngineOpenGL/include/SamplerGLImpl.h b/Graphics/GraphicsEngineOpenGL/include/SamplerGLImpl.h index b2b33392..ad9a9c5b 100644 --- a/Graphics/GraphicsEngineOpenGL/include/SamplerGLImpl.h +++ b/Graphics/GraphicsEngineOpenGL/include/SamplerGLImpl.h @@ -35,7 +35,7 @@ namespace Diligent class FixedBlockMemoryAllocator; /// Implementation of the Diligent::ISamplerGL interface -class SamplerGLImpl : public SamplerBase +class SamplerGLImpl final : public SamplerBase { public: using TSamplerBase = SamplerBase; diff --git a/Graphics/GraphicsEngineOpenGL/include/ShaderResourceBindingGLImpl.h b/Graphics/GraphicsEngineOpenGL/include/ShaderResourceBindingGLImpl.h index 533eee32..6500ad29 100644 --- a/Graphics/GraphicsEngineOpenGL/include/ShaderResourceBindingGLImpl.h +++ b/Graphics/GraphicsEngineOpenGL/include/ShaderResourceBindingGLImpl.h @@ -59,7 +59,6 @@ public: private: GLProgramResources m_DynamicProgResources[6]; - DummyShaderVariable m_DummyShaderVar; ///< Dummy shader variable RefCntWeakPtr m_wpPSO; }; diff --git a/Graphics/GraphicsEngineOpenGL/include/Texture1DArray_OGL.h b/Graphics/GraphicsEngineOpenGL/include/Texture1DArray_OGL.h index 186a8ff5..b0fc149f 100644 --- a/Graphics/GraphicsEngineOpenGL/include/Texture1DArray_OGL.h +++ b/Graphics/GraphicsEngineOpenGL/include/Texture1DArray_OGL.h @@ -28,7 +28,7 @@ namespace Diligent { -class Texture1DArray_OGL : public TextureBaseGL +class Texture1DArray_OGL final : public TextureBaseGL { public: Texture1DArray_OGL( IReferenceCounters *pRefCounters, diff --git a/Graphics/GraphicsEngineOpenGL/include/Texture1D_OGL.h b/Graphics/GraphicsEngineOpenGL/include/Texture1D_OGL.h index ac9dd25a..7db891f6 100644 --- a/Graphics/GraphicsEngineOpenGL/include/Texture1D_OGL.h +++ b/Graphics/GraphicsEngineOpenGL/include/Texture1D_OGL.h @@ -28,7 +28,7 @@ namespace Diligent { -class Texture1D_OGL : public TextureBaseGL +class Texture1D_OGL final : public TextureBaseGL { public: Texture1D_OGL( IReferenceCounters *pRefCounters, diff --git a/Graphics/GraphicsEngineOpenGL/include/Texture2DArray_OGL.h b/Graphics/GraphicsEngineOpenGL/include/Texture2DArray_OGL.h index 86262eab..ff2ec974 100644 --- a/Graphics/GraphicsEngineOpenGL/include/Texture2DArray_OGL.h +++ b/Graphics/GraphicsEngineOpenGL/include/Texture2DArray_OGL.h @@ -28,7 +28,7 @@ namespace Diligent { -class Texture2DArray_OGL : public TextureBaseGL +class Texture2DArray_OGL final : public TextureBaseGL { public: Texture2DArray_OGL( IReferenceCounters *pRefCounters, diff --git a/Graphics/GraphicsEngineOpenGL/include/Texture2D_OGL.h b/Graphics/GraphicsEngineOpenGL/include/Texture2D_OGL.h index ac828b89..af64a86a 100644 --- a/Graphics/GraphicsEngineOpenGL/include/Texture2D_OGL.h +++ b/Graphics/GraphicsEngineOpenGL/include/Texture2D_OGL.h @@ -28,7 +28,7 @@ namespace Diligent { -class Texture2D_OGL : public TextureBaseGL +class Texture2D_OGL final : public TextureBaseGL { public: Texture2D_OGL( IReferenceCounters *pRefCounters, diff --git a/Graphics/GraphicsEngineOpenGL/include/Texture3D_OGL.h b/Graphics/GraphicsEngineOpenGL/include/Texture3D_OGL.h index f7640d5f..5e4ebcec 100644 --- a/Graphics/GraphicsEngineOpenGL/include/Texture3D_OGL.h +++ b/Graphics/GraphicsEngineOpenGL/include/Texture3D_OGL.h @@ -28,7 +28,7 @@ namespace Diligent { -class Texture3D_OGL : public TextureBaseGL +class Texture3D_OGL final : public TextureBaseGL { public: Texture3D_OGL( IReferenceCounters *pRefCounters, diff --git a/Graphics/GraphicsEngineOpenGL/include/TextureCubeArray_OGL.h b/Graphics/GraphicsEngineOpenGL/include/TextureCubeArray_OGL.h index cad44e71..e76ea064 100644 --- a/Graphics/GraphicsEngineOpenGL/include/TextureCubeArray_OGL.h +++ b/Graphics/GraphicsEngineOpenGL/include/TextureCubeArray_OGL.h @@ -28,7 +28,7 @@ namespace Diligent { -class TextureCubeArray_OGL : public TextureBaseGL +class TextureCubeArray_OGL final : public TextureBaseGL { public: TextureCubeArray_OGL( IReferenceCounters *pRefCounters, diff --git a/Graphics/GraphicsEngineOpenGL/include/TextureCube_OGL.h b/Graphics/GraphicsEngineOpenGL/include/TextureCube_OGL.h index 05921b01..a4536847 100644 --- a/Graphics/GraphicsEngineOpenGL/include/TextureCube_OGL.h +++ b/Graphics/GraphicsEngineOpenGL/include/TextureCube_OGL.h @@ -28,7 +28,7 @@ namespace Diligent { -class TextureCube_OGL : public TextureBaseGL +class TextureCube_OGL final : public TextureBaseGL { public: TextureCube_OGL( IReferenceCounters *pRefCounters, diff --git a/Graphics/GraphicsEngineOpenGL/include/TextureViewGLImpl.h b/Graphics/GraphicsEngineOpenGL/include/TextureViewGLImpl.h index 3bff9a36..7f9a16c6 100644 --- a/Graphics/GraphicsEngineOpenGL/include/TextureViewGLImpl.h +++ b/Graphics/GraphicsEngineOpenGL/include/TextureViewGLImpl.h @@ -35,7 +35,7 @@ namespace Diligent class FixedBlockMemoryAllocator; /// Implementation of the Diligent::ITextureViewGL interface -class TextureViewGLImpl : public TextureViewBase +class TextureViewGLImpl final : public TextureViewBase { public: using TTextureViewBase = TextureViewBase; diff --git a/Graphics/GraphicsEngineOpenGL/src/ShaderGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/ShaderGLImpl.cpp index c73705c1..1a3ebfda 100644 --- a/Graphics/GraphicsEngineOpenGL/src/ShaderGLImpl.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/ShaderGLImpl.cpp @@ -194,13 +194,7 @@ IShaderVariable* ShaderGLImpl::GetShaderVariable( const Char* Name ) UNSUPPORTED( "Shader variable queries are currently supported for separable programs only" ); } - auto *pShaderVar = m_GlProgObj.GetConstantResources().GetShaderVariable(Name); - if(!pShaderVar) - { - LOG_ERROR_MESSAGE( "Static shader variable \"", Name, "\" is not found in shader \"", m_Desc.Name ? m_Desc.Name : "", "\". Attempts to set the variable will be silently ignored." ); - pShaderVar = &m_DummyShaderVar; - } - return pShaderVar; + return m_GlProgObj.GetConstantResources().GetShaderVariable(Name); } Uint32 ShaderGLImpl::GetVariableCount() const diff --git a/Graphics/GraphicsEngineOpenGL/src/ShaderResourceBindingGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/ShaderResourceBindingGLImpl.cpp index 2774295b..3d2b7198 100644 --- a/Graphics/GraphicsEngineOpenGL/src/ShaderResourceBindingGLImpl.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/ShaderResourceBindingGLImpl.cpp @@ -32,7 +32,6 @@ namespace Diligent ShaderResourceBindingGLImpl::ShaderResourceBindingGLImpl( IReferenceCounters *pRefCounters, PipelineStateGLImpl *pPSO) : TBase( pRefCounters, pPSO ), - m_DummyShaderVar(*this), m_wpPSO(pPSO) { SHADER_VARIABLE_TYPE VarTypes[] = {SHADER_VARIABLE_TYPE_MUTABLE, SHADER_VARIABLE_TYPE_DYNAMIC}; @@ -85,13 +84,7 @@ void ShaderResourceBindingGLImpl::BindResources(Uint32 ShaderFlags, IResourceMap IShaderVariable *ShaderResourceBindingGLImpl::GetVariable(SHADER_TYPE ShaderType, const char *Name) { auto ShaderInd = GetShaderTypeIndex(ShaderType); - IShaderVariable *pVar = m_DynamicProgResources[ShaderInd].GetShaderVariable(Name); - if( !pVar ) - { - LOG_ERROR_MESSAGE( "Shader variable \"", Name, "\" is not found in the shader resource mapping. Attempts to set the variable will be silently ignored." ); - pVar = &m_DummyShaderVar; - } - return pVar; + return m_DynamicProgResources[ShaderInd].GetShaderVariable(Name); } Uint32 ShaderResourceBindingGLImpl::GetVariableCount(SHADER_TYPE ShaderType) const -- cgit v1.2.3