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

HYDRA-973 - set HDST_RENDER_SELECTED_EDGE_FROM_FACE as 0 by default #171

Merged
merged 2 commits into from
Sep 26, 2024
Merged
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
23 changes: 15 additions & 8 deletions lib/mayaHydra/mayaPlugin/plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,16 @@
std::vector<PXR_NS::MtohRenderOverride*> _renderOverrides;

std::vector<MCallbackId> _pluginLoadingCallbackIds;

void setEnvVar(const char* envVarSet)
{
// putenv requires char* and I'm not willing to use const cast!
const auto envVarSize = strlen(envVarSet) + 1;

Check notice on line 76 in lib/mayaHydra/mayaPlugin/plugin.cpp

View check run for this annotation

Autodesk Chorus / security/flawfinder

strlen

Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). secure coding id: CCPP-LANG-20, CCPP-STRG-30.
std::vector<char> envVarData;
envVarData.resize(envVarSize);
snprintf(envVarData.data(), envVarSize, "%s", envVarSet);
putenv(envVarData.data());
}
}

void initialize()
Expand Down Expand Up @@ -133,14 +143,11 @@
return ret;
}

// For now this is required for the HdSt backed to use lights.
// putenv requires char* and I'm not willing to use const cast!
constexpr const char* envVarSet = "USDIMAGING_ENABLE_SCENE_LIGHTS=1";
const auto envVarSize = strlen(envVarSet) + 1;
std::vector<char> envVarData;
envVarData.resize(envVarSize);
snprintf(envVarData.data(), envVarSize, "%s", envVarSet);
putenv(envVarData.data());
// For now this is required for the HdSt backend to use lights.
setEnvVar("USDIMAGING_ENABLE_SCENE_LIGHTS=1");

// Performance optimization: disable RENDER_SELECTED_EDGE_FROM_FACE feature that could trigger unnecessary running of gometry shader.
setEnvVar("HDST_RENDER_SELECTED_EDGE_FROM_FACE=0");

MFnPlugin plugin(obj, "Autodesk", PLUGIN_VERSION, "Any");

Expand Down
Loading