You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Find and replace all magic number node parameter indexes with ::INDEX const #1490
The best option is to replace indices with symbols, but the purely index-oriented approach is described below.
The task here is to use various searching and go-to-references/implementations techniques to find as many magic number indexes as possible for node parameters, and replace them with their node parameter's ::INDEX constant.
Since this ::INDEX system is newer, there are many places we have magic numbers for indexes like 1 and 8 lying around in the code. They are probably often used to generate values for specific function calls. For example, InputConnector::node is one such function that can have its usages searched to find plenty of examples where magic number indexes are passed in, that should be replaced by an ::INDEX const instead. In some cases, this could be indirect, like if that function is passed a variable set elsewhere. And there are likely other functions besides that one, too, that are receiving magic number indexes.
After those techniques are completed, a final check should be done by manually checking through the ~1.5k (perhaps less after the other replacements are completed) results from this project-wide search:
Enable regex but not word boundaries or capitalization
changed the title [-]Avoid using magic number indexes in the node system[/-][+]Find and replace all magic number node parameter indexes with ::INDEX const[/+]on Feb 10, 2026
Hi@Keavon! I noticed that the test is failing, but I think it's unrelated to my PR for issue #1490. From what I can tell, it's a precision issue with the LUT in discrete_srgb.rs, the precomputed values don't exactly match the reference implementation due to floating-point rounding errors. I'd be happy to open a separate PR to fix this LUT issue if you'd like. Let me know what you think. Thanks!😊
@Tyooughtul does the failure occur on the master branch? If so, that would indicate it is happening irrespective of your work in this branch. I'll take a look when you open a PR.
Activity
Kakapio commentedon Jan 19, 2024
Keavon commentedon Jan 22, 2024
[-]Avoid using magic number indexes in the node system[/-][+]Find and replace all magic number node parameter indexes with ::INDEX const[/+]3 remaining items
Keavon commentedon Feb 23, 2026
Also, see the note about AI usage I just added to the top of this issue description.
fix: replace hardcoded input indices with ::INDEX constants
Tyooughtul commentedon Feb 25, 2026
Hi@Keavon! I noticed that the test is failing, but I think it's unrelated to my PR for issue #1490. From what I can tell, it's a precision issue with the LUT in discrete_srgb.rs, the precomputed values don't exactly match the reference implementation due to floating-point rounding errors. I'd be happy to open a separate PR to fix this LUT issue if you'd like. Let me know what you think. Thanks!😊
Keavon commentedon Feb 25, 2026
@Tyooughtul does the failure occur on the master branch? If so, that would indicate it is happening irrespective of your work in this branch. I'll take a look when you open a PR.
fix: replace hardcoded input indices with ::INDEX constants
Tyooughtul commentedon Feb 25, 2026
fix: replace hardcoded input indices with ::INDEX constants
fix: replace hardcoded input indices with ::INDEX constants
fix: replace hardcoded input indices with ::INDEX constants
fix: replace hardcoded input indices with ::INDEX constants
fix: replace hardcoded input indices with ::INDEX constants
fix: replace hardcoded input indices with ::INDEX constants