diff --git a/resources/Materials/TestSuite/stdlib/organization/organization.mtlx b/resources/Materials/TestSuite/stdlib/organization/organization.mtlx
index 21154aecdd..0f4c024848 100644
--- a/resources/Materials/TestSuite/stdlib/organization/organization.mtlx
+++ b/resources/Materials/TestSuite/stdlib/organization/organization.mtlx
@@ -90,4 +90,14 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/source/MaterialXGenShader/ShaderGraph.cpp b/source/MaterialXGenShader/ShaderGraph.cpp
index 8a424f8bf5..8482659b34 100644
--- a/source/MaterialXGenShader/ShaderGraph.cpp
+++ b/source/MaterialXGenShader/ShaderGraph.cpp
@@ -1027,48 +1027,16 @@ void ShaderGraph::optimize(GenContext& context)
}
else if (node->hasClassification(ShaderNode::Classification::DOT))
{
- // Dot nodes without modifiers can be elided by moving their connection downstream.
+ // Filename dot nodes must be elided so they do not create extra samplers.
ShaderInput* in = node->getInput("in");
- if (in->getChannels().empty())
+ if (in->getChannels().empty() && in->getType() == Type::FILENAME)
{
bypass(context, node, 0);
++numEdits;
}
}
- else if (node->hasClassification(ShaderNode::Classification::IFELSE))
- {
- // Check if we have a constant conditional expression
- ShaderInput* intest = node->getInput("intest");
- if (!intest->getConnection())
- {
- // Find which branch should be taken
- ShaderInput* cutoff = node->getInput("cutoff");
- ValuePtr value = intest->getValue();
- const float intestValue = value ? value->asA() : 0.0f;
- const int branch = (intestValue <= cutoff->getValue()->asA() ? 2 : 3);
-
- // Bypass the conditional using the taken branch
- bypass(context, node, branch);
-
- ++numEdits;
- }
- }
- else if (node->hasClassification(ShaderNode::Classification::SWITCH))
- {
- // Check if we have a constant conditional expression
- const ShaderInput* which = node->getInput("which");
- if (!which->getConnection())
- {
- // Find which branch should be taken
- ValuePtr value = which->getValue();
- const int branch = int(value == nullptr ? 0 : (which->getType() == Type::FLOAT ? value->asA() : value->asA()));
-
- // Bypass the conditional using the taken branch
- bypass(context, node, branch);
-
- ++numEdits;
- }
- }
+ // Adding more nodes here requires them to have an input that is tagged
+ // "uniform" in the NodeDef or to handle very specific cases, like FILENAME.
}
if (numEdits > 0)
diff --git a/source/MaterialXGenShader/ShaderNode.cpp b/source/MaterialXGenShader/ShaderNode.cpp
index 3eb750f1ff..04551cb6d2 100644
--- a/source/MaterialXGenShader/ShaderNode.cpp
+++ b/source/MaterialXGenShader/ShaderNode.cpp
@@ -135,8 +135,6 @@ const ShaderNodePtr ShaderNode::NONE = createEmptyNode();
const string ShaderNode::CONSTANT = "constant";
const string ShaderNode::DOT = "dot";
const string ShaderNode::IMAGE = "image";
-const string ShaderNode::COMPARE = "compare";
-const string ShaderNode::SWITCH = "switch";
const string ShaderNode::SURFACESHADER = "surfaceshader";
const string ShaderNode::SCATTER_MODE = "scatter_mode";
const string ShaderNode::BSDF_R = "R";
@@ -292,14 +290,6 @@ ShaderNodePtr ShaderNode::create(const ShaderGraph* parent, const string& name,
{
newNode->_classification = Classification::TEXTURE | Classification::DOT;
}
- else if (nodeDef.getNodeString() == COMPARE)
- {
- newNode->_classification = Classification::TEXTURE | Classification::CONDITIONAL | Classification::IFELSE;
- }
- else if (nodeDef.getNodeString() == SWITCH)
- {
- newNode->_classification = Classification::TEXTURE | Classification::CONDITIONAL | Classification::SWITCH;
- }
// Third, check for file texture classification by group name
else if (groupName == TEXTURE2D_GROUPNAME || groupName == TEXTURE3D_GROUPNAME)
{
diff --git a/source/MaterialXGenShader/ShaderNode.h b/source/MaterialXGenShader/ShaderNode.h
index 30e3ab6d59..536e0adc1e 100644
--- a/source/MaterialXGenShader/ShaderNode.h
+++ b/source/MaterialXGenShader/ShaderNode.h
@@ -350,14 +350,11 @@ class MX_GENSHADER_API ShaderNode
static const uint32_t VOLUME = 1 << 15; /// A volume shader node
static const uint32_t LIGHT = 1 << 16; /// A light shader node
static const uint32_t UNLIT = 1 << 17; /// An unlit surface shader node
- // Specific conditional types
- static const uint32_t IFELSE = 1 << 18; /// An if-else statement
- static const uint32_t SWITCH = 1 << 19; /// A switch statement
// Types based on nodegroup
- static const uint32_t SAMPLE2D = 1 << 20; /// Can be sampled in 2D (uv space)
- static const uint32_t SAMPLE3D = 1 << 21; /// Can be sampled in 3D (position)
- static const uint32_t GEOMETRIC = 1 << 22; /// Geometric input
- static const uint32_t DOT = 1 << 23; /// A dot node
+ static const uint32_t SAMPLE2D = 1 << 18; /// Can be sampled in 2D (uv space)
+ static const uint32_t SAMPLE3D = 1 << 19; /// Can be sampled in 3D (position)
+ static const uint32_t GEOMETRIC = 1 << 20; /// Geometric input
+ static const uint32_t DOT = 1 << 21; /// A dot node
};
static const ShaderNodePtr NONE;
@@ -365,8 +362,6 @@ class MX_GENSHADER_API ShaderNode
static const string CONSTANT;
static const string DOT;
static const string IMAGE;
- static const string COMPARE;
- static const string SWITCH;
static const string SURFACESHADER;
static const string SCATTER_MODE;
static const string BSDF_R;