ArchaicFix uses multiple tessellator instances, one for each worker thread, in order to perform most of the chunk updating work on parallel worker threads. This causes a problem with Triangulator, as it references Tessellator.instance, assuming only one tessellator instance is in use.
This PR makes Triangulator use ArchaicFix's API for getting the correct tessellator instance for the current thread. The implementation of disableTriangulator is changed to use a singleton object as Tessellator.instance is no longer a good place to store its data.
This fixes the visual glitches that happen when Triangulator is used together with ArchaicFix's threaded chunk updating.
However, this fix is not complete. The redstone paste mixin still references Tessellator.instance:
In order to finish the fix, Triangulator's API will have to be changed to allow suspending the thread-local tessellator instance exclusively. Maybe the suspendQuadTriangulation set of methods could be changed to allow suspending even before tessellation is started? It's either that, or creating a new set of methods, but that would seem like a mess.
I'll keep this as a draft until a version of AF with the API is released. Actually I can just use jitpack.
ArchaicFix uses multiple tessellator instances, one for each worker thread, in order to perform most of the chunk updating work on parallel worker threads. This causes a problem with Triangulator, as it references
Tessellator.instance
, assuming only one tessellator instance is in use.This PR makes Triangulator use ArchaicFix's API for getting the correct tessellator instance for the current thread. The implementation of
disableTriangulator
is changed to use a singleton object asTessellator.instance
is no longer a good place to store its data.This fixes the visual glitches that happen when Triangulator is used together with ArchaicFix's threaded chunk updating.
However, this fix is not complete. The redstone paste mixin still references
Tessellator.instance
:https://github.com/FalsePattern/Triangulator/blob/8d6f8fd6711dab592ee33e05680ffedac339f9f4/src/main/java/com/falsepattern/triangulator/mixin/mixins/client/redstonepaste/RedstonePasteHighlighterMixin.java#L15-L27
In order to finish the fix, Triangulator's API will have to be changed to allow suspending the thread-local tessellator instance exclusively. Maybe the
suspendQuadTriangulation
set of methods could be changed to allow suspending even before tessellation is started? It's either that, or creating a new set of methods, but that would seem like a mess.I'll keep this as a draft until a version of AF with the API is released.Actually I can just use jitpack.