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

Decouple GLSL and MSL "libraries" location. #1980

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ld-kerley
Copy link
Contributor

Currently there is a dependency between the GLSL and MSL shader generation modules, because both targets share source code (which is great), the MSL shader generator uses files from the genglsl libraries locations.

This becomes a small problem when building with USD, if the MaterialXGenGLSL module is not built, as the code uses MaterialXGenGLSL::TARGET to generate the genglsl component in the file path.

This PR aims to address this, by more correctly decoupling the MSL and GLSL shader generators, while still allowing the source code, and there only be a single copy of the code in the source repo, as well as make some of the cmake dependency tracking more robust.

All files shared between genglsl and genmsl have been moved from the genglsl location to a shared _hwCommon location.

The libraries CMakeLists.txt has been updated to "build" a staged folder from the source folder, where

  • Only the shader generators that are enabled will have their source code staged to the libaries folder. This will result in smaller installations, where only one shader generator is desired.
  • The _hwCommon files are correctly copied to both genmsl and genglsl.
  • The OSL legacy closures file switch is also staged in this build location, this unifies this logic in one place.

This also slightly simplifies the testing logic as we don't have to replicate the OSL legacy closure logic, and instead can just copy the staged files to the location for testing. The dependency tracking for copying the testing files is also fixed, so iterative edits to any of the files in libraries should be automatically installed to the testing location, previously this location would need to be deleted for cmake to copy the files.

…libraries" based on the shader generator requested. Common code between GLSL and MSL is moved to a "_hwCommon" folder in the source tree but gets copied to "genglsl" and "genmsl" respectively based on install requirements.
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.

2 participants