-
Notifications
You must be signed in to change notification settings - Fork 19
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
Deactivate controllers when they don't need to update #135
Merged
ChrisAdderley
merged 4 commits into
post-kerbin-mining-corporation:dev
from
DRVeyl:dev-deactivateControllers
Sep 13, 2024
Merged
Deactivate controllers when they don't need to update #135
ChrisAdderley
merged 4 commits into
post-kerbin-mining-corporation:dev
from
DRVeyl:dev-deactivateControllers
Sep 13, 2024
Conversation
This file contains 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
ChrisAdderley
added a commit
that referenced
this pull request
Oct 6, 2024
* Refactor modifiers and integrators using common base classes -all float modifiers inherit from EffectModifier_Float, color modifiers from EffectModifier_Color, etc -all float integrators inherit from EffectIntegrator_Float, etc -Refactored Integrator.Update into Update + Apply, where Update is the shared logic between all integrators and Apply is the logic for a specific integrator (taking the output values and applying it to the material, lights, transforms, etc). -Added missing profile markup to the other integrator types * Refactor modifiers and integrators using common base classes -all float modifiers inherit from EffectModifier_Float, color modifiers from EffectModifier_Color, etc -all float integrators inherit from EffectIntegrator_Float, etc -Refactored Integrator.Update into Update + Apply, where Update is the shared logic between all integrators and Apply is the logic for a specific integrator (taking the output values and applying it to the material, lights, transforms, etc). -Added missing profile markup to the other integrator types * fix up project files to use reference path * Refactor modifiers and integrators using common base classes -all float modifiers inherit from EffectModifier_Float, color modifiers from EffectModifier_Color, etc -all float integrators inherit from EffectIntegrator_Float, etc -Refactored Integrator.Update into Update + Apply, where Update is the shared logic between all integrators and Apply is the logic for a specific integrator (taking the output values and applying it to the material, lights, transforms, etc). -Added missing profile markup to the other integrator types * performance: skip disabled renderers (#134) * WIP: skip integrators for renderers that aren't enabled -sort integrators by transform and whether or not they can control the renderer's visibility (testIntensity == true) -for the integrators that control visbility, have them return a boolean from their update function to indicate whether any renderers were active -when all of the renderers for a given transform name are disabled, we can skip the rest of the integrators for that transform known issues: -the transform name for position/rotation/scale integrators seems different from the one for float/color, so they don't get skipped properly -this probably doesn't work in a situation where you are adding/removing/editing integrators (need to re-sort the lists) * pull switch statements out of tight loops * include gitignore in project * apply integrator skipping to lights too * Refactor modifiers and integrators using common base classes -all float modifiers inherit from EffectModifier_Float, color modifiers from EffectModifier_Color, etc -all float integrators inherit from EffectIntegrator_Float, etc -Refactored Integrator.Update into Update + Apply, where Update is the shared logic between all integrators and Apply is the logic for a specific integrator (taking the output values and applying it to the material, lights, transforms, etc). -Added missing profile markup to the other integrator types * Deactivate controllers when they don't need to update (#135) * fix up project files to use reference path * include gitignore in project * WIP: modules can fully deactivate when not doing anything * fix memory leak from ui toolbar * Fix #136: fix b9ps switching in flight -wake up controllers each time initialize is called * Initial cut of editable particles, no modifiers * smoke work * More smoky progress * Refactor smoke prototype to work in new model * First cut at particle editor * Back to functional prototype status * color modifiers. * Clean up demo particle * porticle * refactor for multiple particle types * Gamedata tweaks * Fix point light layers * Vast quantity of UI garbage * Tentatively functional loading/saving for particle data * Gradient editing utils * UI refactor and cleanup * Clean up old attempt at particle modfiers so we start again * Serialization fixes and particle data cleanup * Updates to controller configurability * Add ID specification to engine event controllers * Fix for #120, delete some old untouched code * work on modifiers * change Integrate functions to protected static -not actually related to the crash, but this might be a small perf boost -adds clarity too * Fix infinite loop when changing a modifier's parameter -also should make the editor reliable again after all the sorting stuff * Fix infinite loop when changing modifier parameter targets (#141) * change Integrate functions to protected static -not actually related to the crash, but this might be a small perf boost -adds clarity too * Fix infinite loop when changing a modifier's parameter -also should make the editor reliable again after all the sorting stuff * Fix #142: separate out modifiers that don't use integrators * fix tabs * Direct modifiers should handle reordering * Fix #145: don't initialize or update effects on inactive transforms -massively improves performance for parts using ModulePartVariants * Only gather renderers from active effects -should help with #144 Related Work Items: #1 * Fix #140: block scrollwheel over editor UI * Functional color modifiers Plus various fixes to particle loading * Fix #151: exception spew when a template is missing -also guard against failing to load an assetbundle * #144: optimize SetupRenderersForCamera (#149) * use IDs instead of strings for material properties * micro optimizations in SetupRenderersForCamera * Don't put distortion shaders in the to-update renderer list since their renderqueue value never changes * diff cleanup * revert to old math for now * scope fix * add a comment * fix typo * Fix #150: UI clickthrough and lifecycle issues (#152) * Fix #150: disable unity GUI when window is hidden * move WaterfallAssets.Load to ModuleManagerPostLoad and remove one of the KSPAddons * Fix #150: Fix UI lifecycle issues -now that the window is attached to the canvas, it can't be a KSPAddon -the toolbar button logic is now not wrapped up in the window class hierarchy, but is now controlled by the addon * Support burst particle emission changes * Remove test particles from the distribution * move SetupRenderersForCamera from WaterfallEffect to ModuleWaterfallFX * Fix #144: optimize SetupRenderersForCamera for cases where there are no alpha-blended effects * oops * fix indexing issue when skipping deactivated transforms * cleanup model transforms when reinitializing (e.g. b9ps swap) * RCS Controller needs to skip inactive transforms because the values need to line up with the ones in the integrators * refactor: -modifiers own their output array instead of the integrator -modifiers grab their controller inputs directly instead of having the integrator pass them in * proper sleeping/change detection on controllers -this actually makes performance worse because random controllers will now keep things awake when they wouldn't have before * make randomness controllers report as asleep to return to old behavior * fix editor UI which broke from skipping the fx.Init call when no transforms were active * groundwork for improving random behavior * fix broken intensity test for lights * more efficient toggling of renderer/light enabled state * more aggressive controller sleeping * fix sleeping bug in RCS controller (needs to check for value changing) * fix activating modifiers: -force all modifiers to update when a transform is re-enabled (e.g. igniting an engine). Modifiers cache their values when the controller is asleep, and also don't get polled if they're on a disabled transform. So if the transform gets disabled before the modifier has a chance to get the latest value, it'll be wrong until the controller wakes up again. * don't add modifiers to an integrator's list if it doesn't have a controller * WIP: integrate gotmachine's FastFloatCurve * last fixes for FastFloatCurve * update random values on modifiers again -this got dropped when DirectModifier was added. We used to iterate over all modifiers and call Apply which would update the random value. Now this is moved to the Get function so that it's updated whenever the modifier is used * cache materials in EffectFloatIntegrator, don't update material property if it didn't change (#162) * cache materials in EffectFloatIntegrator * fix formatting and naming * move ApproximatelyEqual to Utils * don't alter material float value if it didn't change * use System.Math directly for cases where Unity is just adding overhead * remove redundant nullcheck from RCS controller * More sophisticated controller/effect/integrator sleeping (#164) * change internal controller storage to a list instead of dict * add a setting to force all controllers awake for debugging * add a setting to keep random controllers awake * Record a mask of which controllers are awake, and only update integrators if they use an awake controller or use randomness * add defaults to Settings.cfg * let whole effects skip updating if all of their controllers are asleep * make sure to still mark transfoms as disabled when the integrator didn't update * Integrator.hasRandoms shouldn't consider Settings.RandomControllersAwake -we still need to update integrators that use randomness; they just won't be updated if none of their controllers are awake * slight refactoring for used controller masks * use controller.mask * Fix #165: distortion toggle works again * Refactor integrators and TestIntensity (#166) * refactor the testIntensity functions so we don't need a separate function call * move testIntensity to the base integrator class * change integrator storage into 3 categories -testintensity, direct, others This reduces some complexity in the integrator sorting and a lot of boilerplate * re-add support for disabling lights * switch to explicit for loops * reverse integrator update order * add generic typed EffectModifier * fix formatting * add some ToString overloads to help debugging * Interface methods to reset particles * Update changelog.txt * Remove invalid integrators -fixes issues where configs that have missing controllers, material properties, etc would throw a NRE -test case: thud engine with SWE * Update changelog --------- Co-authored-by: JonnyOThan <jonnyothan@gmail.com>
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.
Also fix #121