diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2019-03-05 07:49:24 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2019-03-05 07:49:24 +0000 |
| commit | 4af7e990f7895de63ba886a6e6cd42259ce539aa (patch) | |
| tree | 5fc507e771618f137bbbe060a42a3b0a54d8c009 /Graphics/GraphicsEngineOpenGL | |
| parent | Added ShaderFlags parameter to IPipelineState::BindStaticResources (diff) | |
| download | DiligentCore-4af7e990f7895de63ba886a6e6cd42259ce539aa.tar.gz DiligentCore-4af7e990f7895de63ba886a6e6cd42259ce539aa.zip | |
Started updating GL backend to comply with the updated API
Diffstat (limited to 'Graphics/GraphicsEngineOpenGL')
28 files changed, 77 insertions, 83 deletions
diff --git a/Graphics/GraphicsEngineOpenGL/include/GLContextAndroid.h b/Graphics/GraphicsEngineOpenGL/include/GLContextAndroid.h index db25be8e..72a3c031 100644 --- a/Graphics/GraphicsEngineOpenGL/include/GLContextAndroid.h +++ b/Graphics/GraphicsEngineOpenGL/include/GLContextAndroid.h @@ -33,7 +33,7 @@ namespace Diligent public: typedef EGLContext NativeGLContextType; - GLContext( const struct EngineGLAttribs &InitAttribs, DeviceCaps &DeviceCaps ); + GLContext( const struct EngineGLCreateInfo &InitAttribs, DeviceCaps &DeviceCaps ); ~GLContext(); bool Init( ANativeWindow* window ); diff --git a/Graphics/GraphicsEngineOpenGL/include/GLContextIOS.h b/Graphics/GraphicsEngineOpenGL/include/GLContextIOS.h index 4a343545..76f564fb 100644 --- a/Graphics/GraphicsEngineOpenGL/include/GLContextIOS.h +++ b/Graphics/GraphicsEngineOpenGL/include/GLContextIOS.h @@ -30,7 +30,7 @@ namespace Diligent public: typedef void* NativeGLContextType; // EAGLContext* - GLContext(const struct EngineGLAttribs &InitAttribs, struct DeviceCaps &DeviceCaps); + GLContext(const struct EngineGLCreateInfo &InitAttribs, struct DeviceCaps &DeviceCaps); NativeGLContextType GetCurrentNativeGLContext(); }; diff --git a/Graphics/GraphicsEngineOpenGL/include/GLContextLinux.h b/Graphics/GraphicsEngineOpenGL/include/GLContextLinux.h index 49c5d99a..8c70f11f 100644 --- a/Graphics/GraphicsEngineOpenGL/include/GLContextLinux.h +++ b/Graphics/GraphicsEngineOpenGL/include/GLContextLinux.h @@ -30,7 +30,7 @@ namespace Diligent public: typedef GLXContext NativeGLContextType; - GLContext(const struct EngineGLAttribs &InitAttribs, struct DeviceCaps &DeviceCaps); + GLContext(const struct EngineGLCreateInfo &InitAttribs, struct DeviceCaps &DeviceCaps); ~GLContext(); void SwapBuffers(); diff --git a/Graphics/GraphicsEngineOpenGL/include/GLContextMacOS.h b/Graphics/GraphicsEngineOpenGL/include/GLContextMacOS.h index c8aeb055..1ed87ab4 100644 --- a/Graphics/GraphicsEngineOpenGL/include/GLContextMacOS.h +++ b/Graphics/GraphicsEngineOpenGL/include/GLContextMacOS.h @@ -30,7 +30,7 @@ namespace Diligent public: typedef void* NativeGLContextType; // NSOpenGLContext* - GLContext(const struct EngineGLAttribs &InitAttribs, struct DeviceCaps &DeviceCaps); + GLContext(const struct EngineGLCreateInfo &InitAttribs, struct DeviceCaps &DeviceCaps); NativeGLContextType GetCurrentNativeGLContext(); }; diff --git a/Graphics/GraphicsEngineOpenGL/include/GLContextWindows.h b/Graphics/GraphicsEngineOpenGL/include/GLContextWindows.h index 7c21a25b..cd01d88c 100644 --- a/Graphics/GraphicsEngineOpenGL/include/GLContextWindows.h +++ b/Graphics/GraphicsEngineOpenGL/include/GLContextWindows.h @@ -30,7 +30,7 @@ namespace Diligent public: typedef HGLRC NativeGLContextType; - GLContext( const struct EngineGLAttribs &InitAttribs, struct DeviceCaps &DeviceCaps ); + GLContext( const struct EngineGLCreateInfo &InitAttribs, struct DeviceCaps &DeviceCaps ); ~GLContext(); void SwapBuffers(); diff --git a/Graphics/GraphicsEngineOpenGL/include/GLProgram.h b/Graphics/GraphicsEngineOpenGL/include/GLProgram.h index 296ff4fd..96729fed 100644 --- a/Graphics/GraphicsEngineOpenGL/include/GLProgram.h +++ b/Graphics/GraphicsEngineOpenGL/include/GLProgram.h @@ -38,8 +38,8 @@ namespace Diligent GLProgram& operator = ( GLProgram&&) = delete; void InitResources(RenderDeviceGLImpl* pDeviceGLImpl, - SHADER_VARIABLE_TYPE DefaultVariableType, - const ShaderVariableDesc* VariableDesc, + SHADER_RESOURCE_VARIABLE_TYPE DefaultVariableType, + const ShaderResourceVariableDesc* VariableDesc, Uint32 NumVars, const StaticSamplerDesc* StaticSamplers, Uint32 NumStaticSamplers, diff --git a/Graphics/GraphicsEngineOpenGL/include/GLProgramResources.h b/Graphics/GraphicsEngineOpenGL/include/GLProgramResources.h index 5cf2efe0..85651833 100644 --- a/Graphics/GraphicsEngineOpenGL/include/GLProgramResources.h +++ b/Graphics/GraphicsEngineOpenGL/include/GLProgramResources.h @@ -27,6 +27,7 @@ #include "ShaderBase.h" #include "SamplerGLImpl.h" #include "HashUtils.h" +#include "ShaderResourceVariableBase.h" #ifdef _DEBUG # define VERIFY_RESOURCE_BINDINGS @@ -46,14 +47,14 @@ namespace Diligent void LoadUniforms(class RenderDeviceGLImpl* pDeviceGLImpl, GLuint GLProgram, - const SHADER_VARIABLE_TYPE DefaultVariableType, - const ShaderVariableDesc* VariableDesc, + const SHADER_RESOURCE_VARIABLE_TYPE DefaultVariableType, + const ShaderResourceVariableDesc* VariableDesc, Uint32 NumVars, const StaticSamplerDesc* StaticSamplers, Uint32 NumStaticSamplers); void Clone(const GLProgramResources& SrcLayout, - SHADER_VARIABLE_TYPE* VarTypes, + SHADER_RESOURCE_VARIABLE_TYPE* VarTypes, Uint32 NumVarTypes, IObject& Owner); @@ -61,7 +62,7 @@ namespace Diligent { GLProgramVariableBase(String _Name, size_t _ArraySize, - SHADER_VARIABLE_TYPE _VarType) : + SHADER_RESOURCE_VARIABLE_TYPE _VarType) : Name ( std::move(_Name) ), pResources(_ArraySize), VarType (_VarType) @@ -82,14 +83,14 @@ namespace Diligent String Name; std::vector< RefCntAutoPtr<IDeviceObject> > pResources; - const SHADER_VARIABLE_TYPE VarType; + const SHADER_RESOURCE_VARIABLE_TYPE VarType; }; struct UniformBufferInfo : GLProgramVariableBase { UniformBufferInfo(String _Name, size_t _ArraySize, - SHADER_VARIABLE_TYPE _VarType, + SHADER_RESOURCE_VARIABLE_TYPE _VarType, GLint _Index) : GLProgramVariableBase(std::move(_Name), _ArraySize, _VarType), Index(_Index) @@ -114,7 +115,7 @@ namespace Diligent { SamplerInfo(String _Name, size_t _ArraySize, - SHADER_VARIABLE_TYPE _VarType, + SHADER_RESOURCE_VARIABLE_TYPE _VarType, GLint _Location, GLenum _Type, class SamplerGLImpl* _pStaticSampler) : @@ -146,7 +147,7 @@ namespace Diligent { ImageInfo(String _Name, size_t _ArraySize, - SHADER_VARIABLE_TYPE _VarType, + SHADER_RESOURCE_VARIABLE_TYPE _VarType, GLint _BindingPoint, GLenum _Type) : GLProgramVariableBase(std::move(_Name), _ArraySize, _VarType), @@ -175,7 +176,7 @@ namespace Diligent { StorageBlockInfo(String _Name, size_t _ArraySize, - SHADER_VARIABLE_TYPE _VarType, + SHADER_RESOURCE_VARIABLE_TYPE _VarType, GLint _Binding) : GLProgramVariableBase(std::move(_Name), _ArraySize, _VarType), Binding(_Binding) @@ -216,7 +217,7 @@ namespace Diligent ProgramVar.pResources[FirstElement + i] = ppObjects[i]; } - virtual SHADER_VARIABLE_TYPE GetType()const override final + virtual SHADER_RESOURCE_VARIABLE_TYPE GetType()const override final { return ProgramVar.VarType; } @@ -247,8 +248,8 @@ namespace Diligent void dbgVerifyResourceBindings(); #endif - IShaderVariable* GetShaderVariable(const Char* Name); - IShaderVariable* GetShaderVariable(Uint32 Index) + IShaderResourceVariable* GetShaderVariable(const Char* Name); + IShaderResourceVariable* GetShaderVariable(Uint32 Index) { return Index < m_VariablesByIndex.size() ? m_VariablesByIndex[Index] : nullptr; } diff --git a/Graphics/GraphicsEngineOpenGL/include/PipelineStateGLImpl.h b/Graphics/GraphicsEngineOpenGL/include/PipelineStateGLImpl.h index 3e1bbbb1..dbf2b07b 100644 --- a/Graphics/GraphicsEngineOpenGL/include/PipelineStateGLImpl.h +++ b/Graphics/GraphicsEngineOpenGL/include/PipelineStateGLImpl.h @@ -51,7 +51,7 @@ public: /// Queries the specific interface, see IObject::QueryInterface() for details virtual void QueryInterface( const INTERFACE_ID& IID, IObject** ppInterface )override; - virtual void BindShaderResources( IResourceMapping* pResourceMapping, Uint32 Flags )override final; + virtual void BindStaticResources(Uint32 ShaderFlags, IResourceMapping* pResourceMapping, Uint32 Flags)override final; virtual void CreateShaderResourceBinding( IShaderResourceBinding** ppShaderResourceBinding, bool InitStaticResources )override final; diff --git a/Graphics/GraphicsEngineOpenGL/include/RenderDeviceGLImpl.h b/Graphics/GraphicsEngineOpenGL/include/RenderDeviceGLImpl.h index b0b67c32..03c8f998 100644 --- a/Graphics/GraphicsEngineOpenGL/include/RenderDeviceGLImpl.h +++ b/Graphics/GraphicsEngineOpenGL/include/RenderDeviceGLImpl.h @@ -29,7 +29,6 @@ #include "BaseInterfacesGL.h" #include "FBOCache.h" #include "TexRegionRender.h" -#include "EngineGLAttribs.h" enum class GPU_VENDOR { @@ -55,15 +54,15 @@ class RenderDeviceGLImpl : public RenderDeviceBase<IGLDeviceBaseInterface> public: using TRenderDeviceBase = RenderDeviceBase<IGLDeviceBaseInterface>; - RenderDeviceGLImpl( IReferenceCounters *pRefCounters, IMemoryAllocator &RawMemAllocator, const EngineGLAttribs &InitAttribs ); + RenderDeviceGLImpl( IReferenceCounters *pRefCounters, IMemoryAllocator &RawMemAllocator, const EngineGLCreateInfo &InitAttribs ); ~RenderDeviceGLImpl(); virtual void QueryInterface( const Diligent::INTERFACE_ID &IID, IObject **ppInterface )override; void CreateBuffer(const BufferDesc& BuffDesc, const BufferData* pBuffData, IBuffer **ppBufferLayout, bool bIsDeviceInternal); virtual void CreateBuffer(const BufferDesc& BuffDesc, const BufferData* BuffData, IBuffer **ppBufferLayout)override final; - void CreateShader(const ShaderCreationAttribs &ShaderCreationAttribs, IShader **ppShader, bool bIsDeviceInternal ); - virtual void CreateShader(const ShaderCreationAttribs &ShaderCreationAttribs, IShader **ppShader)override final; + void CreateShader(const ShaderCreateInfo &ShaderCreateInfo, IShader **ppShader, bool bIsDeviceInternal ); + virtual void CreateShader(const ShaderCreateInfo &ShaderCreateInfo, IShader **ppShader)override final; void CreateTexture(const TextureDesc& TexDesc, const TextureData* pData, ITexture **ppTexture, bool bIsDeviceInternal); virtual void CreateTexture(const TextureDesc& TexDesc, const TextureData* Data, ITexture **ppTexture)override final; diff --git a/Graphics/GraphicsEngineOpenGL/include/ShaderGLImpl.h b/Graphics/GraphicsEngineOpenGL/include/ShaderGLImpl.h index 77c5f554..b8d607ea 100644 --- a/Graphics/GraphicsEngineOpenGL/include/ShaderGLImpl.h +++ b/Graphics/GraphicsEngineOpenGL/include/ShaderGLImpl.h @@ -70,7 +70,7 @@ class ShaderGLImpl final : public ShaderBase<IShaderGL, RenderDeviceGLImpl> public: using TShaderBase = ShaderBase<IShaderGL, RenderDeviceGLImpl>; - ShaderGLImpl( IReferenceCounters *pRefCounters, RenderDeviceGLImpl *pDeviceGL, const ShaderCreationAttribs &ShaderCreationAttribs, bool bIsDeviceInternal = false ); + ShaderGLImpl( IReferenceCounters *pRefCounters, RenderDeviceGLImpl *pDeviceGL, const ShaderCreateInfo &ShaderCreateInfo, bool bIsDeviceInternal = false ); ~ShaderGLImpl(); virtual void BindResources( IResourceMapping* pResourceMapping, Uint32 Flags )override final; @@ -79,21 +79,21 @@ public: // If separate shaders are not available, the method can optionally create // a placeholder for static resource variable - IShaderVariable* GetShaderVariable(const Char* Name, bool CreatePlaceholder); - virtual IShaderVariable* GetShaderVariable(const Char* Name)override final; + IShaderResourceVariable* GetShaderVariable(const Char* Name, bool CreatePlaceholder); + virtual IShaderResourceVariable* GetShaderVariable(const Char* Name)override final; virtual Uint32 GetVariableCount() const override final; - virtual IShaderVariable* GetShaderVariable(Uint32 Index) override final; + virtual IShaderResourceVariable* GetShaderVariable(Uint32 Index) override final; GLProgram& GetGlProgram(){return m_GlProgObj;} // This class is used to keep references to static resources when separate shaders are not available - class StaticVarPlaceholder final : public ObjectBase<IShaderVariable> + class StaticVarPlaceholder final : public ObjectBase<IShaderResourceVariable> { public: StaticVarPlaceholder(IReferenceCounters* pRefCounters, String Name, Uint32 Index) : - ObjectBase<IShaderVariable>(pRefCounters), + ObjectBase<IShaderResourceVariable>(pRefCounters), m_Name (std::move(Name)), m_Index (Index) {} @@ -109,9 +109,9 @@ public: for (Uint32 i=0; i < NumElements; ++i) m_Objects[FirstElement + i] = ppObjects[i]; } - virtual SHADER_VARIABLE_TYPE GetType()const override final + virtual SHADER_RESOURCE_VARIABLE_TYPE GetType()const override final { - return SHADER_VARIABLE_TYPE_STATIC; + return SHADER_RESOURCE_VARIABLE_TYPE_STATIC; } virtual Uint32 GetArraySize()const override final { diff --git a/Graphics/GraphicsEngineOpenGL/include/ShaderResourceBindingGLImpl.h b/Graphics/GraphicsEngineOpenGL/include/ShaderResourceBindingGLImpl.h index ac76461b..243b7354 100644 --- a/Graphics/GraphicsEngineOpenGL/include/ShaderResourceBindingGLImpl.h +++ b/Graphics/GraphicsEngineOpenGL/include/ShaderResourceBindingGLImpl.h @@ -51,11 +51,11 @@ public: virtual void BindResources(Uint32 ShaderFlags, IResourceMapping* pResMapping, Uint32 Flags)override final; - virtual IShaderVariable* GetVariable(SHADER_TYPE ShaderType, const char *Name)override final; + virtual IShaderResourceVariable* 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; + virtual IShaderResourceVariable* GetVariable(SHADER_TYPE ShaderType, Uint32 Index)override final; virtual void InitializeStaticResources(const IPipelineState* pPipelineState)override final; diff --git a/Graphics/GraphicsEngineOpenGL/include/SwapChainGLImpl.h b/Graphics/GraphicsEngineOpenGL/include/SwapChainGLImpl.h index e92bc0a5..d5d427f1 100644 --- a/Graphics/GraphicsEngineOpenGL/include/SwapChainGLImpl.h +++ b/Graphics/GraphicsEngineOpenGL/include/SwapChainGLImpl.h @@ -23,7 +23,6 @@ #pragma once -#include "EngineGLAttribs.h" #include "SwapChainGL.h" #include "SwapChainBase.h" #include "GLObjectWrapper.h" @@ -38,11 +37,11 @@ class SwapChainGLImpl final : public SwapChainBase<ISwapChainGL> public: using TSwapChainBase = SwapChainBase<ISwapChainGL>; - SwapChainGLImpl(IReferenceCounters *pRefCounters, - const EngineGLAttribs &InitAttribs, - const SwapChainDesc& SwapChainDesc, - class RenderDeviceGLImpl* pRenderDeviceGL, - class DeviceContextGLImpl* pImmediateContextGL); + SwapChainGLImpl(IReferenceCounters* pRefCounters, + const EngineGLCreateInfo& InitAttribs, + const SwapChainDesc& SwapChainDesc, + class RenderDeviceGLImpl* pRenderDeviceGL, + class DeviceContextGLImpl* pImmediateContextGL); ~SwapChainGLImpl(); virtual void QueryInterface( const Diligent::INTERFACE_ID &IID, IObject **ppInterface )override final; diff --git a/Graphics/GraphicsEngineOpenGL/include/TexRegionRender.h b/Graphics/GraphicsEngineOpenGL/include/TexRegionRender.h index 91c31b08..72c64d91 100644 --- a/Graphics/GraphicsEngineOpenGL/include/TexRegionRender.h +++ b/Graphics/GraphicsEngineOpenGL/include/TexRegionRender.h @@ -48,7 +48,7 @@ private: RefCntAutoPtr<IBuffer> m_pConstantBuffer; RefCntAutoPtr<IPipelineState> m_pPSO[RESOURCE_DIM_NUM_DIMENSIONS * 3]; RefCntAutoPtr<IShaderResourceBinding> m_pSRB; - IShaderVariable* m_pSrcTexVar = nullptr; + IShaderResourceVariable* m_pSrcTexVar = nullptr; RefCntAutoPtr<IPipelineState> m_pOrigPSO; Uint32 m_OrigStencilRef = 0; diff --git a/Graphics/GraphicsEngineOpenGL/readme.md b/Graphics/GraphicsEngineOpenGL/readme.md index dfa2109d..ab987dad 100644 --- a/Graphics/GraphicsEngineOpenGL/readme.md +++ b/Graphics/GraphicsEngineOpenGL/readme.md @@ -23,7 +23,7 @@ RefCntAutoPtr<IDeviceContext> pImmediateContext; SwapChainDesc SCDesc; RefCntAutoPtr<ISwapChain> pSwapChain; auto *pFactoryOpenGL = GetEngineFactoryOpenGL(); -EngineGLAttribs CreationAttribs; +EngineGLCreateInfo CreationAttribs; CreationAttribs.pNativeWndHandle = NativeWindowHandle; pFactoryOpenGL->CreateDeviceAndSwapChainGL( CreationAttribs, &pRenderDevice, &pImmediateContext, SCDesc, &pSwapChain); diff --git a/Graphics/GraphicsEngineOpenGL/src/EngineFactoryOpenGL.cpp b/Graphics/GraphicsEngineOpenGL/src/EngineFactoryOpenGL.cpp index 04d1ce83..21520138 100644 --- a/Graphics/GraphicsEngineOpenGL/src/EngineFactoryOpenGL.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/EngineFactoryOpenGL.cpp @@ -25,7 +25,7 @@ /// Routines that initialize OpenGL/GLES-based engine implementation #include "pch.h" -#include "RenderDeviceFactoryOpenGL.h" +#include "EngineFactoryOpenGL.h" #include "RenderDeviceGLImpl.h" #include "DeviceContextGLImpl.h" #include "EngineMemory.h" diff --git a/Graphics/GraphicsEngineOpenGL/src/GLContextAndroid.cpp b/Graphics/GraphicsEngineOpenGL/src/GLContextAndroid.cpp index 0e0f877e..f8f202c7 100644 --- a/Graphics/GraphicsEngineOpenGL/src/GLContextAndroid.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/GLContextAndroid.cpp @@ -25,7 +25,6 @@ #include <utility> #include "GLContextAndroid.h" -#include "EngineGLAttribs.h" #ifndef EGL_CONTEXT_MINOR_VERSION_KHR #define EGL_CONTEXT_MINOR_VERSION_KHR 0x30FB @@ -229,7 +228,7 @@ namespace Diligent return true; } - GLContext::GLContext( const EngineGLAttribs &InitAttribs, DeviceCaps &DeviceCaps ) : + GLContext::GLContext( const EngineGLCreateInfo &InitAttribs, DeviceCaps &DeviceCaps ) : display_( EGL_NO_DISPLAY ), surface_( EGL_NO_SURFACE ), context_( EGL_NO_CONTEXT ), diff --git a/Graphics/GraphicsEngineOpenGL/src/GLContextIOS.mm b/Graphics/GraphicsEngineOpenGL/src/GLContextIOS.mm index 5567eb0e..d5f2184b 100644 --- a/Graphics/GraphicsEngineOpenGL/src/GLContextIOS.mm +++ b/Graphics/GraphicsEngineOpenGL/src/GLContextIOS.mm @@ -28,11 +28,10 @@ #include "GLContextIOS.h" #include "DeviceCaps.h" #include "GLTypeConversions.h" -#include "EngineGLAttribs.h" namespace Diligent { - GLContext::GLContext( const EngineGLAttribs &Info, DeviceCaps &DeviceCaps ) + GLContext::GLContext( const EngineGLCreateInfo &Info, DeviceCaps &DeviceCaps ) { if (GetCurrentNativeGLContext() == nullptr) { diff --git a/Graphics/GraphicsEngineOpenGL/src/GLContextLinux.cpp b/Graphics/GraphicsEngineOpenGL/src/GLContextLinux.cpp index d4f38df3..e6fe5e89 100644 --- a/Graphics/GraphicsEngineOpenGL/src/GLContextLinux.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/GLContextLinux.cpp @@ -26,7 +26,6 @@ #include "GLContextLinux.h" #include "DeviceCaps.h" #include "GLTypeConversions.h" -#include "EngineGLAttribs.h" namespace Diligent { @@ -84,7 +83,7 @@ namespace Diligent LOG_INFO_MESSAGE( MessageSS.str().c_str() ); } - GLContext::GLContext( const EngineGLAttribs &InitAttribs, DeviceCaps &DeviceCaps ) : + GLContext::GLContext( const EngineGLCreateInfo &InitAttribs, DeviceCaps &DeviceCaps ) : m_Context(0), m_pNativeWindow(InitAttribs.pNativeWndHandle), m_pDisplay(InitAttribs.pDisplay) diff --git a/Graphics/GraphicsEngineOpenGL/src/GLContextMacOS.mm b/Graphics/GraphicsEngineOpenGL/src/GLContextMacOS.mm index 88e2c9c9..76cb9dcc 100644 --- a/Graphics/GraphicsEngineOpenGL/src/GLContextMacOS.mm +++ b/Graphics/GraphicsEngineOpenGL/src/GLContextMacOS.mm @@ -28,7 +28,6 @@ #include "GLContextMacOS.h" #include "DeviceCaps.h" #include "GLTypeConversions.h" -#include "EngineGLAttribs.h" static void glDrawArraysInstancedBaseInstance_stub(GLenum mode, GLint first, GLsizei count, GLsizei primcount, GLuint baseinstance) { @@ -48,7 +47,7 @@ static void glDrawElementsInstancedBaseVertexBaseInstance_stub(GLenum mode, GLs namespace Diligent { - GLContext::GLContext( const EngineGLAttribs &InitAttribs, DeviceCaps &DeviceCaps ) + GLContext::GLContext( const EngineGLCreateInfo &InitAttribs, DeviceCaps &DeviceCaps ) { if (GetCurrentNativeGLContext() == nullptr) { diff --git a/Graphics/GraphicsEngineOpenGL/src/GLContextWindows.cpp b/Graphics/GraphicsEngineOpenGL/src/GLContextWindows.cpp index 88b46b2b..9aa475ab 100644 --- a/Graphics/GraphicsEngineOpenGL/src/GLContextWindows.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/GLContextWindows.cpp @@ -26,7 +26,6 @@ #include "GLContextWindows.h" #include "DeviceCaps.h" #include "GLTypeConversions.h" -#include "EngineGLAttribs.h" namespace Diligent { @@ -89,7 +88,7 @@ namespace Diligent LOG_INFO_MESSAGE( MessageSS.str().c_str() ); } - GLContext::GLContext(const EngineGLAttribs &InitAttribs, DeviceCaps &DeviceCaps ) : + GLContext::GLContext(const EngineGLCreateInfo &InitAttribs, DeviceCaps &DeviceCaps ) : m_Context(0), m_WindowHandleToDeviceContext(0) { diff --git a/Graphics/GraphicsEngineOpenGL/src/GLProgram.cpp b/Graphics/GraphicsEngineOpenGL/src/GLProgram.cpp index c3108330..07c2117c 100644 --- a/Graphics/GraphicsEngineOpenGL/src/GLProgram.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/GLProgram.cpp @@ -39,8 +39,8 @@ namespace Diligent {} void GLProgram::InitResources(RenderDeviceGLImpl* pDeviceGLImpl, - const SHADER_VARIABLE_TYPE DefaultVariableType, - const ShaderVariableDesc *VariableDesc, + const SHADER_RESOURCE_VARIABLE_TYPE DefaultVariableType, + const ShaderResourceVariableDesc *VariableDesc, Uint32 NumVars, const StaticSamplerDesc *StaticSamplers, Uint32 NumStaticSamplers, @@ -49,7 +49,7 @@ namespace Diligent GLuint GLProgram = static_cast<GLuint>(*this); m_AllResources.LoadUniforms(pDeviceGLImpl, GLProgram, DefaultVariableType, VariableDesc, NumVars, StaticSamplers, NumStaticSamplers); - SHADER_VARIABLE_TYPE VarTypes[] = {SHADER_VARIABLE_TYPE_STATIC}; + SHADER_RESOURCE_VARIABLE_TYPE VarTypes[] = {SHADER_RESOURCE_VARIABLE_TYPE_STATIC}; m_ConstantResources.Clone(m_AllResources, VarTypes, _countof(VarTypes), Owner); } diff --git a/Graphics/GraphicsEngineOpenGL/src/GLProgramResources.cpp b/Graphics/GraphicsEngineOpenGL/src/GLProgramResources.cpp index d662207f..34529cbf 100644 --- a/Graphics/GraphicsEngineOpenGL/src/GLProgramResources.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/GLProgramResources.cpp @@ -46,8 +46,8 @@ namespace Diligent void GLProgramResources::LoadUniforms(RenderDeviceGLImpl *pDeviceGLImpl, GLuint GLProgram, - const SHADER_VARIABLE_TYPE DefaultVariableType, - const ShaderVariableDesc *VariableDesc, + const SHADER_RESOURCE_VARIABLE_TYPE DefaultVariableType, + const ShaderResourceVariableDesc *VariableDesc, Uint32 NumVars, const StaticSamplerDesc *StaticSamplers, Uint32 NumStaticSamplers) @@ -348,7 +348,7 @@ namespace Diligent } - static bool CheckType(SHADER_VARIABLE_TYPE Type, SHADER_VARIABLE_TYPE* AllowedTypes, Uint32 NumAllowedTypes) + static bool CheckType(SHADER_RESOURCE_VARIABLE_TYPE Type, SHADER_RESOURCE_VARIABLE_TYPE* AllowedTypes, Uint32 NumAllowedTypes) { for(Uint32 i=0; i < NumAllowedTypes; ++i) if(Type == AllowedTypes[i]) @@ -358,7 +358,7 @@ namespace Diligent } void GLProgramResources::Clone(const GLProgramResources& SrcLayout, - SHADER_VARIABLE_TYPE* VarTypes, + SHADER_RESOURCE_VARIABLE_TYPE* VarTypes, Uint32 NumVarTypes, IObject& Owner) { @@ -414,7 +414,7 @@ namespace Diligent #undef STORE_SHADER_VARIABLES } - IShaderVariable* GLProgramResources::GetShaderVariable( const Char* Name ) + IShaderResourceVariable* GLProgramResources::GetShaderVariable( const Char* Name ) { // Name will be implicitly converted to HashMapStringKey without making a copy auto it = m_VariableHash.find( Name ); @@ -446,7 +446,7 @@ namespace Diligent if (pNewRes != nullptr) { - if(res.VarType == SHADER_VARIABLE_TYPE_STATIC && CurrResource != nullptr && CurrResource != pNewRes ) + if(res.VarType == SHADER_RESOURCE_VARIABLE_TYPE_STATIC && CurrResource != nullptr && CurrResource != pNewRes ) LOG_ERROR_MESSAGE( "Updating binding for static variable \"", Name, "\" is invalid and may result in an undefined behavior" ); CurrResource = pNewRes; } diff --git a/Graphics/GraphicsEngineOpenGL/src/PipelineStateGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/PipelineStateGLImpl.cpp index 3f0fed9b..9071b815 100644 --- a/Graphics/GraphicsEngineOpenGL/src/PipelineStateGLImpl.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/PipelineStateGLImpl.cpp @@ -99,9 +99,9 @@ void PipelineStateGLImpl::LinkGLProgram(bool bIsProgramPipelineSupported) CHECK_GL_ERROR("glDetachShader() failed"); } - std::vector<ShaderVariableDesc> MergedVarTypesArray; + std::vector<ShaderResourceVariableDesc> MergedVarTypesArray; std::vector<StaticSamplerDesc> MergedStSamArray; - SHADER_VARIABLE_TYPE DefaultVarType = SHADER_VARIABLE_TYPE_STATIC; + SHADER_RESOURCE_VARIABLE_TYPE DefaultVarType = SHADER_RESOURCE_VARIABLE_TYPE_STATIC; for (Uint32 Shader = 0; Shader < m_NumShaders; ++Shader) { auto* pCurrShader = GetShader<ShaderGLImpl>(Shader); diff --git a/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp index d7f79554..0bd6538b 100644 --- a/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp @@ -47,7 +47,7 @@ namespace Diligent { -RenderDeviceGLImpl :: RenderDeviceGLImpl(IReferenceCounters *pRefCounters, IMemoryAllocator& RawMemAllocator, const EngineGLAttribs& InitAttribs): +RenderDeviceGLImpl :: RenderDeviceGLImpl(IReferenceCounters *pRefCounters, IMemoryAllocator& RawMemAllocator, const EngineGLCreateInfo& InitAttribs): TRenderDeviceBase { pRefCounters, @@ -136,13 +136,13 @@ void RenderDeviceGLImpl :: CreateBufferFromGLHandle(Uint32 GLHandle, const Buffe ); } -void RenderDeviceGLImpl :: CreateShader(const ShaderCreationAttribs& ShaderCreationAttribs, IShader** ppShader, bool bIsDeviceInternal) +void RenderDeviceGLImpl :: CreateShader(const ShaderCreateInfo& ShaderCreateInfo, IShader** ppShader, bool bIsDeviceInternal) { - CreateDeviceObject( "shader", ShaderCreationAttribs.Desc, ppShader, + CreateDeviceObject( "shader", ShaderCreateInfo.Desc, ppShader, [&]() { ShaderGLImpl *pShaderOGL(NEW_RC_OBJ(m_ShaderObjAllocator, "ShaderGLImpl instance", ShaderGLImpl) - (this, ShaderCreationAttribs, bIsDeviceInternal)); + (this, ShaderCreateInfo, bIsDeviceInternal)); pShaderOGL->QueryInterface(IID_Shader, reinterpret_cast<IObject**>(ppShader) ); OnCreateDeviceObject( pShaderOGL ); @@ -150,9 +150,9 @@ void RenderDeviceGLImpl :: CreateShader(const ShaderCreationAttribs& ShaderCreat ); } -void RenderDeviceGLImpl :: CreateShader(const ShaderCreationAttribs& ShaderCreationAttribs, IShader **ppShader) +void RenderDeviceGLImpl :: CreateShader(const ShaderCreateInfo& ShaderCreateInfo, IShader **ppShader) { - CreateShader(ShaderCreationAttribs, ppShader, false); + CreateShader(ShaderCreateInfo, ppShader, false); } void RenderDeviceGLImpl :: CreateTexture(const TextureDesc& TexDesc, const TextureData* pData, ITexture **ppTexture, bool bIsDeviceInternal) diff --git a/Graphics/GraphicsEngineOpenGL/src/ShaderGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/ShaderGLImpl.cpp index 65a797c0..7e6340dc 100644 --- a/Graphics/GraphicsEngineOpenGL/src/ShaderGLImpl.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/ShaderGLImpl.cpp @@ -35,7 +35,7 @@ namespace Diligent ShaderGLImpl::ShaderGLImpl(IReferenceCounters* pRefCounters, RenderDeviceGLImpl* pDeviceGL, - const ShaderCreationAttribs& CreationAttribs, + const ShaderCreateInfo& CreationAttribs, bool bIsDeviceInternal) : TShaderBase( pRefCounters, pDeviceGL, CreationAttribs.Desc, bIsDeviceInternal ), m_GlProgObj(false), @@ -186,12 +186,12 @@ void ShaderGLImpl::BindResources( IResourceMapping* pResourceMapping, Uint32 Fla } } -IShaderVariable* ShaderGLImpl::GetShaderVariable(const Char* Name) +IShaderResourceVariable* ShaderGLImpl::GetShaderVariable(const Char* Name) { return GetShaderVariable(Name, true); } -IShaderVariable* ShaderGLImpl::GetShaderVariable(const Char* Name, bool CreatePlaceholder) +IShaderResourceVariable* ShaderGLImpl::GetShaderVariable(const Char* Name, bool CreatePlaceholder) { if( m_GlProgObj ) return m_GlProgObj.GetConstantResources().GetShaderVariable(Name); @@ -228,7 +228,7 @@ Uint32 ShaderGLImpl::GetVariableCount() const } } -IShaderVariable* ShaderGLImpl::GetShaderVariable(Uint32 Index) +IShaderResourceVariable* ShaderGLImpl::GetShaderVariable(Uint32 Index) { if( m_GlProgObj ) return m_GlProgObj.GetConstantResources().GetShaderVariable(Index); diff --git a/Graphics/GraphicsEngineOpenGL/src/ShaderResourceBindingGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/ShaderResourceBindingGLImpl.cpp index f58be350..5930f0a6 100644 --- a/Graphics/GraphicsEngineOpenGL/src/ShaderResourceBindingGLImpl.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/ShaderResourceBindingGLImpl.cpp @@ -35,7 +35,7 @@ ShaderResourceBindingGLImpl::ShaderResourceBindingGLImpl(IReferenceCounters* pRe { if (IsUsingSeparatePrograms()) { - SHADER_VARIABLE_TYPE VarTypes[] = {SHADER_VARIABLE_TYPE_MUTABLE, SHADER_VARIABLE_TYPE_DYNAMIC}; + SHADER_RESOURCE_VARIABLE_TYPE VarTypes[] = {SHADER_RESOURCE_VARIABLE_TYPE_MUTABLE, SHADER_RESOURCE_VARIABLE_TYPE_DYNAMIC}; #define INIT_SHADER(SN)\ if(auto p##SN = ValidatedCast<ShaderGLImpl>( pPSO->Get##SN() )) \ { \ @@ -54,7 +54,7 @@ ShaderResourceBindingGLImpl::ShaderResourceBindingGLImpl(IReferenceCounters* pRe else { // Clone all variable types - SHADER_VARIABLE_TYPE VarTypes[] = {SHADER_VARIABLE_TYPE_STATIC, SHADER_VARIABLE_TYPE_MUTABLE, SHADER_VARIABLE_TYPE_DYNAMIC}; + SHADER_RESOURCE_VARIABLE_TYPE VarTypes[] = {SHADER_RESOURCE_VARIABLE_TYPE_STATIC, SHADER_RESOURCE_VARIABLE_TYPE_MUTABLE, SHADER_RESOURCE_VARIABLE_TYPE_DYNAMIC}; m_DynamicProgResources[0].Clone(pPSO->GetGLProgram().GetAllResources(), VarTypes, _countof(VarTypes), *this); } } @@ -94,7 +94,7 @@ void ShaderResourceBindingGLImpl::BindResources(Uint32 ShaderFlags, IResourceMap } } -IShaderVariable* ShaderResourceBindingGLImpl::GetVariable(SHADER_TYPE ShaderType, const char* Name) +IShaderResourceVariable* ShaderResourceBindingGLImpl::GetVariable(SHADER_TYPE ShaderType, const char* Name) { auto ShaderInd = IsUsingSeparatePrograms() ? GetShaderTypeIndex(ShaderType) : 0; return m_DynamicProgResources[ShaderInd].GetShaderVariable(Name); @@ -106,7 +106,7 @@ Uint32 ShaderResourceBindingGLImpl::GetVariableCount(SHADER_TYPE ShaderType) con return m_DynamicProgResources[ShaderInd].GetVariableCount(); } -IShaderVariable* ShaderResourceBindingGLImpl::GetVariable(SHADER_TYPE ShaderType, Uint32 Index) +IShaderResourceVariable* ShaderResourceBindingGLImpl::GetVariable(SHADER_TYPE ShaderType, Uint32 Index) { auto ShaderInd = IsUsingSeparatePrograms() ? GetShaderTypeIndex(ShaderType) : 0; return m_DynamicProgResources[ShaderInd].GetShaderVariable(Index); diff --git a/Graphics/GraphicsEngineOpenGL/src/SwapChainGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/SwapChainGLImpl.cpp index bf1e706c..9fb44c53 100644 --- a/Graphics/GraphicsEngineOpenGL/src/SwapChainGLImpl.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/SwapChainGLImpl.cpp @@ -29,7 +29,7 @@ namespace Diligent { SwapChainGLImpl::SwapChainGLImpl(IReferenceCounters *pRefCounters, - const EngineGLAttribs &InitAttribs, + const EngineGLCreateInfo &InitAttribs, const SwapChainDesc& SCDesc, RenderDeviceGLImpl* pRenderDeviceGL, DeviceContextGLImpl* pImmediateContextGL) : diff --git a/Graphics/GraphicsEngineOpenGL/src/TexRegionRender.cpp b/Graphics/GraphicsEngineOpenGL/src/TexRegionRender.cpp index 312889e7..9bbb9c89 100644 --- a/Graphics/GraphicsEngineOpenGL/src/TexRegionRender.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/TexRegionRender.cpp @@ -58,10 +58,10 @@ namespace Diligent TexRegionRender::TexRegionRender( class RenderDeviceGLImpl *pDeviceGL ) { - ShaderCreationAttribs ShaderAttrs; + ShaderCreateInfo ShaderAttrs; ShaderAttrs.Desc.Name = "TexRegionRender : Vertex shader"; ShaderAttrs.Desc.ShaderType = SHADER_TYPE_VERTEX; - ShaderAttrs.Desc.DefaultVariableType = SHADER_VARIABLE_TYPE_DYNAMIC; + ShaderAttrs.Desc.DefaultVariableType = SHADER_RESOURCE_VARIABLE_TYPE_DYNAMIC; ShaderAttrs.Source = VertexShaderSource; constexpr bool IsInternalDeviceObject = true; pDeviceGL->CreateShader(ShaderAttrs, &m_pVertexShader, IsInternalDeviceObject); @@ -117,9 +117,9 @@ namespace Diligent Name.append(SamplerDim); ShaderAttrs.Desc.Name = Name.c_str(); ShaderAttrs.Desc.ShaderType = SHADER_TYPE_PIXEL; - ShaderVariableDesc Vars[] = + ShaderResourceVariableDesc Vars[] = { - {"cbConstants", SHADER_VARIABLE_TYPE_MUTABLE} + {"cbConstants", SHADER_RESOURCE_VARIABLE_TYPE_MUTABLE} }; ShaderAttrs.Desc.NumVariables = _countof(Vars); ShaderAttrs.Desc.VariableDesc = Vars; |
