Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LOOKDEVX-2640 - Fix compilation error when using geomcolor nodes #3942

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions lib/mayaUsd/render/MaterialXGenOgsXml/GlslFragmentGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,27 @@ void fixupVertexDataInstance(ShaderStage& stage)
= "[$]" + d(HW::T_VERTEX_DATA_INSTANCE) + "[.][$](" + d(HW::T_TEXCOORD) + "_[0-9]+)";
static const std::regex vdCleanTexRegex(vdCleanTexSource.c_str());

// Find keywords: (as text)
//
// HW::T_VERTEX_DATA_INSTANCE.(T_COLOR_INDEX) $vd.$color_0;
//
// And replace with:
//
// (T_COLOR_INDEX) color_0;
//

static const std::string vdCleanColorSource
= "[$]" + d(HW::T_VERTEX_DATA_INSTANCE) + "[.][$](" + d(HW::T_COLOR) + "_[0-9]+)";
static const std::regex vdCleanColorRegex(vdCleanColorSource.c_str());

std::string code = stage.getSourceCode();
code = std::regex_replace(code, paramRegex, "vec3 unused_$1");
code = std::regex_replace(code, vtxRegex, "$$$1( PIX_IN.$$$1 )");
code = std::regex_replace(code, primvarParamRegex, "vec$1 unused_$2");
code = std::regex_replace(code, texcoordParamRegex, "vec$1 unused_$2");
code = std::regex_replace(code, vdCleanGeoRegex, "PIX_IN.$1");
code = std::regex_replace(code, vdCleanTexRegex, "PIX_IN.$1");
code = std::regex_replace(code, vdCleanColorRegex, "$1");

#if MX_COMBINED_VERSION >= 13804
stage.setSourceCode(code);
Expand Down
2 changes: 1 addition & 1 deletion lib/mayaUsd/render/MaterialXGenOgsXml/OgsXmlGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ static const std::unordered_map<string, const pugi::char_t*> OGS_SEMANTICS_MAP =

static const vector<std::pair<string, const pugi::char_t*>> OGS_SEMANTICS_PREFIX_MAP
= { { "texcoord_", "mayaUvCoordSemantic" },
{ "color_", "colorset" },
{ "color_", "fcolor" },
{ "i_geomprop_", "mayaUvCoordSemantic" } };

namespace OgsParameterFlags {
Expand Down