Skip to content

Commit

Permalink
0033074: Visualization, TKOpenGl - PBR shader compilation error on Me…
Browse files Browse the repository at this point in the history
…sa OpenGL 3.10033074

Graphic3d_ShaderManager::getPBREnvBakingProgram() - fix setting Graphic3d_ShaderProgram::SetPBR()
before defining GLSL version via defaultGlslVersion() that relies on this property.
  • Loading branch information
gkv311 committed Jul 22, 2022
1 parent a626c34 commit 608fba0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Graphic3d/Graphic3d_ShaderManager.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 608fba0

Please sign in to comment.