Bug fix: assigning init-op param its default value as instance got lost #1578
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.
This is a tricky situation to describe. Consider this shader:
By default, A is 0.5 and B gets A's value, also 0.5. If you give A a different instance value, like 1.0, then B will also get the same value, they'll both be 1.0. If you give B an instance value, that will be used for B rather than copying A's value, like this:
But there is a corner case bug: if we assign B an instance value of 0.0, it will incorrectly fall into a special case where it thinks it gets a default value, only coincidentally because 0.0 is in an unused slot for the default value (unused because it has no default -- its default comes from "init ops", that assignment).
!!!
Reading the patch should be self-explanatory for what the bug is and how we fix it.
Signed-off-by: Larry Gritz [email protected]