diff options
Diffstat (limited to 'Graphics/GraphicsEngineOpenGL')
3 files changed, 31 insertions, 10 deletions
diff --git a/Graphics/GraphicsEngineOpenGL/src/GLContextWindows.cpp b/Graphics/GraphicsEngineOpenGL/src/GLContextWindows.cpp index 9aa475ab..de1e6e60 100644 --- a/Graphics/GraphicsEngineOpenGL/src/GLContextWindows.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/GLContextWindows.cpp @@ -222,7 +222,7 @@ namespace Diligent glEnable(GL_FRAMEBUFFER_SRGB); if( glGetError() != GL_NO_ERROR ) LOG_ERROR_MESSAGE("Failed to enable SRGB framebuffers"); - +DeviceCaps.bSeparableProgramSupported = false; DeviceCaps.DevType = DeviceType::OpenGL; DeviceCaps.MajorVersion = MajorVersion; DeviceCaps.MinorVersion = MinorVersion; diff --git a/Graphics/GraphicsEngineOpenGL/src/PipelineStateGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/PipelineStateGLImpl.cpp index 86109db4..8c8a106c 100644 --- a/Graphics/GraphicsEngineOpenGL/src/PipelineStateGLImpl.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/PipelineStateGLImpl.cpp @@ -199,7 +199,7 @@ Uint32 PipelineStateGLImpl::GetStaticVariableCount(SHADER_TYPE ShaderType) const { if (m_GLProgram) { - return m_StaticResources[0].GetVariableCount(); + return (m_StaticResources[0].GetShaderStages() & ShaderType) != 0 ? m_StaticResources[0].GetVariableCount() : 0; } else { @@ -212,7 +212,7 @@ IShaderResourceVariable* PipelineStateGLImpl::GetStaticShaderVariable(SHADER_TYP { if (m_GLProgram) { - return m_StaticResources[0].GetVariable(Name); + return (m_StaticResources[0].GetShaderStages() & ShaderType) != 0 ? m_StaticResources[0].GetVariable(Name) : nullptr; } else { @@ -225,7 +225,7 @@ IShaderResourceVariable* PipelineStateGLImpl::GetStaticShaderVariable(SHADER_TYP { if (m_GLProgram) { - return m_StaticResources[0].GetVariable(Index); + return (m_StaticResources[0].GetShaderStages() & ShaderType) != 0 ? m_StaticResources[0].GetVariable(Index) : nullptr; } else { diff --git a/Graphics/GraphicsEngineOpenGL/src/ShaderResourceBindingGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/ShaderResourceBindingGLImpl.cpp index 653930ac..b1099e09 100644 --- a/Graphics/GraphicsEngineOpenGL/src/ShaderResourceBindingGLImpl.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/ShaderResourceBindingGLImpl.cpp @@ -75,20 +75,41 @@ void ShaderResourceBindingGLImpl::BindResources(Uint32 ShaderFlags, IResourceMap IShaderResourceVariable* ShaderResourceBindingGLImpl::GetVariable(SHADER_TYPE ShaderType, const char* Name) { - auto ShaderInd = IsUsingSeparatePrograms() ? m_ResourceIndex[GetShaderTypeIndex(ShaderType)] : 0; - return ShaderInd >= 0 ? m_Resources[ShaderInd].GetVariable(Name) : nullptr; + if (IsUsingSeparatePrograms()) + { + auto ShaderInd = m_ResourceIndex[GetShaderTypeIndex(ShaderType)]; + return ShaderInd >= 0 ? m_Resources[ShaderInd].GetVariable(Name) : nullptr; + } + else + { + return (m_Resources[0].GetShaderStages() & ShaderType) != 0 ? m_Resources[0].GetVariable(Name) : nullptr; + } } Uint32 ShaderResourceBindingGLImpl::GetVariableCount(SHADER_TYPE ShaderType) const { - auto ShaderInd = IsUsingSeparatePrograms() ? m_ResourceIndex[GetShaderTypeIndex(ShaderType)] : 0; - return ShaderInd >= 0 ? m_Resources[ShaderInd].GetVariableCount() : 0; + if (IsUsingSeparatePrograms()) + { + auto ShaderInd = m_ResourceIndex[GetShaderTypeIndex(ShaderType)]; + return ShaderInd >= 0 ? m_Resources[ShaderInd].GetVariableCount() : 0; + } + else + { + return (m_Resources[0].GetShaderStages() & ShaderType) != 0 ? m_Resources[0].GetVariableCount() : 0; + } } IShaderResourceVariable* ShaderResourceBindingGLImpl::GetVariable(SHADER_TYPE ShaderType, Uint32 Index) { - auto ShaderInd = IsUsingSeparatePrograms() ? m_ResourceIndex[GetShaderTypeIndex(ShaderType)] : 0; - return ShaderInd >= 0 ? m_Resources[ShaderInd].GetVariable(Index) : 0; + if (IsUsingSeparatePrograms()) + { + auto ShaderInd = m_ResourceIndex[GetShaderTypeIndex(ShaderType)]; + return ShaderInd >= 0 ? m_Resources[ShaderInd].GetVariable(Index) : 0; + } + else + { + return (m_Resources[0].GetShaderStages() & ShaderType) != 0 ? m_Resources[0].GetVariable(Index) : nullptr; + } } static GLProgramResources NullProgramResources; |
