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
Change: Shortcut varaction chains for callbacks and triggers. #9289
base: master
Are you sure you want to change the base?
Conversation
This looks like it need simliar checks as NML's switch optimisation.
|
Added what I think is the case for writing to persistent storage. Not really familiar with that system tbh. |
8f0006c
to
489900e
Compare
Procedure calls (variable 0x7E, DeterministicSpriteGroupAdjust::subroutine) aren't handled. If a deterministic group adjust references a procedure, DSGA_OP_STOP operations (but not any form of callback result) recursively reachable through the procedure group should also set has_cb_result on the referencing group. A deterministic group with calculated_result set to true is equivalent to a callback result, so should also set has_cb_result. Less importantly, GRFs will sometimes use groups which branch on variable 0xC, returning a callback result if 0 and some other non-callback group type for non-zero values. This is to implement "fail no matter if this is a callback or not". (This is CB_FAILED in NML). This will generate false positives in has_cb_result when used in the default graphics chain (many GRFs do this). |
This is now changed to also shortcut sprite group chains during trigger rerandomization if no rerandomization will occur. This suffers from potential premature optimization. I've not got any performance figures to show that anything needs improving, or that this improves it. |
Depending on context, if a sprite group chain does contain any callback results or trigger rerandomization, do not continue evaluating the chain. This possibly avoids processing complex graphical chains which can never end in a callback result (or rerandomization).
Motivation / Problem
By design, an unhandled callback often ends up following the default graphics chain. Depending on the variables accessed this could potentially be expensive.
Description
If a varaction chain does contain any callback results, do not continue evaluating the chain. This possibly avoids processing complex graphical chains which can never end in a callback result.
Limitations
This is not really benchmarked and is hypothetical at this point. It's not impossible that the additional test causes more work over all.
Checklist for review
Some things are not automated, and forgotten often. This list is a reminder for the reviewers.