Simplify OSL shader generator for surfaceshader output#2509
Merged
ld-kerley merged 2 commits intoAcademySoftwareFoundation:mainfrom Sep 29, 2025
Merged
Conversation
niklasharrysson
approved these changes
Aug 5, 2025
Contributor
niklasharrysson
left a comment
There was a problem hiding this comment.
This looks good to me, thank @ld-kerley
jstone-lucasfilm
approved these changes
Aug 6, 2025
Member
jstone-lucasfilm
left a comment
There was a problem hiding this comment.
Other than the minor notes I've added inline, this change looks good to me.
I'd probably recommend that we hold this change in reserve for 1.39.5, since it's a substantial change in logic.
… the required node that exists in the data library
367ade5 to
d6b1106
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently if the OSL shader generator is passed an element that outputs a single
surfaceshadertype, then it injects the shader code from the OSL implementation ofsurfacematerialnode. Because thesurfaceshadertype is a struct and it needs to be resolved down to aclosure colorfor output.This PR modifies the shader generator to insert an instance of the
surfacematerialnode, instead of hardcoding the shader source in the shader generator. This decouples the library, and means we just have a single source of truth for the shader code in thesurfacematerialnode for OSL.Adds a new API call on the
ShaderGraphnode to insert a node upstream of an output of the graph.