Prevent a ShaderGraph crash from duplicate color transforms - #3061
jstone-lucasfilm merged 4 commits into
Conversation
|
|
|
Thanks for this proposed fix, @LouRohanNV, as well as for the great overview in #3060. Your diagnosis matches what I see in the code. Each filename input on a color-typed node queues its own output transform in One issue, though, is that the exact-pair check only covers the case where all three inputs share a color space. If the inputs specify different color spaces, as in the configuration described in #2182, the three requests differ in their source color space and survive the check, so the same collision and crash still occur. Ideally I'd like this PR to handle the full class of collisions rather than the single-color-space instance, and I believe two changes would get us there:
On the test, I'd suggest a document-level regression test in place of the More broadly, I agree that the correct long-term behavior for a nodegraph-implemented color node is to apply each transform to the inner |
Keep the first color transform request for each shader output. The previous check removed only identical requests, so different input color spaces still caused transform nodes to collide and crash. Remove the unnecessary input transform check. Make addNode() throw on duplicate IDs instead of replacing nodes with active connections. Replace the map-level test with document tests for identical and different input color spaces. All 11 shader-generation tests pass.
jstone-lucasfilm
left a comment
There was a problem hiding this comment.
Great work, thanks @LouRohanNV, and this fix looks ready to merge.
c43ac83
into
AcademySoftwareFoundation:main
Summary
Each filename input on
ND_triplanarprojection_color3can request a color transform for the same shader output. Those requests create transform nodes with the same identifier. The node map replaces the first node, but the node order and downstream connections still point to it. This can crash shader generation, whether the inputs use identical or different color spaces.This change keeps the first transform request for each output port and ignores later requests for that port. It also makes
ShaderGraph::addNode()throwExceptionShaderGenErroron a duplicate identifier, instead of replacing a node with active references. Input transform requests need no deduplication becauseapplyInputTransforms()visits each shader input once.Fixes #3060.
Tests
The regression test generates shaders from triplanar documents with identical and different input color spaces. Both cases check that generation succeeds and that exactly one output transform remains, using the first input's color space. These document tests exercise the
finalizepath where the crash occurs.The focused test passes with 10 assertions. All 11 tests in
[genshader]pass, with 251 assertions.Limitation
The retained transform still applies after the triplanar blend. For different input color spaces, the first retained conversion applies to the combined result, so the colors can still be incorrect. Correct conversion of each image sample before the blend remains a separate change under #2182.