Skip to content

Commit

Permalink
Fix for gazebosim#578 on macOS / Metal
Browse files Browse the repository at this point in the history
- Move setting params to after the vertex shader has been created and the shader reflection pair hint set.

Signed-off-by: Rhys Mainwaring <[email protected]>
  • Loading branch information
srmainwaring committed Mar 17, 2022
1 parent 23955a9 commit 3b4ae44
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions ogre2/src/Ogre2Material.cc
Original file line number Diff line number Diff line change
Expand Up @@ -862,12 +862,6 @@ Ogre::MaterialPtr Ogre2Material::Material()
IGN_ASSERT(false, "Impossible path!");
}

auto mat = this->dataPtr->ogreSolidColorMat;
auto pass = mat->getTechnique(0u)->getPass(0);
pass->setFragmentProgram(this->dataPtr->ogreSolidColorShader->getName());
auto psParams = pass->getFragmentProgramParameters();
psParams->setNamedAutoConstant("inColor",
Ogre::GpuProgramParameters::ACT_CUSTOM, 1u);
}

return this->ogreMaterial;
Expand Down Expand Up @@ -1210,6 +1204,15 @@ void Ogre2Material::SetVertexShader(const std::string &_path)
this->dataPtr->ogreSolidColorShader->setParameter(
"shader_reflection_pair_hint", vertexShader->getName());

{
auto mat = this->dataPtr->ogreSolidColorMat;
auto pass = mat->getTechnique(0u)->getPass(0);
pass->setFragmentProgram(this->dataPtr->ogreSolidColorShader->getName());
auto psParams = pass->getFragmentProgramParameters();
psParams->setNamedAutoConstant("inColor",
Ogre::GpuProgramParameters::ACT_CUSTOM, 1u);
}

Ogre::MaterialPtr mat[2] = { mainMat, this->dataPtr->ogreSolidColorMat };

for (int i = 0; i < 2; ++i)
Expand Down

0 comments on commit 3b4ae44

Please sign in to comment.