Skip to content

Commit 7581aa5

Browse files
authored
Remove unneeded DocumentPtr from MDL ShaderGen (AcademySoftwareFoundation#2518)
Remove unneeded ConstDocumentPtr being passed around inside the MDL shader generator. While poking around with some Shader Generator refactor experiments I noticed this argument not being used anywhere.
1 parent 936e4bb commit 7581aa5

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

source/MaterialXGenMdl/MdlShaderGenerator.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ ShaderPtr MdlShaderGenerator::generate(const string& name, ElementPtr element, G
193193
emitScopeBegin(stage, Syntax::PARENTHESES);
194194

195195
// Emit shader inputs
196-
emitShaderInputs(element->getDocument(), stage.getInputBlock(MDL::INPUTS), stage);
196+
emitShaderInputs(stage.getInputBlock(MDL::INPUTS), stage);
197197

198198
// End shader signature
199199
emitScopeEnd(stage);
@@ -691,7 +691,7 @@ ShaderPtr MdlShaderGenerator::createShader(const string& name, ElementPtr elemen
691691
namespace
692692
{
693693

694-
void emitInputAnnotations(const MdlShaderGenerator& _this, ConstDocumentPtr, const ShaderPort* variable, ShaderStage& stage)
694+
void emitInputAnnotations(const MdlShaderGenerator& _this, const ShaderPort* variable, ShaderStage& stage)
695695
{
696696
// allows to relate between MaterialX and MDL parameters when looking at the MDL code.
697697
const std::string mtlxParameterPathAnno = "materialx::core::origin(\"" + variable->getPath() + "\")";
@@ -705,7 +705,7 @@ void emitInputAnnotations(const MdlShaderGenerator& _this, ConstDocumentPtr, con
705705

706706
} // anonymous namespace
707707

708-
void MdlShaderGenerator::emitShaderInputs(ConstDocumentPtr doc, const VariableBlock& inputs, ShaderStage& stage) const
708+
void MdlShaderGenerator::emitShaderInputs(const VariableBlock& inputs, ShaderStage& stage) const
709709
{
710710
const string uniformPrefix = _syntax->getUniformQualifier() + " ";
711711
for (size_t i = 0; i < inputs.size(); ++i)
@@ -732,7 +732,7 @@ void MdlShaderGenerator::emitShaderInputs(ConstDocumentPtr doc, const VariableBl
732732

733733
emitLineBegin(stage);
734734
emitString(qualifier + type + " " + input->getVariable() + " = " + value, stage);
735-
emitInputAnnotations(*this, doc, input, stage);
735+
emitInputAnnotations(*this, input, stage);
736736

737737
if (i < inputs.size() - 1)
738738
{

source/MaterialXGenMdl/MdlShaderGenerator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ class MX_GENMDL_API MdlShaderGenerator : public ShaderGenerator
108108
ShaderPtr createShader(const string& name, ElementPtr element, GenContext& context) const;
109109

110110
// Emit a block of shader inputs.
111-
void emitShaderInputs(ConstDocumentPtr doc, const VariableBlock& inputs, ShaderStage& stage) const;
111+
void emitShaderInputs(const VariableBlock& inputs, ShaderStage& stage) const;
112112
};
113113

114114
namespace MDL

0 commit comments

Comments
 (0)