Skip to content

Commit

Permalink
Remove operators 'add' and 'multiply' for shader types (AcademySoftwa…
Browse files Browse the repository at this point in the history
…reFoundation#1089)

This change list removes the `add` and `multiply` operator nodes for shader semantic types, as agreed on at the last TSC meeting.
  • Loading branch information
niklasharrysson authored Sep 30, 2022
1 parent da83252 commit 7b0405d
Show file tree
Hide file tree
Showing 13 changed files with 4 additions and 190 deletions.
5 changes: 0 additions & 5 deletions libraries/stdlib/genglsl/mx_add_surfaceshader.glsl

This file was deleted.

This file was deleted.

5 changes: 0 additions & 5 deletions libraries/stdlib/genglsl/mx_multiply_surfaceshader_float.glsl

This file was deleted.

3 changes: 0 additions & 3 deletions libraries/stdlib/genglsl/stdlib_genglsl_impl.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@
<implementation name="IM_add_matrix33FA_genglsl" nodedef="ND_add_matrix33FA" file="mx_add.inline" target="genglsl" />
<implementation name="IM_add_matrix44_genglsl" nodedef="ND_add_matrix44" file="mx_add.inline" target="genglsl" />
<implementation name="IM_add_matrix44FA_genglsl" nodedef="ND_add_matrix44FA" file="mx_add.inline" target="genglsl" />
<implementation name="IM_add_surfaceshader_genglsl" nodedef="ND_add_surfaceshader" function="mx_add_surfaceshader" file="mx_add_surfaceshader.glsl" target="genglsl" />

<!-- <subtract> -->
<implementation name="IM_subtract_float_genglsl" nodedef="ND_subtract_float" file="mx_subtract.inline" target="genglsl" />
Expand Down Expand Up @@ -255,8 +254,6 @@
<implementation name="IM_multiply_vector4FA_genglsl" nodedef="ND_multiply_vector4FA" file="mx_multiply.inline" target="genglsl" />
<implementation name="IM_multiply_matrix33_genglsl" nodedef="ND_multiply_matrix33" file="mx_multiply.inline" target="genglsl" />
<implementation name="IM_multiply_matrix44_genglsl" nodedef="ND_multiply_matrix44" file="mx_multiply.inline" target="genglsl" />
<implementation name="IM_multiply_surfaceshaderF_genglsl" nodedef="ND_multiply_surfaceshaderF" function="mx_multiply_surfaceshader_float" file="mx_multiply_surfaceshader_float.glsl" target="genglsl" />
<implementation name="IM_multiply_surfaceshaderC_genglsl" nodedef="ND_multiply_surfaceshaderC" function="mx_multiply_surfaceshader_color3" file="mx_multiply_surfaceshader_color3.glsl" target="genglsl" />

<!-- <divide> -->
<implementation name="IM_divide_float_genglsl" nodedef="ND_divide_float" file="mx_divide.inline" target="genglsl" />
Expand Down
3 changes: 0 additions & 3 deletions libraries/stdlib/genmdl/stdlib_genmdl_impl.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@
<implementation name="IM_add_matrix33FA_genmdl" nodedef="ND_add_matrix33FA" sourcecode="{{in1}} + float3x3({{in2}})" target="genmdl" />
<implementation name="IM_add_matrix44_genmdl" nodedef="ND_add_matrix44" sourcecode="{{in1}} + {{in2}}" target="genmdl" />
<implementation name="IM_add_matrix44FA_genmdl" nodedef="ND_add_matrix44FA" sourcecode="{{in1}} + float4x4({{in2}})" target="genmdl" />
<implementation name="IM_add_surfaceshader_genmdl" nodedef="ND_add_surfaceshader" sourcecode="mx::stdlib::mx_add_surfaceshader({{in1}}, {{in2}})" target="genmdl" />

<!-- <subtract> -->
<implementation name="IM_subtract_float_genmdl" nodedef="ND_subtract_float" sourcecode="{{in1}} - {{in2}}" target="genmdl" />
Expand Down Expand Up @@ -257,8 +256,6 @@
<implementation name="IM_multiply_vector4FA_genmdl" nodedef="ND_multiply_vector4FA" sourcecode="{{in1}} * {{in2}}" target="genmdl" />
<implementation name="IM_multiply_matrix33_genmdl" nodedef="ND_multiply_matrix33" sourcecode="{{in1}} * {{in2}}" target="genmdl" />
<implementation name="IM_multiply_matrix44_genmdl" nodedef="ND_multiply_matrix44" sourcecode="{{in1}} * {{in2}}" target="genmdl" />
<implementation name="IM_multiply_surfaceshaderF_genmdl" nodedef="ND_multiply_surfaceshaderF" sourcecode="mx::stdlib::mx_multiply_surfaceshaderF({{in1}}, {{in2}})" target="genmdl" />
<implementation name="IM_multiply_surfaceshaderC_genmdl" nodedef="ND_multiply_surfaceshaderC" sourcecode="mx::stdlib::mx_multiply_surfaceshaderC({{in1}}, {{in2}})" target="genmdl" />

<!-- <divide> -->
<implementation name="IM_divide_float_genmdl" nodedef="ND_divide_float" sourcecode="{{in1}} / {{in2}}" target="genmdl" />
Expand Down
3 changes: 0 additions & 3 deletions libraries/stdlib/genosl/stdlib_genosl_impl.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@
<implementation name="IM_add_matrix33FA_genosl" nodedef="ND_add_matrix33FA" file="mx_add.inline" target="genosl" />
<implementation name="IM_add_matrix44_genosl" nodedef="ND_add_matrix44" file="mx_add.inline" target="genosl" />
<implementation name="IM_add_matrix44FA_genosl" nodedef="ND_add_matrix44FA" file="mx_add.inline" target="genosl" />
<implementation name="IM_add_surfaceshader_genosl" nodedef="ND_add_surfaceshader" file="mx_add.inline" target="genosl" />

<!-- <subtract> -->
<implementation name="IM_subtract_float_genosl" nodedef="ND_subtract_float" file="mx_subtract.inline" target="genosl" />
Expand Down Expand Up @@ -258,8 +257,6 @@
<implementation name="IM_multiply_vector4FA_genosl" nodedef="ND_multiply_vector4FA" file="mx_multiply.inline" target="genosl" />
<implementation name="IM_multiply_matrix33_genosl" nodedef="ND_multiply_matrix33" file="mx_multiply.inline" target="genosl" />
<implementation name="IM_multiply_matrix44_genosl" nodedef="ND_multiply_matrix44" file="mx_multiply.inline" target="genosl" />
<implementation name="IM_multiply_surfaceshaderF_genosl" nodedef="ND_multiply_surfaceshaderF" file="mx_multiply.inline" target="genosl" />
<implementation name="IM_multiply_surfaceshaderC_genosl" nodedef="ND_multiply_surfaceshaderC" file="mx_multiply.inline" target="genosl" />

<!-- <divide> -->
<implementation name="IM_divide_float_genosl" nodedef="ND_divide_float" file="mx_divide.inline" target="genosl" />
Expand Down
45 changes: 0 additions & 45 deletions libraries/stdlib/stdlib_defs.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -1185,21 +1185,6 @@
<input name="in2" type="matrix44" value="0.0,0.0,0.0,0.0, 0.0,0.0,0.0,0.0, 0.0,0.0,0.0,0.0, 0.0,0.0,0.0,0.0" />
<output name="out" type="matrix44" defaultinput="in1" />
</nodedef>
<nodedef name="ND_add_surfaceshader" node="add" nodegroup="math">
<input name="in1" type="surfaceshader" value="" />
<input name="in2" type="surfaceshader" value="" />
<output name="out" type="surfaceshader" defaultinput="in1" />
</nodedef>
<nodedef name="ND_add_displacementshader" node="add" nodegroup="math">
<input name="in1" type="displacementshader" value="" />
<input name="in2" type="displacementshader" value="" />
<output name="out" type="displacementshader" defaultinput="in1" />
</nodedef>
<nodedef name="ND_add_volumeshader" node="add" nodegroup="math">
<input name="in1" type="volumeshader" value="" />
<input name="in2" type="volumeshader" value="" />
<output name="out" type="volumeshader" defaultinput="in1" />
</nodedef>
<nodedef name="ND_add_color3FA" node="add" nodegroup="math">
<input name="in1" type="color3" value="0.0, 0.0, 0.0" />
<input name="in2" type="float" value="0.0" />
Expand Down Expand Up @@ -1386,36 +1371,6 @@
<input name="in2" type="float" value="1.0" />
<output name="out" type="vector4" defaultinput="in1" />
</nodedef>
<nodedef name="ND_multiply_surfaceshaderF" node="multiply" nodegroup="math">
<input name="in1" type="surfaceshader" value="" />
<input name="in2" type="float" value="1.0" />
<output name="out" type="surfaceshader" defaultinput="in1" />
</nodedef>
<nodedef name="ND_multiply_displacementshaderF" node="multiply" nodegroup="math">
<input name="in1" type="displacementshader" value="" />
<input name="in2" type="float" value="1.0" />
<output name="out" type="displacementshader" defaultinput="in1" />
</nodedef>
<nodedef name="ND_multiply_volumeshaderF" node="multiply" nodegroup="math">
<input name="in1" type="volumeshader" value="" />
<input name="in2" type="float" value="1.0" />
<output name="out" type="volumeshader" defaultinput="in1" />
</nodedef>
<nodedef name="ND_multiply_surfaceshaderC" node="multiply" nodegroup="math">
<input name="in1" type="surfaceshader" value="" />
<input name="in2" type="color3" value="1.0, 1.0, 1.0" />
<output name="out" type="surfaceshader" defaultinput="in1" />
</nodedef>
<nodedef name="ND_multiply_volumeshaderC" node="multiply" nodegroup="math">
<input name="in1" type="volumeshader" value="" />
<input name="in2" type="color3" value="1.0, 1.0, 1.0" />
<output name="out" type="volumeshader" defaultinput="in1" />
</nodedef>
<nodedef name="ND_multiply_displacementshaderV" node="multiply" nodegroup="math">
<input name="in1" type="displacementshader" value="" />
<input name="in2" type="vector3" value="1.0, 1.0, 1.0" />
<output name="out" type="displacementshader" defaultinput="in1" />
</nodedef>

<!--
Node: <divide>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
<?xml version="1.0"?>
<materialx version="1.38">
<nodegraph name="nodegraph1">
<add name="add_surface_shader" type="surfaceshader">
<input name="in1" type="surfaceshader" value="" nodename="multiply_surface_shaderFloat" />
<input name="in2" type="surfaceshader" value="" nodename="multiply_surface_shaderColor" />
</add>
<multiply name="multiply_surface_shaderFloat" type="surfaceshader">
<input name="in1" type="surfaceshader" value="" nodename="standard_surface1" />
<input name="in2" type="float" value="0.4000" />
</multiply>
<multiply name="multiply_surface_shaderColor" type="surfaceshader">
<input name="in1" type="surfaceshader" value="" nodename="mix_surface_shader" />
<input name="in2" type="color3" value="1.0000, 0.0, 0.0" />
</multiply>
<mix name="mix_surface_shader" type="surfaceshader">
<input name="fg" type="surfaceshader" value="" nodename="standard_surface1" />
<input name="bg" type="surfaceshader" value="" nodename="standard_surface2" />
Expand All @@ -24,6 +12,6 @@
<standard_surface name="standard_surface2" type="surfaceshader">
<input name="base_color" type="color3" value="0.1, 0.1, 0.85" />
</standard_surface>
<output name="out" type="surfaceshader" nodename="add_surface_shader" />
<output name="out" type="surfaceshader" nodename="mix_surface_shader" />
</nodegraph>
</materialx>
99 changes: 0 additions & 99 deletions source/MaterialXGenMdl/mdl/materialx/stdlib.mdl
Original file line number Diff line number Diff line change
Expand Up @@ -1322,105 +1322,6 @@ export float mx_time_float(
return ::state::animation_time();
}

export material mx_add_surfaceshader(
material mxp_in1,
material mxp_in2 [[ anno::unused() ]]
)
[[
anno::description("Node Group: math")
]]
= mxp_in1; // TODO

export material mx_add_displacementshader(
material mxp_in1,
material mxp_in2 [[ anno::unused() ]]
)
[[
anno::description("Node Group: math")
]]
= mxp_in1; // TODO

export material mx_add_volumeshader(
material mxp_in1,
material mxp_in2 [[ anno::unused() ]]
)
[[
anno::description("Node Group: math")
]]
= mxp_in1; // TODO

export material mx_multiply_surfaceshaderF(
material mxp_in1,
float mxp_in2 = float(1.0)
[[
anno::unused()
]]
)
[[
anno::description("Node Group: math")
]]
= mxp_in1; // TODO

export material mx_multiply_displacementshaderF(
material mxp_in1,
float mxp_in2 = float(1.0)
[[
anno::unused()
]]
)
[[
anno::description("Node Group: math")
]]
= mxp_in1; // TODO

export material mx_multiply_volumeshaderF(
material mxp_in1,
float mxp_in2 = float(1.0)
[[
anno::unused()
]]
)
[[
anno::description("Node Group: math")
]]
= mxp_in1; // TODO

export material mx_multiply_surfaceshaderC(
material mxp_in1,
color mxp_in2 = color(1.0, 1.0, 1.0)
[[
anno::unused()
]]
)
[[
anno::description("Node Group: math")
]]
= mxp_in1; // TODO

export material mx_multiply_volumeshaderC(
material mxp_in1,
color mxp_in2 = color(1.0, 1.0, 1.0)
[[
anno::unused()
]]
)
[[
anno::description("Node Group: math")
]]
= mxp_in1; // TODO

export material mx_multiply_displacementshaderV(
material mxp_in1,
float3 mxp_in2 = float3(1.0, 1.0, 1.0)
[[
anno::unused()
]]
)
[[
anno::description("Node Group: math")
]]
= mxp_in1; // TODO

export color mx_modulo_color3(
color mxp_in1 = color(0.0, 0.0, 0.0),
color mxp_in2 = color(1.0, 1.0, 1.0)
Expand Down
2 changes: 1 addition & 1 deletion source/MaterialXTest/MaterialXGenGlsl/GenGlsl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ TEST_CASE("GenShader: GLSL Implementation Check", "[genglsl]")

mx::StringSet generatorSkipNodeTypes;
mx::StringSet generatorSkipNodeDefs;
GenShaderUtil::checkImplementations(context, generatorSkipNodeTypes, generatorSkipNodeDefs, 54);
GenShaderUtil::checkImplementations(context, generatorSkipNodeTypes, generatorSkipNodeDefs, 48);
}

TEST_CASE("GenShader: GLSL Unique Names", "[genglsl]")
Expand Down
2 changes: 1 addition & 1 deletion source/MaterialXTest/MaterialXGenMdl/GenMdl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ TEST_CASE("GenShader: MDL Implementation Check", "[genmdl]")
generatorSkipNodeTypes.insert("light");
mx::StringSet generatorSkipNodeDefs;

GenShaderUtil::checkImplementations(context, generatorSkipNodeTypes, generatorSkipNodeDefs, 55);
GenShaderUtil::checkImplementations(context, generatorSkipNodeTypes, generatorSkipNodeDefs, 49);
}

