CaffeineMC / sodium-fabric

A Minecraft mod designed to improve frame rates and reduce micro-stutter
Other
4.74k stars 809 forks source link

Summarized dependency of Sodium in Entity Texture Features (ETF) mod #2365

Open Traben-0 opened 7 months ago

Traben-0 commented 7 months ago

Request Description

Regarding #2329

Summary

Both mixins are additive only, they do not affect the underlying class/method behaviour

ETF emissive entity rendering will just safely stop working with Sodium present if these 2 mixins don't apply correctly

ETF mixins to me.jellysquid.mods.sodium.client.render.immediate.model.EntityRenderer.render() so it doesn't have to entirely disable Sodium's entity rendering optimizations, only adding logic to the HEAD & RETURN, ignoring the rest of the method

ETF mixins to me.jellysquid.mods.sodium.client.render.vertex.buffer.SodiumBufferBuilder (seems to now be called DirectBufferBuilder in v0.6) to apply a required interface to hold context for ETF

Detail

ETF has logic for emissive texture rendering that runs at the start and end of ModelPart.render() via a mixin. That will trigger a second render() call for an emissive texture if required.

Sodium cancels ModelPart.render() and calls me.jellysquid.mods.sodium.client.render.immediate.model.EntityRenderer.render() instead. https://github.com/CaffeineMC/sodium-fabric/blob/dev/src/main/java/net/caffeinemc/mods/sodium/mixin/features/render/entity/ModelPartMixin.java#L84

ETF could just set the flag to disable this sodium entity rendering optimization but in the interest of preserving those optimizations ETF has a duplicate of it's ModelPart.render() mixin targeting the start and end of me.jellysquid.mods.sodium.client.render.immediate.model.EntityRenderer.render() instead. https://github.com/Traben-0/Entity_Texture_Features/blob/master/common/src/main/java/traben/entity_texture_features/mixin/mods/sodium/MixinModelPartSodium.java With the original ETF ModelPart.render() mixin set to a priority that leaves it fully cancelled by sodium's mixin https://github.com/Traben-0/Entity_Texture_Features/blob/master/common/src/main/java/traben/entity_texture_features/mixin/MixinModelPart.java#L27

ETF also mixins to me.jellysquid.mods.sodium.client.render.vertex.buffer.SodiumBufferBuilder to apply a non impactful interface. I can see just now that this class has changed file names 2 weeks ago to DirectBufferBuilder presumably for v0.6

God-Dnds commented 6 months ago

Are there any workarounds for this other than downgrading?

Traben-0 commented 6 months ago

workarounds in what sense? no downgrading is required currently.