Skip to content

Commit

Permalink
RTSS: cloneShaderBasedTechniques - ensure src material is loaded
Browse files Browse the repository at this point in the history
so there are supported techniques
  • Loading branch information
paroj committed Jan 4, 2024
1 parent e928eda commit 2feb289
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Components/RTShaderSystem/include/OgreShaderGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ class _OgreRTSSExport ShaderGenerator : public Singleton<ShaderGenerator>, publi
@param dstMat The destination material
@return True if successful
*/
bool cloneShaderBasedTechniques(const Material& srcMat, Material& dstMat);
bool cloneShaderBasedTechniques(Material& srcMat, Material& dstMat);

/**
Remove all shader based techniques that created by this shader generator.
Expand Down
4 changes: 3 additions & 1 deletion Components/RTShaderSystem/src/OgreShaderGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,7 @@ bool ShaderGenerator::removeAllShaderBasedTechniques(const String& materialName,
return true;
}

bool ShaderGenerator::cloneShaderBasedTechniques(const Material& srcMat, Material& dstMat)
bool ShaderGenerator::cloneShaderBasedTechniques(Material& srcMat, Material& dstMat)
{
if(&srcMat == &dstMat) return true; // nothing to do

Expand Down Expand Up @@ -938,6 +938,8 @@ bool ShaderGenerator::cloneShaderBasedTechniques(const Material& srcMat, Materia
// Clone the render states from source to destination
//

srcMat.load(); // ensure supported techniques are loaded

// Check if RTSS techniques exist in the source material
if (itSrcMatEntry != mMaterialEntriesMap.end())
{
Expand Down

0 comments on commit 2feb289

Please sign in to comment.