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

Apple : Compilation support for MaterialX 1.38.X and 1.39.X #3159

Conversation

ld-kerley
Copy link

Description of Change(s)

MaterialX 1.39.X introduced API changes, this PR allows OpenUSD to be built against either MaterialX 1.38.X or 1.39.X.

Most of the changed arise from an API change around MaterialX::TypeDesc being passed by value instead of pointer. The other change is the complete removal of the channels attribute.

NOTE : The MaterialX versioning PR (#3157) should be merged before this.

Fixes Issue(s)

Fixes compile issues when using MaterialX 1.39.X

  • I have verified that all unit tests pass with the proposed changes
  • I have submitted a signed Contributor License Agreement

@jesschimein
Copy link
Collaborator

Filed as internal issue #USD-9837

❗ Please make sure that a signed CLA has been submitted!

@jesschimein
Copy link
Collaborator

/AzurePipelines run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@@ -285,12 +289,15 @@ HdStMaterialXShaderGen<Base>::_EmitMxSurfaceShader(
if (outputConnection) {

std::string finalOutput = outputConnection->getVariable();
#if MATERIALX_MAJOR_VERSION == 1 && MATERIALX_MINOR_VERSION==38
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth doing "MATERIALX_MAJOR_VERSION == 1 && MATERIALX_MINOR_VERSION < 39"?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think any version of MaterialX prior to 1.38.something was ever used or would compile against the USD codebase, so this seemed more direct, but if you prefer the < I have no objections to changing it.

Maybe #if MATERIALX_MAJOR_VERSION == 1 && MATERIALX_MINOR_VERSION<=38 is better overall?

const std::string type = mxType
? Base::_syntax->getTypeName(mxType) : "vec2";

#if MATERIALX_MAJOR_VERSION == 1 && MATERIALX_MINOR_VERSION==38
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I appreciated how most of the other ifdefs are hidden away inside helper functions; is there a way to do that here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good - I'll look to see if this is possibly cleanly.

_GetMxTypeDescription(std::string const& typeName)
{
#if MATERIALX_MAJOR_VERSION == 1 && MATERIALX_MINOR_VERSION==38
// Add whatever is necessary for current codebase:
static const auto _typeLibrary =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor thing, but I wonder if you could have an ifdef around
"using typename MxTypeDesc = const mx::TypeDesc"
or something and then only define the map once, since aside from the map type everything is character-for-character identical. You'd still need another ifdef around the find/return code below, but that's less likely to be edited than this type map table.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep - seems like a good improvement.

@jesschimein
Copy link
Collaborator

/AzurePipelines run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@zwillikon
Copy link

May you please rebase materialXFilter.cpp ?

@ld-kerley ld-kerley force-pushed the materialx1_39_build_updates branch from 68cee6c to 1033d49 Compare September 16, 2024 19:37
gador added a commit to ShaddyDC/nixpkgs that referenced this pull request Nov 3, 2024
This reverts commit 993ec32.
MaterialX has some upstream issues which haven't been quite
worked out, yet[1]. It is therefore reasonable to wait
with an update in nixpkgs. It also breaks downstream packages
like python312Packages.openusd as well as blender[2]

[1]: PixarAnimationStudios/OpenUSD#3159
[2]: NixOS#326466 (comment)

Signed-off-by: Florian Brandes <[email protected]>
gador added a commit to gador/nixpkgs that referenced this pull request Nov 3, 2024
This reverts commit 993ec32.
MaterialX has some upstream issues which haven't been quite
worked out, yet[1]. It is therefore reasonable to wait
with an update in nixpkgs. It also breaks downstream packages
like python312Packages.openusd as well as blender[2]

[1]: PixarAnimationStudios/OpenUSD#3159
[2]: NixOS#326466 (comment)

Signed-off-by: Florian Brandes <[email protected]>
gador added a commit to ShaddyDC/nixpkgs that referenced this pull request Nov 3, 2024
This reverts commit 993ec32.
MaterialX has some upstream issues which haven't been quite
worked out, yet[1]. It is therefore reasonable to wait
with an update in nixpkgs. It also breaks downstream packages
like python312Packages.openusd as well as blender[2]

[1]: PixarAnimationStudios/OpenUSD#3159
[2]: NixOS#326466 (comment)

Signed-off-by: Florian Brandes <[email protected]>
@nyabinary
Copy link

bump :p

@jesschimein
Copy link
Collaborator

/AzurePipelines run

Copy link

Pull request contains merge conflicts.

wentasah pushed a commit to wentasah/nixpkgs that referenced this pull request Nov 4, 2024
This reverts commit 993ec32.
MaterialX has some upstream issues which haven't been quite
worked out, yet[1]. It is therefore reasonable to wait
with an update in nixpkgs. It also breaks downstream packages
like python312Packages.openusd as well as blender[2]

[1]: PixarAnimationStudios/OpenUSD#3159
[2]: NixOS#326466 (comment)

Signed-off-by: Florian Brandes <[email protected]>
@pixar-oss pixar-oss closed this in 82a2f3f Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants