Skip to content

Commit 8883de1

Browse files
authored
Merge pull request #4016 from Autodesk/gamaj/MAYA-136105/optimize_materialx_via_lobe_pruning
Lobe pruning shader optimization
2 parents 652667a + d0cb327 commit 8883de1

File tree

12 files changed

+1093
-4
lines changed

12 files changed

+1093
-4
lines changed

lib/mayaUsd/render/MaterialXGenOgsXml/CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ target_sources(${PROJECT_NAME}
88
OgsFragment.cpp
99
OgsXmlGenerator.cpp
1010
ShaderGenUtil.cpp
11+
LobePruner.cpp
1112
Nodes/SurfaceNodeMaya.cpp
1213
Nodes/TexcoordNodeMaya.cpp
14+
Nodes/MayaDarkClosureNode.cpp
1315
PugiXML/pugixml.cpp
1416
)
1517

@@ -55,6 +57,7 @@ set(HEADERS
5557
OgsFragment.h
5658
OgsXmlGenerator.h
5759
ShaderGenUtil.h
60+
LobePruner.h
5861
)
5962

6063
# -----------------------------------------------------------------------------

lib/mayaUsd/render/MaterialXGenOgsXml/GlslFragmentGenerator.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
#include "GlslFragmentGenerator.h"
77

8+
#include "Nodes/MayaDarkClosureNode.h"
89
#include "Nodes/MayaShaderGraph.h"
910
#include "Nodes/SurfaceNodeMaya.h"
1011
#include "Nodes/TexcoordNodeMaya.h"
@@ -24,6 +25,7 @@
2425

2526
#include <mayaUsd/render/MaterialXGenOgsXml/CombinedMaterialXVersion.h>
2627
#include <mayaUsd/render/MaterialXGenOgsXml/GlslOcioNodeImpl.h>
28+
#include <mayaUsd/render/MaterialXGenOgsXml/LobePruner.h>
2729
#include <mayaUsd/render/MaterialXGenOgsXml/OgsXmlGenerator.h>
2830

2931
#include <MaterialXGenGlsl/GlslShaderGenerator.h>
@@ -208,6 +210,13 @@ GlslFragmentGenerator::GlslFragmentGenerator()
208210
"IM_texcoord_vector3_" + GlslShaderGenerator::TARGET, TexcoordNodeGlslMaya::create);
209211
}
210212

213+
registerImplementation(
214+
MaterialXMaya::ShaderGenUtil::LobePruner::getDarkBaseImplementationName(),
215+
MayaDarkClosureNode::create);
216+
registerImplementation(
217+
MaterialXMaya::ShaderGenUtil::LobePruner::getDarkLayerImplementationName(),
218+
MayaDarkClosureNode::create);
219+
211220
// The MaterialX transform node will crash if one of the "space" inputs is empty. This will be
212221
// fixed in 1.38.9. In the meantime we use patched nodes to replace those previously added in
213222
// the base class.

0 commit comments

Comments
 (0)