Fabricators-of-Create / Create

[Fabric Mod] Building Tools and Aesthetic Technology
MIT License
834 stars 188 forks source link

Severe performance degradation once Iris shaders get enabled #281

Closed weegeeluigi closed 2 months ago

weegeeluigi commented 2 years ago

Describe the Bug

The moment shaders are enabled, performance takes an unplayable hit resulting in an obvious bottleneck that is preventing GPU usage from increasing. The shaders I use are complementary v4.4, but I've tried a bunch of others and all result in the same problem. I've tried swapping to GravalVM and Open J9 to see if it's a Hotspot issue but nothing changed (in fact J9 made the performance plummet even more, down to literally a handful of frames). Originally I thought this world is just pushing the limits of contraptions and shaders, but upon creating a new test world with the same seed, dropping barely anything in it, the problems start to show themselves and the FPS drop is already significant.

I have 2 kelp farm based furnage engines. a windmill, and a bunch of automated belt lines for crushing, washing, blasting, mixing and pressing. Based on some of the nutty things I've seen people build, I'm not even convinced this is "a lot". My included screenshots will show the base (in the screenshots, the large, long building is empty). I have included screenshots with the RTSS overlay showing the issue both in the "real" in use world, and the test world, made with the same seed, to show the perf without create objects in it, and with, and what contraptions I have in the world. You'll have to pardon the need to zoom in to see anything since I play at 5120x1440 so the shots are "interesting".

When I start to walk away from the area, the screenshots will show the FPS bounce back up and eliminating the small hit printscreening does, I go back up to 70FPS and higher with shaders fully on blast once I've walked far enough away and am not looking towards the direction of the create setups. In the test world, standing still I can get up to 110+ FPS in the spot I took the screenshot in, but dropping just the schematic of the iron farm I use and the schematic of my furnace engine kelp farm setup already drops the FPS considerably, and the furnace engine setup isn't even running. Also moving close to the iron farm and walking already shows the clock speeds and usage starting to show the dropping behavior just with this stuff in it, standing still will bring it back up but moving immediately drops it. The FPS in this shot is already below 50.

Despite having the nvidia panel set to always go to max perf, and I even have nvidia inspector Multi display power saver running telling the system to forcefully activate 3D usage with X% usage, 15% to be exact to test, although I start to wonder if the driver is overriding this, there is something holding clocking back big time as the clocks stay locked at 1350mhz in the issue, despite the usage being reported at or above the 20% mark, and as I back away from the area they slowly start to crank up. Forcing the clocks locked at 2100mhz maybe add an FPS or two but the low clocks aren't the perf problem, they are just an interesting symptom of the bottleneck.

This is with build #548 and Iris and sodium, and sodium's respective add-ons lithium, indium and phosphor, are all latest. I have gone back to the first working and least bug free of the early 1.18.2 builds and same thing happens with those. The log has nothing in it being spammed to indicate an issue so instead of I have launched the built in profiler and attached it here. Note, I have tested the idea that Iris and complementary's shadowing is the problem, but despite turning off real-time shadows, block and entity shadows fully off, no difference is made. Something is just really turning off Iris somewhere. Maybe my world is asking too much, maybe my system just has an issue. This funky FPS problem has left me scratching my head for I cannot pinpoint whose at fault, even if I make a test world and start blowing away contraptions the issue only really goes away fully once everything is gone.

Reproduction Steps

  1. Get iris and complementary shaders
  2. Make a world and add contraptions and create builds
  3. Enable shaders and watch the FPS tumble ...

IrisCreatePerformance.zip

Expected Result

Shaders to work, even with a performance drop, but one that still allows things to be playable.

Screenshots and Videos

RealWorldCloseEnoughProblemStarts RealWorldFarEnoughProblemGone RealWorldFurnaceEngine RealWorldNoIssue RealWorldProblemShows RealWorldWalkingAwayStartsToFix TestWorldCloseToContraptionUsageDrops TestWorldIronFarmFurnaceAlreadyIssues TestWorldNoCreate

