Lots of new optimizations utilizing prepatcher

To start, this mod now requires Prepatcher and Fishery.
New optimizations include: gene ticking improvements, world object improvements, hediff optimizations, world pawn gc optimizations, better mothballing, dds support, ContentFinder caching, additions and changes to reflection caching, as well as various other additions. Multiplayer support has been improved too, but should be considered highly experimental. The WorkGiver_DoBill bug is fixed in this build. Multiple patches aiming to improve RimWorld's load time have been added too.
This commit is contained in:
bbradson
2023-06-03 20:24:38 +02:00
parent cb0a407425
commit ca9321add8
125 changed files with 11272 additions and 3681 deletions
@@ -1,16 +1,20 @@
// Copyright (c) 2022 bradson
// Copyright (c) 2023 bradson
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
/*namespace PerformanceFish.Rendering;
public class PawnCacheRendererPatches : ClassWithFishPatches // The PawnCacheRenderer's Camera.Render() call has a considerable performance impact despite only being used for rendering of single pawns. These are failed attempts at lowering its impact.
public class PawnCacheRendererPatches : ClassWithFishPatches
// The PawnCacheRenderer's Camera.Render() call has a considerable performance impact despite only being used for
// rendering of single pawns. These are failed attempts at lowering its impact.
{
private static bool _optimizeCameraEnabled;
public class OnPostRender_Patch : FishPatch
{
public override MethodBase TargetMethodInfo => AccessTools.DeclaredMethod(typeof(PawnCacheRenderer), nameof(PawnCacheRenderer.OnPostRender));
public override MethodBase TargetMethodInfo
=> AccessTools.DeclaredMethod(typeof(PawnCacheRenderer), nameof(PawnCacheRenderer.OnPostRender));
public static CodeInstructions Transpiler(CodeInstructions codes)
=> Reflection.MakeReplacementCall(OnPostRender);
@@ -18,7 +22,10 @@ public class PawnCacheRendererPatches : ClassWithFishPatches // The PawnCacheR
public static void OnPostRender(PawnCacheRenderer __instance)
{
Find.PawnCacheCamera.cullingMask = DefaultCullingMask;
__instance.pawn.Drawer.renderer.RenderCache(__instance.rotation, __instance.angle, __instance.positionOffset, __instance.renderHead, __instance.renderBody, __instance.portrait, __instance.renderHeadgear, __instance.renderClothes, __instance.overrideApparelColor, __instance.overrideHairColor, __instance.stylingStation);
__instance.pawn.Drawer.renderer.RenderCache(__instance.rotation, __instance.angle,
__instance.positionOffset, __instance.renderHead, __instance.renderBody, __instance.portrait,
__instance.renderHeadgear, __instance.renderClothes, __instance.overrideApparelColor,
__instance.overrideHairColor, __instance.stylingStation);
Find.PawnCacheCamera.cullingMask = 16; // random
}
@@ -28,7 +35,8 @@ public class PawnCacheRendererPatches : ClassWithFishPatches // The PawnCacheR
public class RenderPawn_Patch : FishPatch
{
public override MethodBase TargetMethodInfo => AccessTools.DeclaredMethod(typeof(PawnCacheRenderer), nameof(PawnCacheRenderer.RenderPawn));
public override MethodBase TargetMethodInfo
=> AccessTools.DeclaredMethod(typeof(PawnCacheRenderer), nameof(PawnCacheRenderer.RenderPawn));
public static void Prefix(ref Vector3 cameraOffset, ref Vector3 positionOffset)
{
@@ -58,8 +66,12 @@ public class PawnCacheRendererPatches : ClassWithFishPatches // The PawnCacheR
cacheCamera.renderingPath = _optimizeCameraEnabled ? RenderingPath.VertexLit : DefaultCacheCameraRenderingPath;
}
private static RenderingPath DefaultCameraRenderingPath => _defaultCameraRenderingPath ??= Find.Camera.renderingPath;
private static RenderingPath DefaultCacheCameraRenderingPath => _defaultCacheCameraRenderingPath ??= Find.PawnCacheCamera.renderingPath;
private static RenderingPath DefaultCameraRenderingPath
=> _defaultCameraRenderingPath ??= Find.Camera.renderingPath;
private static RenderingPath DefaultCacheCameraRenderingPath
=> _defaultCacheCameraRenderingPath ??= Find.PawnCacheCamera.renderingPath;
private static RenderingPath? _defaultCameraRenderingPath;
private static RenderingPath? _defaultCacheCameraRenderingPath;
}*/