void MdlShaderGeneratorTester::compileSource(const std::vector<mx::FilePath>& sourceCodePaths)
Expand Down
2 changes: 1 addition & 1 deletion source/MaterialXTest/MaterialXGenOsl/GenOsl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ TEST_CASE("GenShader: OSL Implementation Check", "[genosl]")
generatorSkipNodeTypes.insert("light");
mx::StringSet generatorSkipNodeDefs;

GenShaderUtil::checkImplementations(context, generatorSkipNodeTypes, generatorSkipNodeDefs, 55);
GenShaderUtil::checkImplementations(context, generatorSkipNodeTypes, generatorSkipNodeDefs, 49);
}

TEST_CASE("GenShader: OSL Unique Names", "[genosl]")
Expand Down
6 changes: 0 additions & 6 deletions source/MaterialXTest/MaterialXGenShader/GenShaderUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,7 @@ void checkImplementations(mx::GenContext& context,
// Explicit set of node defs to skip temporarily
mx::StringSet skipNodeDefs =
{
"ND_add_displacementshader",
"ND_add_volumeshader",
"ND_add_vdf",
"ND_multiply_displacementshaderF",
"ND_multiply_displacementshaderV",
"ND_multiply_volumeshaderF",
"ND_multiply_volumeshaderC",
"ND_multiply_vdfF",
"ND_multiply_vdfC",
"ND_mix_displacementshader",
Expand Down

0 comments on commit 7b0405d

Please sign in to comment.