Skip to content

Commit

Permalink
Merge pull request PixarAnimationStudios#186 from autodesk-forks/orig…
Browse files Browse the repository at this point in the history
…in_dev_update

Sync up with the latest origin dev
  • Loading branch information
francis-wangfr authored and GitHub Enterprise committed Dec 9, 2022
2 parents 6da6897 + 86ffd86 commit 5a08b86
Show file tree
Hide file tree
Showing 65 changed files with 3,976 additions and 350 deletions.
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
steps:
- script: |
# Update PATH to ensure that pyside2-uic can be found
export PATH=/Library/Frameworks/Python.framework/Versions/3.10/bin:$PATH
export PATH=/Library/Frameworks/Python.framework/Versions/3.11/bin:$PATH
sudo xcode-select -s /Applications/Xcode_13.2.app/Contents/Developer
# Set SYSTEM_VERSION_COMPAT while installing Python packages to
# accommodate the macOS version numbering change from 10.x to 11
Expand Down
15 changes: 15 additions & 0 deletions azure-pypi-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,21 @@ stages:
docker run --name usdmanylinux --rm -id -v $(Build.SourcesDirectory):/opt/USD -v /home/vsts/dist:/opt/USD-dist manylinuxwithcmake
displayName: 'Creating docker build environment'
- bash: |
# Terrible, terrible hack. The manylinux Docker image used to build the
# Python wheel does not include the corresponding Python shared library
# to link against. https://peps.python.org/pep-0513/#libpythonx-y-so-1
# describes why this is so. However, the FindPython CMake module used
# by USD's build system requires that the library exists and will error
# out otherwise, even though we explicitly avoid linking against Python
# via the PXR_PY_UNDEFINED_DYNAMIC_LOOKUP flag.
#
# To work around this, we create a dummy file for the library using
# the same logic as build_usd.py to determine where the library should
# exist (see GetPythonInfo). FindPython will see that the library exists
# and allow the build to continue. The file is 100% bogus, but the
# PXR_PY_UNDEFINED_DYNAMIC_LOOKUP flag will ensure that we never try to
# link against this library anyway, so it doesn't matter.
docker exec usdmanylinux $(PYTHON_INTERPRETER) -c "import pathlib,sysconfig; pathlib.Path(sysconfig.get_config_var('LIBDIR'), sysconfig.get_config_var('LDLIBRARY')).touch()"
docker exec usdmanylinux $(PYTHON_INTERPRETER) build_scripts/build_usd.py --build-args USD,"-DPXR_PY_UNDEFINED_DYNAMIC_LOOKUP=ON -DPXR_BUILD_USD_TOOLS=OFF -DPXR_INSTALL_LOCATION=../pxr/pluginfo" --no-imaging --no-examples --no-tutorials --build /opt/USD/gen/build --src /opt/USD/gen/src /opt/USD/inst -v
displayName: 'Building USD'
- bash: |
Expand Down
43 changes: 43 additions & 0 deletions docs/contributing_to_usd.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,49 @@ Once your CLA is signed, send it to `[email protected]
and wait for confirmation that we've received it. After that, you can submit
pull requests.

Supplemental Terms
******************

By and in consideration for using a Pixar site (e.g., Pixar's USD-proposals
site), providing Submissions to Pixar, or by clicking a box that states that
you accept or agree to these terms, you signify your agreement to these
Supplemental Terms.

You hereby grant to Pixar and our licensees, distributors, agents,
representatives and other authorized users, a perpetual, non-exclusive,
irrevocable, fully-paid, royalty-free, sub-licensable and transferable
(in whole or part) worldwide license under all copyrights, trademarks, patents,
trade secret rights, data rights, privacy and publicity rights and other
proprietary rights you or your affiliates now or hereafter own or control, to
reproduce, transmit, display, exhibit, distribute, index, comment on, perform,
create derivative works based upon, modify, make, use, sell, have made, import,
and otherwise exploit in any manner, the Submissions and any implementations of
the Submissions, in whole or in part, including in all media formats and
channels now known or hereafter devised, for any and all purposes, including
entertainment, research, news, advertising, promotional, marketing, publicity,
trade or commercial purposes, all without further notice to you, with or without
attribution, and without the requirement of any permission from or payment to
you or any other person or entity.

As used herein, Submissions shall mean any text, proposals, white papers,
specifications, messages, technologies, ideas, concepts, pitches, suggestions,
stories, screenplays, treatments, formats, artwork, photographs, drawings,
videos, audiovisual works, musical compositions (including lyrics), sound
recordings, characterizations, software code, algorithms, structures, your
and/or other persons' names, likenesses, voices, usernames, profiles, actions,
appearances, performances and/or other biographical information or material,
and/or other similar materials that you submit, post, upload, embed, display,
communicate or otherwise distribute to or for Pixar or a Pixar site.

These Supplemental Terms are in addition to any prior or contemporaneous
agreement (and shall remain in effect notwithstanding any future agreement)
that you may have with Pixar.

At any time, we may update these Supplemental Terms (including by modification,
deletion and/or addition of any portion thereof). Any update to these
Supplemental Terms will be effective thirty (30) calendar days following our
posting of the updated Supplemental Terms to a Pixar site.

Coding Conventions
******************

Expand Down
7 changes: 6 additions & 1 deletion pxr/imaging/hd/coordSys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,14 @@

PXR_NAMESPACE_OPEN_SCOPE

TF_DEFINE_PRIVATE_TOKENS(
_tokens,
(coordSys)
);

HdCoordSys::HdCoordSys(SdfPath const &id)
: HdSprim(id)
, _name(SdfPath::StripNamespace(id.GetName()))
, _name(SdfPath::StripPrefixNamespace(id.GetName(), _tokens->coordSys).first)
{
}

Expand Down
13 changes: 9 additions & 4 deletions pxr/imaging/hd/dataSourceLegacyPrim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ TF_DEFINE_PUBLIC_TOKENS(HdLegacyPrimTypeTokens, HD_LEGACY_PRIMTYPE_TOKENS);
// define this convention.
TF_DEFINE_PRIVATE_TOKENS(
_tokens,
(coordSys)
(prmanParams)
((prmanParamsNames, ""))

Expand Down Expand Up @@ -2986,9 +2987,12 @@ HdDataSourceLegacyPrim::_GetInstancedByDataSource()
if (instancerId.IsEmpty()) {
return nullptr;
}
return HdInstancedBySchema::BuildRetained(
HdRetainedTypedSampledDataSource<VtArray<SdfPath>>::New(
VtArray<SdfPath>({instancerId})));
return
HdInstancedBySchema::Builder()
.SetPaths(
HdRetainedTypedSampledDataSource<VtArray<SdfPath>>::New(
VtArray<SdfPath>({instancerId})))
.Build();
}

HdDataSourceBaseHandle
Expand Down Expand Up @@ -3051,7 +3055,8 @@ HdDataSourceLegacyPrim::_GetCoordSysBindingDataSource()
// form /path/to/object.coordSys:foo, where "foo" is the name the
// shader gets to access. We pull these names out to store in the
// schema.
names.push_back(TfToken(SdfPath::StripNamespace(path.GetName())));
names.push_back(TfToken(SdfPath::StripPrefixNamespace(
path.GetName(), _tokens->coordSys).first));
paths.push_back(HdRetainedTypedSampledDataSource<SdfPath>::New(
path));
}
Expand Down
30 changes: 26 additions & 4 deletions pxr/imaging/hd/instancedBySchema.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,34 @@ HdInstancedBySchema::GetPaths()
HdInstancedBySchemaTokens->paths);
}

HdPathArrayDataSourceHandle
HdInstancedBySchema::GetPrototypeRoots()
{
return _GetTypedDataSource<HdPathArrayDataSource>(
HdInstancedBySchemaTokens->prototypeRoots);
}

/*static*/
HdContainerDataSourceHandle
HdInstancedBySchema::BuildRetained(
const HdPathArrayDataSourceHandle &paths
const HdPathArrayDataSourceHandle &paths,
const HdPathArrayDataSourceHandle &prototypeRoots
)
{
TfToken names[1];
HdDataSourceBaseHandle values[1];
TfToken names[2];
HdDataSourceBaseHandle values[2];

size_t count = 0;
if (paths) {
names[count] = HdInstancedBySchemaTokens->paths;
values[count++] = paths;
}

if (prototypeRoots) {
names[count] = HdInstancedBySchemaTokens->prototypeRoots;
values[count++] = prototypeRoots;
}

return HdRetainedContainerDataSource::New(count, names, values);
}

Expand Down Expand Up @@ -92,11 +105,20 @@ HdInstancedBySchema::Builder::SetPaths(
return *this;
}

HdInstancedBySchema::Builder &
HdInstancedBySchema::Builder::SetPrototypeRoots(
const HdPathArrayDataSourceHandle &prototypeRoots)
{
_prototypeRoots = prototypeRoots;
return *this;
}

HdContainerDataSourceHandle
HdInstancedBySchema::Builder::Build()
{
return HdInstancedBySchema::BuildRetained(
_paths
_paths,
_prototypeRoots
);
}

Expand Down
10 changes: 9 additions & 1 deletion pxr/imaging/hd/instancedBySchema.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ PXR_NAMESPACE_OPEN_SCOPE
#define HDINSTANCEDBY_SCHEMA_TOKENS \
(instancedBy) \
(paths) \
(prototypeRoots) \

TF_DECLARE_PUBLIC_TOKENS(HdInstancedBySchemaTokens, HD_API,
HDINSTANCEDBY_SCHEMA_TOKENS);
Expand Down Expand Up @@ -75,6 +76,8 @@ class HdInstancedBySchema : public HdSchema

HD_API
HdPathArrayDataSourceHandle GetPaths();
HD_API
HdPathArrayDataSourceHandle GetPrototypeRoots();

// RETRIEVING AND CONSTRUCTING

Expand All @@ -86,7 +89,8 @@ class HdInstancedBySchema : public HdSchema
HD_API
static HdContainerDataSourceHandle
BuildRetained(
const HdPathArrayDataSourceHandle &paths
const HdPathArrayDataSourceHandle &paths,
const HdPathArrayDataSourceHandle &prototypeRoots
);

/// \class HdInstancedBySchema::Builder
Expand All @@ -101,13 +105,17 @@ class HdInstancedBySchema : public HdSchema
HD_API
Builder &SetPaths(
const HdPathArrayDataSourceHandle &paths);
HD_API
Builder &SetPrototypeRoots(
const HdPathArrayDataSourceHandle &prototypeRoots);

/// Returns a container data source containing the members set thus far.
HD_API
HdContainerDataSourceHandle Build();

private:
HdPathArrayDataSourceHandle _paths;
HdPathArrayDataSourceHandle _prototypeRoots;
};

/// Retrieves a container data source with the schema's default name token
Expand Down
2 changes: 1 addition & 1 deletion pxr/imaging/hd/renderIndex.h
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ class HdRenderIndex final
// ---------------------------------------------------------------------- //

// Go through all RPrims and reallocate their instance ids
// This is called once we have exhausted all all 24bit instance ids.
// This is called once we have exhausted all 24bit instance ids.
void _CompactPrimIds();

// Allocate the next available instance id to the prim
Expand Down
38 changes: 26 additions & 12 deletions pxr/imaging/hdGp/generativeProceduralResolvingSceneIndex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

#include "pxr/base/tf/denseHashSet.h"
#include "pxr/base/work/loops.h"
#include "pxr/base/work/withScopedParallelism.h"

PXR_NAMESPACE_OPEN_SCOPE

Expand Down Expand Up @@ -218,12 +219,17 @@ HdGpGenerativeProceduralResolvingSceneIndex::_PrimsAdded(
++i;
}

{
TF_PY_ALLOW_THREADS_IN_SCOPE();
WorkWithScopedParallelism([&]() {
WorkParallelForEach(cookEntries.begin(), cookEntries.end(),
[this](const _CookEntry &e) {
this->_UpdateProcedural(e.first, true, const_cast<
HdGpGenerativeProceduralResolvingSceneIndex::_Notices *>(
&e.second));
});
});
}

// combine all of the resulting notices following parallel cook
for (const _CookEntry &e : cookEntries) {
Expand Down Expand Up @@ -371,12 +377,17 @@ HdGpGenerativeProceduralResolvingSceneIndex::_PrimsRemoved(
++i;
}

{
TF_PY_ALLOW_THREADS_IN_SCOPE();
WorkWithScopedParallelism([&]() {
WorkParallelForEach(cookEntries.begin(), cookEntries.end(),
[this](const _CookEntry &e) {
this->_UpdateProcedural(e.first, true, const_cast<
HdGpGenerativeProceduralResolvingSceneIndex::_Notices *>(
&e.second));
});
});
}

// combine all of the resulting notices following parallel cook
for (const _CookEntry &e : cookEntries) {
Expand All @@ -390,9 +401,7 @@ HdGpGenerativeProceduralResolvingSceneIndex::_PrimsRemoved(

} else {
for (const SdfPath &invalidatedProcPath : invalidatedProcedurals) {
// XXX Procedurals here are cooked serially
// TODO: Do this loop in parallel and gather the generated
// notices.
// Procedurals here are cooked serially
_UpdateProcedural(invalidatedProcPath, true, &notices);
}
}
Expand Down Expand Up @@ -480,12 +489,17 @@ HdGpGenerativeProceduralResolvingSceneIndex::_PrimsDirtied(
++i;
}

{
TF_PY_ALLOW_THREADS_IN_SCOPE();
WorkWithScopedParallelism([&]() {
WorkParallelForEach(cookEntries.begin(), cookEntries.end(),
[this](const _CookEntry &e) {
this->_UpdateProcedural(e.path, true, const_cast<
HdGpGenerativeProceduralResolvingSceneIndex::_Notices *>(
&e.notices), e.deps);
});
});
}

// combine all of the resulting notices following parallel cook
for (const _CookEntry &e : cookEntries) {
Expand Down Expand Up @@ -583,14 +597,14 @@ HdGpGenerativeProceduralResolvingSceneIndex::_UpdateProceduralDependencies(

// compare old and new dependency maps
_PathSet dependencesToRemove;
for (const auto pathLocatorsPair : procEntry.dependencies) {
for (const auto& pathLocatorsPair : procEntry.dependencies) {
const SdfPath &dependencyPath = pathLocatorsPair.first;
if (newDependencies.find(dependencyPath) == newDependencies.end()) {
dependencesToRemove.insert(dependencyPath);
}
}

for (const auto pathLocatorsPair : newDependencies) {
for (const auto& pathLocatorsPair : newDependencies) {
const SdfPath &dependencyPath = pathLocatorsPair.first;
if (procEntry.dependencies.find(dependencyPath)
== procEntry.dependencies.end()) {
Expand Down Expand Up @@ -684,7 +698,7 @@ HdGpGenerativeProceduralResolvingSceneIndex::_UpdateProcedural(
// if there are no previous cooks, we can directly add all
// without comparison
if (procEntry.childTypes.empty()) {
for (const auto pathTypePair : newChildTypes) {
for (const auto& pathTypePair : newChildTypes) {
const SdfPath &childPrimPath = pathTypePair.first;
outputNotices->added.emplace_back(
childPrimPath, pathTypePair. second);
Expand Down Expand Up @@ -713,7 +727,7 @@ HdGpGenerativeProceduralResolvingSceneIndex::_UpdateProcedural(
_ProcEntry::_PathSetMap newChildHierarchy;

// add new entries (or entries whose types have changed)
for (const auto pathTypePair : newChildTypes) {
for (const auto& pathTypePair : newChildTypes) {
const SdfPath &childPrimPath = pathTypePair.first;

if (childPrimPath.HasPrefix(proceduralPrimPath)) {
Expand Down Expand Up @@ -741,7 +755,7 @@ HdGpGenerativeProceduralResolvingSceneIndex::_UpdateProcedural(
}

// remove entries not present in new cook
for (const auto pathTypePair : procEntry.childTypes) {
for (const auto& pathTypePair : procEntry.childTypes) {
if (newChildTypes.find(pathTypePair.first) ==
newChildTypes.end()) {
if (newChildHierarchy.find(pathTypePair.first)
Expand Down Expand Up @@ -867,7 +881,7 @@ HdGpGenerativeProceduralResolvingSceneIndex::_RemoveProcedural(

_MapLock depsLock(_dependenciesMutex);

for (const auto pathLocatorsPair : procEntry.dependencies) {
for (const auto& pathLocatorsPair : procEntry.dependencies) {
_DependencyMap::iterator dIt =
_dependencies.find(pathLocatorsPair.first);

Expand All @@ -884,7 +898,7 @@ HdGpGenerativeProceduralResolvingSceneIndex::_RemoveProcedural(
// 2) remove record of generated prims
if (!procEntry.childTypes.empty()) {

for (const auto pathTypePair : procEntry.childTypes) {
for (const auto& pathTypePair : procEntry.childTypes) {
const auto gpIt = _generatedPrims.find(pathTypePair.first);
if (gpIt != _generatedPrims.end()) {
gpIt->second.responsibleProc.store(nullptr);
Expand All @@ -893,7 +907,7 @@ HdGpGenerativeProceduralResolvingSceneIndex::_RemoveProcedural(

// childHierarchy may contain intermediate prims not directly
// specified
for (const auto pathPathSetPair : procEntry.childHierarchy) {
for (const auto& pathPathSetPair : procEntry.childHierarchy) {
const auto gpIt = _generatedPrims.find(pathPathSetPair.first);
if (gpIt != _generatedPrims.end()) {
gpIt->second.responsibleProc.store(nullptr);
Expand Down Expand Up @@ -927,4 +941,4 @@ HdGpGenerativeProceduralResolvingSceneIndex::_GarbageCollect()
}
}

PXR_NAMESPACE_CLOSE_SCOPE
PXR_NAMESPACE_CLOSE_SCOPE
Loading

0 comments on commit 5a08b86

Please sign in to comment.