Skip to content

Commit

Permalink
Remove Combine C++ node (AcademySoftwareFoundation#1855)
Browse files Browse the repository at this point in the history
Replace with direct source code implementation for `combine2`, `combine3` and `combine4`.
  • Loading branch information
ld-kerley authored Jun 3, 2024
1 parent 8c515e8 commit e613fc7
Show file tree
Hide file tree
Showing 12 changed files with 42 additions and 371 deletions.
22 changes: 13 additions & 9 deletions libraries/stdlib/genglsl/stdlib_genglsl_impl.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -704,15 +704,19 @@
<implementation name="IM_convert_boolean_float_genglsl" nodedef="ND_convert_boolean_float" target="genglsl" sourcecode="float({{in}})" />
<implementation name="IM_convert_integer_float_genglsl" nodedef="ND_convert_integer_float" target="genglsl" sourcecode="float({{in}})" />

<!-- <combine> -->
<implementation name="IM_combine2_vector2_genglsl" nodedef="ND_combine2_vector2" target="genglsl" />
<implementation name="IM_combine2_color4CF_genglsl" nodedef="ND_combine2_color4CF" target="genglsl" />
<implementation name="IM_combine2_vector4VF_genglsl" nodedef="ND_combine2_vector4VF" target="genglsl" />
<implementation name="IM_combine2_vector4VV_genglsl" nodedef="ND_combine2_vector4VV" target="genglsl" />
<implementation name="IM_combine3_color3_genglsl" nodedef="ND_combine3_color3" target="genglsl" />
<implementation name="IM_combine3_vector3_genglsl" nodedef="ND_combine3_vector3" target="genglsl" />
<implementation name="IM_combine4_color4_genglsl" nodedef="ND_combine4_color4" target="genglsl" />
<implementation name="IM_combine4_vector4_genglsl" nodedef="ND_combine4_vector4" target="genglsl" />
<!-- <combine2> -->
<implementation name="IM_combine2_vector2_genglsl" nodedef="ND_combine2_vector2" target="genglsl" sourcecode="vec2({{in1}},{{in2}})"/>
<implementation name="IM_combine2_color4CF_genglsl" nodedef="ND_combine2_color4CF" target="genglsl" sourcecode="vec4({{in1}}[0],{{in1}}[1],{{in1}}[2],{{in2}})"/>
<implementation name="IM_combine2_vector4VF_genglsl" nodedef="ND_combine2_vector4VF" target="genglsl" sourcecode="vec4({{in1}}[0],{{in1}}[1],{{in1}}[2],{{in2}})"/>
<implementation name="IM_combine2_vector4VV_genglsl" nodedef="ND_combine2_vector4VV" target="genglsl" sourcecode="vec4({{in1}}[0],{{in1}}[1],{{in2}}[0],{{in2}}[1])"/>

<!-- <combine3> -->
<implementation name="IM_combine3_color3_genglsl" nodedef="ND_combine3_color3" target="genglsl" sourcecode="vec3({{in1}},{{in2}},{{in3}})"/>
<implementation name="IM_combine3_vector3_genglsl" nodedef="ND_combine3_vector3" target="genglsl" sourcecode="vec3({{in1}},{{in2}},{{in3}})"/>

<!-- <combine4> -->
<implementation name="IM_combine4_color4_genglsl" nodedef="ND_combine4_color4" target="genglsl" sourcecode="vec4({{in1}},{{in2}},{{in3}},{{in4}})"/>
<implementation name="IM_combine4_vector4_genglsl" nodedef="ND_combine4_vector4" target="genglsl" sourcecode="vec4({{in1}},{{in2}},{{in3}},{{in4}})"/>

<!-- <creatematrix> -->
<implementation name="IM_creatematrix_vector3_matrix33_genglsl" nodedef="ND_creatematrix_vector3_matrix33" file="mx_creatematrix_vector3_matrix33.glsl" function="mx_creatematrix_vector3_matrix33" target="genglsl" />
Expand Down
16 changes: 8 additions & 8 deletions libraries/stdlib/genmdl/stdlib_genmdl_impl.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -713,18 +713,18 @@
<implementation name="IM_convert_integer_float_genmdl" nodedef="ND_convert_integer_float" target="genmdl" sourcecode="float({{in}})" />

<!-- <combine2> -->
<implementation name="IM_combine2_vector2_genmdl" nodedef="ND_combine2_vector2" target="genmdl" />
<implementation name="IM_combine2_color4CF_genmdl" nodedef="ND_combine2_color4CF" target="genmdl" />
<implementation name="IM_combine2_vector4VF_genmdl" nodedef="ND_combine2_vector4VF" target="genmdl" />
<implementation name="IM_combine2_vector4VV_genmdl" nodedef="ND_combine2_vector4VV" target="genmdl" />
<implementation name="IM_combine2_vector2_genmdl" nodedef="ND_combine2_vector2" target="genmdl" sourcecode="float2( {{in1}},{{in2}} )"/>
<implementation name="IM_combine2_color4CF_genmdl" nodedef="ND_combine2_color4CF" target="genmdl" sourcecode="color4( {{in1}}[0],{{in1}}[1],{{in1}}[2],{{in2}} )"/>
<implementation name="IM_combine2_vector4VF_genmdl" nodedef="ND_combine2_vector4VF" target="genmdl" sourcecode="float4( {{in1}}[0],{{in1}}[1],{{in1}}[2],{{in2}} )"/>
<implementation name="IM_combine2_vector4VV_genmdl" nodedef="ND_combine2_vector4VV" target="genmdl" sourcecode="float4( {{in1}}[0],{{in1}}[1],{{in2}}[0],{{in2}}[1] )"/>

<!-- <combine3> -->
<implementation name="IM_combine3_color3_genmdl" nodedef="ND_combine3_color3" target="genmdl" />
<implementation name="IM_combine3_vector3_genmdl" nodedef="ND_combine3_vector3" target="genmdl" />
<implementation name="IM_combine3_color3_genmdl" nodedef="ND_combine3_color3" target="genmdl" sourcecode="color( {{in1}},{{in2}},{{in3}} )"/>
<implementation name="IM_combine3_vector3_genmdl" nodedef="ND_combine3_vector3" target="genmdl" sourcecode="float3( {{in1}},{{in2}},{{in3}} )"/>

<!-- <combine4> -->
<implementation name="IM_combine4_color4_genmdl" nodedef="ND_combine4_color4" target="genmdl" />
<implementation name="IM_combine4_vector4_genmdl" nodedef="ND_combine4_vector4" target="genmdl" />
<implementation name="IM_combine4_color4_genmdl" nodedef="ND_combine4_color4" target="genmdl" sourcecode="color4( {{in1}},{{in2}},{{in3}},{{in4}} )"/>
<implementation name="IM_combine4_vector4_genmdl" nodedef="ND_combine4_vector4" target="genmdl" sourcecode="float4( {{in1}},{{in2}},{{in3}},{{in4}} )"/>

<!-- <creatematrix> -->
<implementation name="IM_creatematrix_vector3_matrix33_genmdl" nodedef="ND_creatematrix_vector3_matrix33" sourcecode="materialx::stdlib_{{MDL_VERSION_SUFFIX}}::mx_creatematrix_vector3_matrix33({{in1}}, {{in2}}, {{in3}})" target="genmdl" />
Expand Down
22 changes: 13 additions & 9 deletions libraries/stdlib/genmsl/stdlib_genmsl_impl.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -704,15 +704,19 @@
<implementation name="IM_convert_boolean_float_genmsl" nodedef="ND_convert_boolean_float" target="genmsl" sourcecode="float({{in}})" />
<implementation name="IM_convert_integer_float_genmsl" nodedef="ND_convert_integer_float" target="genmsl" sourcecode="float({{in}})" />

<!-- <combine> -->
<implementation name="IM_combine2_vector2_genmsl" nodedef="ND_combine2_vector2" target="genmsl" />
<implementation name="IM_combine2_color4CF_genmsl" nodedef="ND_combine2_color4CF" target="genmsl" />
<implementation name="IM_combine2_vector4VF_genmsl" nodedef="ND_combine2_vector4VF" target="genmsl" />
<implementation name="IM_combine2_vector4VV_genmsl" nodedef="ND_combine2_vector4VV" target="genmsl" />
<implementation name="IM_combine3_color3_genmsl" nodedef="ND_combine3_color3" target="genmsl" />
<implementation name="IM_combine3_vector3_genmsl" nodedef="ND_combine3_vector3" target="genmsl" />
<implementation name="IM_combine4_color4_genmsl" nodedef="ND_combine4_color4" target="genmsl" />
<implementation name="IM_combine4_vector4_genmsl" nodedef="ND_combine4_vector4" target="genmsl" />
<!-- <combine2> -->
<implementation name="IM_combine2_vector2_genmsl" nodedef="ND_combine2_vector2" target="genmsl" sourcecode="{ {{in1}},{{in2}} }"/>
<implementation name="IM_combine2_color4CF_genmsl" nodedef="ND_combine2_color4CF" target="genmsl" sourcecode="{ {{in1}}[0],{{in1}}[1],{{in1}}[2],{{in2}} }"/>
<implementation name="IM_combine2_vector4VF_genmsl" nodedef="ND_combine2_vector4VF" target="genmsl" sourcecode="{ {{in1}}[0],{{in1}}[1],{{in1}}[2],{{in2}} }"/>
<implementation name="IM_combine2_vector4VV_genmsl" nodedef="ND_combine2_vector4VV" target="genmsl" sourcecode="{ {{in1}}[0],{{in1}}[1],{{in2}}[0],{{in2}}[1] }"/>

<!-- <combine3> -->
<implementation name="IM_combine3_color3_genmsl" nodedef="ND_combine3_color3" target="genmsl" sourcecode="{ {{in1}},{{in2}},{{in3}} }"/>
<implementation name="IM_combine3_vector3_genmsl" nodedef="ND_combine3_vector3" target="genmsl" sourcecode="{ {{in1}},{{in2}},{{in3}} }"/>

<!-- <combine4> -->
<implementation name="IM_combine4_color4_genmsl" nodedef="ND_combine4_color4" target="genmsl" sourcecode="{ {{in1}},{{in2}},{{in3}},{{in4}} }"/>
<implementation name="IM_combine4_vector4_genmsl" nodedef="ND_combine4_vector4" target="genmsl" sourcecode="{ {{in1}},{{in2}},{{in3}},{{in4}} }"/>

<!-- <creatematrix> -->
<implementation name="IM_creatematrix_vector3_matrix33_genmsl" nodedef="ND_creatematrix_vector3_matrix33" file="../genglsl/mx_creatematrix_vector3_matrix33.glsl" function="mx_creatematrix_vector3_matrix33" target="genmsl" />
Expand Down
16 changes: 8 additions & 8 deletions libraries/stdlib/genosl/stdlib_genosl_impl.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -704,18 +704,18 @@
<implementation name="IM_convert_integer_float_genosl" nodedef="ND_convert_integer_float" target="genosl" sourcecode="float({{in}})" />

<!-- <combine2> -->
<implementation name="IM_combine2_vector2_genosl" nodedef="ND_combine2_vector2" target="genosl" />
<implementation name="IM_combine2_color4CF_genosl" nodedef="ND_combine2_color4CF" target="genosl" />
<implementation name="IM_combine2_vector4VF_genosl" nodedef="ND_combine2_vector4VF" target="genosl" />
<implementation name="IM_combine2_vector4VV_genosl" nodedef="ND_combine2_vector4VV" target="genosl" />
<implementation name="IM_combine2_vector2_genosl" nodedef="ND_combine2_vector2" target="genosl" sourcecode="{ {{in1}},{{in2}} }"/>
<implementation name="IM_combine2_color4CF_genosl" nodedef="ND_combine2_color4CF" target="genosl" sourcecode="{ color({{in1}}[0],{{in1}}[1],{{in1}}[2]),{{in2}} }"/>
<implementation name="IM_combine2_vector4VF_genosl" nodedef="ND_combine2_vector4VF" target="genosl" sourcecode="{ {{in1}}[0],{{in1}}[1],{{in1}}[2],{{in2}} }"/>
<implementation name="IM_combine2_vector4VV_genosl" nodedef="ND_combine2_vector4VV" target="genosl" sourcecode="{ {{in1}}.x,{{in1}}.y,{{in2}}.x,{{in2}}.y }"/>

<!-- <combine3> -->
<implementation name="IM_combine3_color3_genosl" nodedef="ND_combine3_color3" target="genosl" />
<implementation name="IM_combine3_vector3_genosl" nodedef="ND_combine3_vector3" target="genosl" />
<implementation name="IM_combine3_color3_genosl" nodedef="ND_combine3_color3" target="genosl" sourcecode="color( {{in1}},{{in2}},{{in3}} )"/>
<implementation name="IM_combine3_vector3_genosl" nodedef="ND_combine3_vector3" target="genosl" sourcecode="vector( {{in1}},{{in2}},{{in3}} )"/>

<!-- <combine4> -->
<implementation name="IM_combine4_color4_genosl" nodedef="ND_combine4_color4" target="genosl" />
<implementation name="IM_combine4_vector4_genosl" nodedef="ND_combine4_vector4" target="genosl" />
<implementation name="IM_combine4_color4_genosl" nodedef="ND_combine4_color4" target="genosl" sourcecode="{ color({{in1}},{{in2}},{{in3}}),{{in4}} }"/>
<implementation name="IM_combine4_vector4_genosl" nodedef="ND_combine4_vector4" target="genosl" sourcecode="{ {{in1}},{{in2}},{{in3}},{{in4}} }"/>

<!-- <creatematrix> -->
<implementation name="IM_creatematrix_vector3_matrix33_genosl" nodedef="ND_creatematrix_vector3_matrix33" file="mx_creatematrix.osl" function="mx_creatematrix_vector3_matrix33" target="genosl" />
Expand Down
14 changes: 0 additions & 14 deletions source/MaterialXGenGlsl/GlslShaderGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include <MaterialXGenGlsl/Nodes/BlurNodeGlsl.h>

#include <MaterialXGenShader/Nodes/MaterialNode.h>
#include <MaterialXGenShader/Nodes/CombineNode.h>
#include <MaterialXGenShader/Nodes/SwitchNode.h>
#include <MaterialXGenShader/Nodes/HwImageNode.h>
#include <MaterialXGenShader/Nodes/HwTexCoordNode.h>
Expand Down Expand Up @@ -80,19 +79,6 @@ GlslShaderGenerator::GlslShaderGenerator() :
};
registerImplementation(elementNames, SwitchNode::create);

