Skip to content

Commit 63f35ca

Browse files
authored
Merge pull request #3942 from Autodesk/gamaj/LOOKDEVX-2640/fix_geomcolor_compilation_error
LOOKDEVX-2640 - Fix compilation error when using geomcolor nodes
2 parents 484e5f8 + 51e51cc commit 63f35ca

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

lib/mayaUsd/render/MaterialXGenOgsXml/GlslFragmentGenerator.cpp

+14
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,27 @@ void fixupVertexDataInstance(ShaderStage& stage)
114114
= "[$]" + d(HW::T_VERTEX_DATA_INSTANCE) + "[.][$](" + d(HW::T_TEXCOORD) + "_[0-9]+)";
115115
static const std::regex vdCleanTexRegex(vdCleanTexSource.c_str());
116116

117+
// Find keywords: (as text)
118+
//
119+
// HW::T_VERTEX_DATA_INSTANCE.(T_COLOR_INDEX) $vd.$color_0;
120+
//
121+
// And replace with:
122+
//
123+
// (T_COLOR_INDEX) color_0;
124+
//
125+
126+
static const std::string vdCleanColorSource
127+
= "[$]" + d(HW::T_VERTEX_DATA_INSTANCE) + "[.][$](" + d(HW::T_COLOR) + "_[0-9]+)";
128+
static const std::regex vdCleanColorRegex(vdCleanColorSource.c_str());
129+
117130
std::string code = stage.getSourceCode();
118131
code = std::regex_replace(code, paramRegex, "vec3 unused_$1");
119132
code = std::regex_replace(code, vtxRegex, "$$$1( PIX_IN.$$$1 )");
120133
code = std::regex_replace(code, primvarParamRegex, "vec$1 unused_$2");
121134
code = std::regex_replace(code, texcoordParamRegex, "vec$1 unused_$2");
122135
code = std::regex_replace(code, vdCleanGeoRegex, "PIX_IN.$1");
123136
code = std::regex_replace(code, vdCleanTexRegex, "PIX_IN.$1");
137+
code = std::regex_replace(code, vdCleanColorRegex, "$1");
124138

125139
#if MX_COMBINED_VERSION >= 13804
126140
stage.setSourceCode(code);

lib/mayaUsd/render/MaterialXGenOgsXml/OgsXmlGenerator.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ static const std::unordered_map<string, const pugi::char_t*> OGS_SEMANTICS_MAP =
7777

7878
static const vector<std::pair<string, const pugi::char_t*>> OGS_SEMANTICS_PREFIX_MAP
7979
= { { "texcoord_", "mayaUvCoordSemantic" },
80-
{ "color_", "colorset" },
80+
{ "color_", "fcolor" },
8181
{ "i_geomprop_", "mayaUvCoordSemantic" } };
8282

8383
namespace OgsParameterFlags {

0 commit comments

Comments
 (0)