diff --git a/source/MaterialXGenGlsl/Nodes/ViewDirectionNodeGlsl.cpp b/source/MaterialXGenGlsl/Nodes/ViewDirectionNodeGlsl.cpp index 198465c9af..f9714b5d33 100644 --- a/source/MaterialXGenGlsl/Nodes/ViewDirectionNodeGlsl.cpp +++ b/source/MaterialXGenGlsl/Nodes/ViewDirectionNodeGlsl.cpp @@ -26,12 +26,12 @@ void ViewDirectionNodeGlsl::createVariables(const ShaderNode&, GenContext&, Shad void ViewDirectionNodeGlsl::emitFunctionCall(const ShaderNode& node, GenContext& context, ShaderStage& stage) const { - const ShaderGenerator& shadergen = context.getShaderGenerator(); + const GlslShaderGenerator& shadergen = static_cast(context.getShaderGenerator()); DEFINE_SHADER_STAGE(stage, Stage::VERTEX) { VariableBlock& vertexData = stage.getOutputBlock(HW::VERTEX_DATA); - const string prefix = vertexData.getInstance() + "."; + const string prefix = shadergen.getVertexDataPrefix(vertexData); ShaderPort* position = vertexData[HW::T_POSITION_WORLD]; if (!position->isEmitted()) { @@ -43,7 +43,7 @@ void ViewDirectionNodeGlsl::emitFunctionCall(const ShaderNode& node, GenContext& DEFINE_SHADER_STAGE(stage, Stage::PIXEL) { VariableBlock& vertexData = stage.getInputBlock(HW::VERTEX_DATA); - const string prefix = vertexData.getInstance() + "."; + const string prefix = shadergen.getVertexDataPrefix(vertexData); ShaderPort* position = vertexData[HW::T_POSITION_WORLD]; shadergen.emitLineBegin(stage); shadergen.emitOutput(node.getOutput(), true, false, context, stage); diff --git a/source/MaterialXGenMsl/Nodes/ViewDirectionNodeMsl.cpp b/source/MaterialXGenMsl/Nodes/ViewDirectionNodeMsl.cpp index 84a6b02b4f..1443b5c320 100644 --- a/source/MaterialXGenMsl/Nodes/ViewDirectionNodeMsl.cpp +++ b/source/MaterialXGenMsl/Nodes/ViewDirectionNodeMsl.cpp @@ -26,12 +26,12 @@ void ViewDirectionNodeMsl::createVariables(const ShaderNode&, GenContext&, Shade void ViewDirectionNodeMsl::emitFunctionCall(const ShaderNode& node, GenContext& context, ShaderStage& stage) const { - const ShaderGenerator& shadergen = context.getShaderGenerator(); + const MslShaderGenerator& shadergen = static_cast(context.getShaderGenerator()); DEFINE_SHADER_STAGE(stage, Stage::VERTEX) { VariableBlock& vertexData = stage.getOutputBlock(HW::VERTEX_DATA); - const string prefix = vertexData.getInstance() + "."; + const string prefix = shadergen.getVertexDataPrefix(vertexData); ShaderPort* position = vertexData[HW::T_POSITION_WORLD]; if (!position->isEmitted()) { @@ -43,7 +43,7 @@ void ViewDirectionNodeMsl::emitFunctionCall(const ShaderNode& node, GenContext& DEFINE_SHADER_STAGE(stage, Stage::PIXEL) { VariableBlock& vertexData = stage.getInputBlock(HW::VERTEX_DATA); - const string prefix = vertexData.getInstance() + "."; + const string prefix = shadergen.getVertexDataPrefix(vertexData); ShaderPort* position = vertexData[HW::T_POSITION_WORLD]; shadergen.emitLineBegin(stage); shadergen.emitOutput(node.getOutput(), true, false, context, stage);