// <!-- <combine> -->
elementNames = {
"IM_combine2_vector2_" + GlslShaderGenerator::TARGET,
"IM_combine2_color4CF_" + GlslShaderGenerator::TARGET,
"IM_combine2_vector4VF_" + GlslShaderGenerator::TARGET,
"IM_combine2_vector4VV_" + GlslShaderGenerator::TARGET,
"IM_combine3_color3_" + GlslShaderGenerator::TARGET,
"IM_combine3_vector3_" + GlslShaderGenerator::TARGET,
"IM_combine4_color4_" + GlslShaderGenerator::TARGET,
"IM_combine4_vector4_" + GlslShaderGenerator::TARGET,
};
registerImplementation(elementNames, CombineNode::create);

// <!-- <position> -->
registerImplementation("IM_position_vector3_" + GlslShaderGenerator::TARGET, HwPositionNode::create);
// <!-- <normal> -->
Expand Down
11 changes: 0 additions & 11 deletions source/MaterialXGenMdl/MdlShaderGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include <MaterialXGenMdl/Nodes/SurfaceNodeMdl.h>
#include <MaterialXGenMdl/Nodes/HeightToNormalNodeMdl.h>
#include <MaterialXGenMdl/Nodes/BlurNodeMdl.h>
#include <MaterialXGenMdl/Nodes/CombineNodeMdl.h>
#include <MaterialXGenMdl/Nodes/ClosureLayerNodeMdl.h>
#include <MaterialXGenMdl/Nodes/ClosureCompoundNodeMdl.h>
#include <MaterialXGenMdl/Nodes/ClosureSourceCodeNodeMdl.h>
Expand Down Expand Up @@ -92,16 +91,6 @@ MdlShaderGenerator::MdlShaderGenerator() :
// <!-- <surface> -->
registerImplementation("IM_surface_" + MdlShaderGenerator::TARGET, SurfaceNodeMdl::create);