Crash Report or Log

https://github.com/Fabricators-of-Create/Create/files/8647319/IrisCreatePerformance.zip

Operating System

Windows 10

Mod Version

0.4.1

Minecraft Version

1.18.2

Other Mods

adorn: Adorn 3.4.0+1.18.2 architectury: Architectury 4.1.39 bclib: BCLib 1.4.5 betteranimalsplus: Better Animals Plus 1.18.2-11.0.5 betterend: Better End 1.1.0 betterf3: BetterF3 1.2.4 betternether: Better Nether 6.1.1 bosses_of_mass_destruction: Bosses of Mass Destruction (Beta) 1.3.6-1.18.2 byg: Oh The Biomes You'll Go 1.4-RC-10 cardinal-components: Cardinal Components API 4.1.4 cardinal-components-base: Cardinal Components API (base) 4.1.4 cardinal-components-block: Cardinal Components API (blocks) 4.1.4 cardinal-components-chunk: Cardinal Components API (chunks) 4.1.4 cardinal-components-entity: Cardinal Components API (entities) 4.1.4 cardinal-components-item: Cardinal Components API (items) 4.1.4 cardinal-components-level: Cardinal Components API (world saves) 4.1.4 cardinal-components-scoreboard: Cardinal Components API (scoreboard) 4.1.4 cardinal-components-world: Cardinal Components API (worlds) 4.1.4 cloth-basic-math: cloth-basic-math 0.6.0 cloth-config: Cloth Config v6 6.2.57 com_electronwill_night-config_core: core 3.6.4 com_electronwill_night-config_toml: toml 3.6.4 com_eliotlash_mclib_mclib: mclib 18 com_eliotlash_molang_molang: molang 18 com_github_llamalad7_mixinextras: MixinExtras 0.0.9 com_google_code_findbugs_jsr305: jsr305 3.0.2 continuity: Continuity 1.1.0+1.18.2 create: Create mc1.18.2_v0.4.1+548 cullleaves: Cull Leaves 2.3.2 dripstone_fluid_lib: Dripstone Fluid Lib 1.2.0 dynamicsoundfilters: Dynamic Sound Filters 1.3.0+1.18.2 edenring: EdenRing 0.5.1 exlineawnings: Exline's Awnings fabric-1.18.2-v1.0.2 exlinefurniture: Exline's Furniture fabric-1.18.2-v2.0.5 fabric: Fabric API 0.51.1+1.18.2 fabric-api-base: Fabric API Base 0.4.4+d7c144a860 fabric-api-lookup-api-v1: Fabric API Lookup API (v1) 1.6.0+2373a54560 fabric-biome-api-v1: Fabric Biome API (v1) 8.0.4+7b0f312660 fabric-blockrenderlayer-v1: Fabric BlockRenderLayer Registration (v1) 1.1.12+3ac43d9560 fabric-command-api-v1: Fabric Command API (v1) 1.1.9+d7c144a860 fabric-commands-v0: Fabric Commands (v0) 0.2.8+b4f4f6cd60 fabric-containers-v0: Fabric Containers (v0) 0.1.21+d7c144a860 fabric-content-registries-v0: Fabric Content Registries (v0) 3.0.3+d82b939260 fabric-convention-tags-v1: Fabric Convention Tags 1.0.1+474e4f7960 fabric-crash-report-info-v1: Fabric Crash Report Info (v1) 0.1.11+3ac43d9560 fabric-data-generation-api-v1: Fabric Data Generation API (v1) 2.0.7+6d3e563660 fabric-dimensions-v1: Fabric Dimensions API (v1) 2.1.17+2540745460 fabric-entity-events-v1: Fabric Entity Events (v1) 1.4.8+d7c144a860 fabric-events-interaction-v0: Fabric Events Interaction (v0) 0.4.19+d7c144a860 fabric-events-lifecycle-v0: Fabric Events Lifecycle (v0) 0.2.14+d7c144a860 fabric-game-rule-api-v1: Fabric Game Rule API (v1) 1.0.13+d7c144a860 fabric-item-api-v1: Fabric Item API (v1) 1.4.0+4457765560 fabric-item-groups-v0: Fabric Item Groups (v0) 0.3.11+91896a4960 fabric-key-binding-api-v1: Fabric Key Binding API (v1) 1.0.12+54e5b2ec60 fabric-keybindings-v0: Fabric Key Bindings (v0) 0.2.10+b4f4f6cd60 fabric-language-kotlin: Fabric Language Kotlin 1.7.2+kotlin.1.6.20 fabric-lifecycle-events-v1: Fabric Lifecycle Events (v1) 2.0.3+2d83e92c60 fabric-loot-tables-v1: Fabric Loot Tables (v1) 1.0.11+d7c144a860 fabric-mining-level-api-v1: Fabric Mining Level API (v1) 2.1.0+81ea5b3c60 fabric-models-v0: Fabric Models (v0) 0.3.6+d7c144a860 fabric-networking-api-v1: Fabric Networking API (v1) 1.0.21+d882b91560 fabric-networking-v0: Fabric Networking (v0) 0.3.8+b4f4f6cd60 fabric-object-builder-api-v1: Fabric Object Builder API (v1) 2.1.0+fe4ddef060 fabric-particles-v1: Fabric Particles (v1) 0.2.12+526dc1ac60 fabric-registry-sync-v0: Fabric Registry Sync (v0) 0.9.8+0d9ab37260 fabric-renderer-api-v1: Fabric Renderer API (v1) 0.4.13+d882b91560 fabric-renderer-indigo: Fabric Renderer - Indigo 0.5.0+7faf0d8860 fabric-renderer-registries-v1: Fabric Renderer Registries (v1) 3.2.11+b4f4f6cd60 fabric-rendering-data-attachment-v1: Fabric Rendering Data Attachment (v1) 0.3.7+d7c144a860 fabric-rendering-fluids-v1: Fabric Rendering Fluids (v1) 2.0.2+54e5b2ec60 fabric-rendering-v0: Fabric Rendering (v0) 1.1.13+b4f4f6cd60 fabric-rendering-v1: Fabric Rendering (v1) 1.10.7+54e5b2ec60 fabric-resource-conditions-api-v1: Fabric Resource Conditions API (v1) 2.0.3+91b7aa6660 fabric-resource-loader-v0: Fabric Resource Loader (v0) 0.4.18+2de5574560 fabric-screen-api-v1: Fabric Screen API (v1) 1.0.10+d882b91560 fabric-screen-handler-api-v1: Fabric Screen Handler API (v1) 1.2.0+1f6558e860 fabric-textures-v0: Fabric Textures (v0) 1.0.12+3ac43d9560 fabric-transfer-api-v1: Fabric Transfer API (v1) 1.6.0+2373a54560 fabric-transitive-access-wideners-v1: Fabric Transitive Access Wideners (v1) 1.0.0+bd8a4a1860 fabricloader: Fabric Loader 0.13.3 fake-player-api: Fake Player API 0.3.0 fallingtree: FallingTree 3.5.0 ferritecore: FerriteCore 4.2.1 flywheel: Flywheel 1.18-0.6.2.25 forge_tags: Forge Tags 2.1 forgeconfigapiport: Forge Config API Port 3.2.0 geckolib3: Geckolib 3.0.36 indium: Indium 1.0.3+mc1.18.2 iris: Iris 1.2.4-build.38 java: OpenJDK 64-Bit Server VM 17 lithium: Lithium 0.7.9 maelstrom_library: Maelstrom Library 1.2.4-1.18.2 mcwbridges: Macaw's Bridges 2.0.2 mcwdoors: Macaw's Doors 1.0.6 mcwfences: Macaw's Fences and Walls 1.0.4 mcwlights: Macaw's Lights and Lamps 1.0.3 mcwroofs: Macaw's Roofs 2.1.2 mcwwindows: Macaw's Windows 2.0.3 midnightlib: MidnightLib 0.2.9 milk: Milk Lib 0.3.0 minecraft: Minecraft 1.18.2 mm: Manningham Mills 2.3 modmenu: Mod Menu 3.1.0 mostructures: Mo' Structures 1.4.2+1.18.2 multipart_entities: MultipartEntities 1.1.5-1.18.2 noindium: No Indium? 1.0.1+1.18.2 omega-config: OmegaConfig 1.2.3-1.18.1 org_anarres_jcpp: jcpp 1.4.14 org_jetbrains_kotlin_kotlin-reflect: kotlin-reflect 1.6.20 org_jetbrains_kotlin_kotlin-stdlib: kotlin-stdlib 1.6.20 org_jetbrains_kotlin_kotlin-stdlib-jdk7: kotlin-stdlib-jdk7 1.6.20 org_jetbrains_kotlin_kotlin-stdlib-jdk8: kotlin-stdlib-jdk8 1.6.20 org_jetbrains_kotlinx_kotlinx-coroutines-core-jvm: kotlinx-coroutines-core-jvm 1.6.0 org_jetbrains_kotlinx_kotlinx-coroutines-jdk8: kotlinx-coroutines-jdk8 1.6.0 org_jetbrains_kotlinx_kotlinx-serialization-cbor-jvm: kotlinx-serialization-cbor-jvm 1.3.2 org_jetbrains_kotlinx_kotlinx-serialization-core-jvm: kotlinx-serialization-core-jvm 1.3.2 org_jetbrains_kotlinx_kotlinx-serialization-json-jvm: kotlinx-serialization-json-jvm 1.3.2 org_joml_joml: joml 1.10.2 phosphor: Phosphor 0.8.1 porting_lib: Porting Lib 0.2.0+1.18.2.7714a8d reach-entity-attributes: Reach Entity Attributes 2.1.1 registrate-fabric: Registrate for Fabric MC1.18.2-1.0.x roughlyenoughitems: Roughly Enough Items 8.0.442 simple_backpack: SimpleBackpack 1.2.35 smoothboot: Smooth Boot 1.18.2-1.7.0 sodium: Sodium 0.4.1+build.15 terrablender: TerraBlender 1.1.0.99 waveycapes: WaveyCapes 1.1.2 waystones: Waystones 2.5.0 whisperwoods: Whisperwoods 1.18.2-2.1.0

