From 6585bec7cae42818f633b248c5b42b8355e02283 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Fri, 3 Aug 2018 02:08:53 -0700 Subject: Implemented shader variable access by index; Fixed issues with UAV binding in D3D11; Improved shader resource layout in D3D12 --- .../include/GLProgramResources.h | 21 +++++++++++++++++++++ .../GraphicsEngineOpenGL/include/ShaderGLImpl.h | 12 ++++++++---- .../include/ShaderResourceBindingGLImpl.h | 12 ++++++++---- Graphics/GraphicsEngineOpenGL/src/ShaderGLImpl.cpp | 12 ++++++++++++ .../src/ShaderResourceBindingGLImpl.cpp | 12 ++++++++++++ 5 files changed, 61 insertions(+), 8 deletions(-) (limited to 'Graphics/GraphicsEngineOpenGL') diff --git a/Graphics/GraphicsEngineOpenGL/include/GLProgramResources.h b/Graphics/GraphicsEngineOpenGL/include/GLProgramResources.h index 3989f4cd..2d01c261 100644 --- a/Graphics/GraphicsEngineOpenGL/include/GLProgramResources.h +++ b/Graphics/GraphicsEngineOpenGL/include/GLProgramResources.h @@ -194,6 +194,27 @@ namespace Diligent ProgramVar.pResources[FirstElement + i] = ppObjects[i]; } + virtual SHADER_VARIABLE_TYPE GetType()const override final + { + return ProgramVar.VarType; + } + + virtual Uint32 GetArraySize()const override final + { + return static_cast(ProgramVar.pResources.size()); + } + + virtual const Char* GetName()const override final + { + return ProgramVar.Name.c_str(); + } + + virtual Uint32 GetIndex()const override final + { + UNSUPPORTED("Not yet implemented"); + return 0; + } + private: GLProgramVariableBase &ProgramVar; }; diff --git a/Graphics/GraphicsEngineOpenGL/include/ShaderGLImpl.h b/Graphics/GraphicsEngineOpenGL/include/ShaderGLImpl.h index cfdad4fd..a4d1aa05 100644 --- a/Graphics/GraphicsEngineOpenGL/include/ShaderGLImpl.h +++ b/Graphics/GraphicsEngineOpenGL/include/ShaderGLImpl.h @@ -65,7 +65,7 @@ inline GLenum ShaderTypeToGLShaderBit(SHADER_TYPE ShaderType) } /// Implementation of the Diligent::IShaderGL interface -class ShaderGLImpl : public ShaderBase +class ShaderGLImpl final : public ShaderBase { public: using TShaderBase = ShaderBase; @@ -73,11 +73,15 @@ public: ShaderGLImpl( IReferenceCounters *pRefCounters, RenderDeviceGLImpl *pDeviceGL, const ShaderCreationAttribs &ShaderCreationAttribs, bool bIsDeviceInternal = false ); ~ShaderGLImpl(); - virtual void BindResources( IResourceMapping* pResourceMapping, Uint32 Flags )override; + virtual void BindResources( IResourceMapping* pResourceMapping, Uint32 Flags )override final; - virtual void QueryInterface( const Diligent::INTERFACE_ID &IID, IObject **ppInterface )override; + virtual void QueryInterface( const Diligent::INTERFACE_ID &IID, IObject **ppInterface )override final; - virtual IShaderVariable* GetShaderVariable( const Char* Name )override; + virtual IShaderVariable* GetShaderVariable( const Char* Name )override final; + + virtual Uint32 GetVariableCount() const override final; + + virtual IShaderVariable* GetShaderVariable(Uint32 Index) override final; GLProgram& GetGlProgram(){return m_GlProgObj;} diff --git a/Graphics/GraphicsEngineOpenGL/include/ShaderResourceBindingGLImpl.h b/Graphics/GraphicsEngineOpenGL/include/ShaderResourceBindingGLImpl.h index 61b9d013..533eee32 100644 --- a/Graphics/GraphicsEngineOpenGL/include/ShaderResourceBindingGLImpl.h +++ b/Graphics/GraphicsEngineOpenGL/include/ShaderResourceBindingGLImpl.h @@ -37,7 +37,7 @@ namespace Diligent class FixedBlockMemoryAllocator; /// Implementation of the Diligent::IShaderResourceBindingGL interface -class ShaderResourceBindingGLImpl : public ShaderResourceBindingBase +class ShaderResourceBindingGLImpl final : public ShaderResourceBindingBase { public: using TBase = ShaderResourceBindingBase; @@ -45,11 +45,15 @@ public: ShaderResourceBindingGLImpl(IReferenceCounters *pRefCounters, class PipelineStateGLImpl *pPSO); ~ShaderResourceBindingGLImpl(); - virtual void QueryInterface( const Diligent::INTERFACE_ID &IID, IObject **ppInterface )override; + virtual void QueryInterface( const Diligent::INTERFACE_ID &IID, IObject **ppInterface )override final; - virtual void BindResources(Uint32 ShaderFlags, IResourceMapping *pResMapping, Uint32 Flags)override; + virtual void BindResources(Uint32 ShaderFlags, IResourceMapping *pResMapping, Uint32 Flags)override final; - virtual IShaderVariable *GetVariable(SHADER_TYPE ShaderType, const char *Name)override; + virtual IShaderVariable* GetVariable(SHADER_TYPE ShaderType, const char *Name)override final; + + virtual Uint32 GetVariableCount(SHADER_TYPE ShaderType) const override final; + + virtual IShaderVariable* GetVariable(SHADER_TYPE ShaderType, Uint32 Index)override final; GLProgramResources &GetProgramResources(SHADER_TYPE ShaderType, PipelineStateGLImpl *pdbgPSO); diff --git a/Graphics/GraphicsEngineOpenGL/src/ShaderGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/ShaderGLImpl.cpp index f5d2d038..c73705c1 100644 --- a/Graphics/GraphicsEngineOpenGL/src/ShaderGLImpl.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/ShaderGLImpl.cpp @@ -203,4 +203,16 @@ IShaderVariable* ShaderGLImpl::GetShaderVariable( const Char* Name ) return pShaderVar; } +Uint32 ShaderGLImpl::GetVariableCount() const +{ + UNSUPPORTED("Not yet implemented"); + return 0; +} + +IShaderVariable* ShaderGLImpl::GetShaderVariable(Uint32 Index) +{ + UNSUPPORTED("Not yet implemented"); + return nullptr; +} + } diff --git a/Graphics/GraphicsEngineOpenGL/src/ShaderResourceBindingGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/ShaderResourceBindingGLImpl.cpp index 91b19e72..2774295b 100644 --- a/Graphics/GraphicsEngineOpenGL/src/ShaderResourceBindingGLImpl.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/ShaderResourceBindingGLImpl.cpp @@ -94,6 +94,18 @@ IShaderVariable *ShaderResourceBindingGLImpl::GetVariable(SHADER_TYPE ShaderType return pVar; } +Uint32 ShaderResourceBindingGLImpl::GetVariableCount(SHADER_TYPE ShaderType) const +{ + UNSUPPORTED("Not yet implemented"); + return 0; +} + +IShaderVariable* ShaderResourceBindingGLImpl::GetVariable(SHADER_TYPE ShaderType, Uint32 Index) +{ + UNSUPPORTED("Not yet implemented"); + return 0; +} + static GLProgramResources NullProgramResources; GLProgramResources &ShaderResourceBindingGLImpl::GetProgramResources(SHADER_TYPE ShaderType, PipelineStateGLImpl *pdbgPSO) { -- cgit v1.2.3