// <!-- <combine> -->
registerImplementation("IM_combine2_vector2_" + MdlShaderGenerator::TARGET, CombineNodeMdl::create);
registerImplementation("IM_combine2_color4CF_" + MdlShaderGenerator::TARGET, CombineNodeMdl::create);
registerImplementation("IM_combine2_vector4VF_" + MdlShaderGenerator::TARGET, CombineNodeMdl::create);
registerImplementation("IM_combine2_vector4VV_" + MdlShaderGenerator::TARGET, CombineNodeMdl::create);
registerImplementation("IM_combine3_color3_" + MdlShaderGenerator::TARGET, CombineNodeMdl::create);
registerImplementation("IM_combine3_vector3_" + MdlShaderGenerator::TARGET, CombineNodeMdl::create);
registerImplementation("IM_combine4_color4_" + MdlShaderGenerator::TARGET, CombineNodeMdl::create);
registerImplementation("IM_combine4_vector4_" + MdlShaderGenerator::TARGET, CombineNodeMdl::create);

// <!-- <blur> -->
registerImplementation("IM_blur_float_" + MdlShaderGenerator::TARGET, BlurNodeMdl::create);
registerImplementation("IM_blur_color3_" + MdlShaderGenerator::TARGET, BlurNodeMdl::create);
Expand Down
94 changes: 0 additions & 94 deletions source/MaterialXGenMdl/Nodes/CombineNodeMdl.cpp