Additional Context

No response

TropheusJ commented 2 years ago

Make sure flywheel is enabled, might fix it bit. Run a spark profile and send it.

michlbro commented 2 years ago

Make sure flywheel is enabled, might fix it bit. Run a spark profile and send it.

I was testing out if there was any difference with flywheel on or off (instancing or batching) and I feel like it's made it slightly worse. With it off I see my fps drop as low as 65~ fps with shaders, if I use instancing or batching I see my fps drop as low as 55.

And if I have it on, there are still a few bugs with contraptions. Picking up an item near a contraption makes the contraption render near the centre of the screen

https://user-images.githubusercontent.com/96602061/167304745-dab5ec84-3bbb-45e2-858b-e60ba2b01f01.mp4

What I have also noticed is that when shaders are on, the shaft on a deployer that is on a contraption spins insanely fast but when shaders are disabled, the shaft never spins. (I don't know if this causes the massive amount of lag)

weegeeluigi commented 2 years ago

Make sure flywheel is enabled, might fix it bit. Run a spark profile and send it.

Enabling shaders automatically disabled Flywheel, as I believe this is intended. Turning it on doesn't make a difference anyways, forgot to mention that in the original post.

michlbro commented 2 years ago

That's weird, I did a quick test right now. When I set flywheel to instancing I saw my fps drop as far as 49 compared to flywheel off, which went low as 55. I don't know if this is just luck.

weegeeluigi commented 2 years ago

Flywheel off spark profile

Flywheel instancing on spark profile

If there is a specific type of command just let me know

anim4trix commented 2 years ago

moving blocks with create does drop the fps, i thought it was because of flywheel not being fully optimized with shaders yet. try sildurs i get 60-70 fps with gtx 750ti and i dont use too much block rotation or windmill just stationary stuff

IMS212 commented 2 years ago

All the spark profiles you've sent are server side, make sure to run sparkc and not spark.

weegeeluigi commented 2 years ago

Crap, terribly sorry about that in my rush to get this out before heading out I didn't pay attention!

Flywheel off

Flywheel instancing on

Shadows all OFF (entity, block, realtime)

Bonus, flywheel instancing but shaders are OFF (so "vanilla")

Pretty sure turning flywheel on makes zero difference since last I remember, flywheel refuses to enable if it detects shaders even if you tell it to turn on.

moving blocks with create does drop the fps, i thought it was because of flywheel not being fully optimized with shaders yet. try sildurs i get 60-70 fps with gtx 750ti and i dont use too much block rotation or windmill just stationary stuff

As mentioned in the OP, shader type doesn't matter. I have sildurs which has funky issues in general and it exhibits the same problems, if not even worse performance.

michlbro commented 2 years ago

60-70 fps with a 750ti is quite impressive considering I get the same fps with a 1660 super and having all of my machines stationary except 1 shaft that spins slowly.

anim4trix commented 2 years ago

60-70 fps with a 750ti is quite impressive considering I get the same fps with a 1660 super and having all of my machines stationary except 1 shaft that spins slowly.

i tweaked it alot plus the fabric performance modders are great lol

michlbro commented 2 years ago

Yes they are, fabric modders in general are great. For some reason the MSPT Max with instancing is higher than having it off. Instancing with shader Off with shader Instancing without shader Off without shader Instancing is great without shaders on with keeping the FPS up but the MSPT max is much higher than it being off.

IMS212 commented 2 years ago

Having any shaders enabled at all disables instancing for technical reasons, regardless of your settings.

weegeeluigi commented 2 years ago

Having any shaders enabled at all disables instancing for technical reasons, regardless of your settings.

Pretty much what I figured based on what I know of flywheel, I haven't put much more time into this since I haven't had any, but the small glances I took at the stack trace and code, I'm not too confident that any meaningful optimizations are really possible anywhere. But, don't quote me on that of course, I'm no expert in the create/flywheel code nor shader code in this game., that's you guys.

weegeeluigi commented 2 years ago

Don't want to seem like I'm imposing anything here, but curious if anyone has gotten a chance to look at it and formulate a hypothesis? I've spent most of this weekend upgrading and doing some long overdue maintenance on my machine, so the most I've done is test some theories out in the game itself that haven't have much fruit. Once the tile entities are loaded that's pretty much it and the bottleneck hits. The only thing I can think, from a "client side" non code approach is tomorrow if I have time I will try the Entity Culling mod, since the one built in Sodium seems to be playing it pretty safe. If this is unoptimizable from create/Iris side the hope is at least that mod's more aggressive path tracing to culling can make the general area playable, and the factory itself will just have to be toggled off.

anim4trix commented 2 years ago

Yeah entity culling helps a bit more, but the problem is that create is not very optimized with shaders, check flywheel discord they are aware of the performance drop , but there are no clear plans for it yet

PaulRVIFS commented 2 months ago

I use this additional mod: https://www.curseforge.com/minecraft/mc-mods/iris-flywheel-compat It forces the Flywheel optimizations on even when shaders are enabled. I still get a performance drop when I place down complex models like the waterwheels, but it's wayyyy better than without the mod.

IThundxr commented 2 months ago

No need to necro a year old post.

This issue is related to flywheel and how instancing doesn't run with shaders, will probably be fixed in flywheel 1.0.0 and isn't really a create issue