From 608fba03abb0ff42f01623bb974de088ece04844 Mon Sep 17 00:00:00 2001 From: kgv Date: Fri, 22 Jul 2022 10:55:28 +0300 Subject: [PATCH] 0033074: Visualization, TKOpenGl - PBR shader compilation error on Mesa OpenGL 3.10033074 Graphic3d_ShaderManager::getPBREnvBakingProgram() - fix setting Graphic3d_ShaderProgram::SetPBR() before defining GLSL version via defaultGlslVersion() that relies on this property. --- src/Graphic3d/Graphic3d_ShaderManager.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Graphic3d/Graphic3d_ShaderManager.cxx b/src/Graphic3d/Graphic3d_ShaderManager.cxx index d6dfb378b5..fecc6dae11 100644 --- a/src/Graphic3d/Graphic3d_ShaderManager.cxx +++ b/src/Graphic3d/Graphic3d_ShaderManager.cxx @@ -1545,7 +1545,7 @@ Handle(Graphic3d_ShaderProgram) Graphic3d_ShaderManager::getStdProgramPhong (con } Handle(Graphic3d_ShaderProgram) aProgramSrc = new Graphic3d_ShaderProgram(); - aProgramSrc->SetPBR (theIsPBR); + aProgramSrc->SetPBR (theIsPBR); // should be set before defaultGlslVersion() TCollection_AsciiString aSrcVert, aSrcVertExtraFunc, aSrcVertExtraMain; TCollection_AsciiString aSrcFrag, aSrcFragGetVertColor, aSrcFragExtraMain; @@ -1976,6 +1976,8 @@ Handle(Graphic3d_ShaderProgram) Graphic3d_ShaderManager::getPBREnvBakingProgram { Standard_ASSERT_RAISE (theIndex >= 0 && theIndex <= 2,""); Handle(Graphic3d_ShaderProgram) aProgramSrc = new Graphic3d_ShaderProgram(); + aProgramSrc->SetPBR (true); // should be set before defaultGlslVersion() + Graphic3d_ShaderObject::ShaderVariableList aUniforms, aStageInOuts; TCollection_AsciiString aSrcVert = TCollection_AsciiString() @@ -2022,7 +2024,6 @@ Handle(Graphic3d_ShaderProgram) Graphic3d_ShaderManager::getPBREnvBakingProgram aProgramSrc->SetNbLightsMax (0); aProgramSrc->SetNbShadowMaps (0); aProgramSrc->SetNbClipPlanesMax (0); - aProgramSrc->SetPBR (true); aProgramSrc->AttachShader (Graphic3d_ShaderObject::CreateFromSource (aSrcVert, Graphic3d_TOS_VERTEX, aUniforms, aStageInOuts)); aProgramSrc->AttachShader (Graphic3d_ShaderObject::CreateFromSource (aSrcFrag, Graphic3d_TOS_FRAGMENT, aUniforms, aStageInOuts)); return aProgramSrc;