This file was deleted.

26 changes: 0 additions & 26 deletions source/MaterialXGenMdl/Nodes/CombineNodeMdl.h

This file was deleted.

14 changes: 0 additions & 14 deletions source/MaterialXGenMsl/MslShaderGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include <MaterialXGenMsl/Nodes/BlurNodeMsl.h>

#include <MaterialXGenShader/Nodes/MaterialNode.h>
#include <MaterialXGenShader/Nodes/CombineNode.h>
#include <MaterialXGenShader/Nodes/SwitchNode.h>
#include <MaterialXGenShader/Nodes/HwImageNode.h>
#include <MaterialXGenShader/Nodes/HwTexCoordNode.h>
Expand Down Expand Up @@ -84,19 +83,6 @@ MslShaderGenerator::MslShaderGenerator() :
};
registerImplementation(elementNames, SwitchNode::create);

// <!-- <combine> -->
elementNames = {
"IM_combine2_vector2_" + MslShaderGenerator::TARGET,
"IM_combine2_color4CF_" + MslShaderGenerator::TARGET,
"IM_combine2_vector4VF_" + MslShaderGenerator::TARGET,
"IM_combine2_vector4VV_" + MslShaderGenerator::TARGET,
"IM_combine3_color3_" + MslShaderGenerator::TARGET,
"IM_combine3_vector3_" + MslShaderGenerator::TARGET,
"IM_combine4_color4_" + MslShaderGenerator::TARGET,
"IM_combine4_vector4_" + MslShaderGenerator::TARGET,
};
registerImplementation(elementNames, CombineNode::create);

// <!-- <position> -->
registerImplementation("IM_position_vector3_" + MslShaderGenerator::TARGET, HwPositionNode::create);
// <!-- <normal> -->
Expand Down
Loading

0 comments on commit e613fc7

Please sign in to comment.