Static initialization of VertexFormatElements is incompatible with other mods
Erdragh opened this issue ยท 0 comments
What happened?
The game crashes when multiple mods try to add new VertexFormatElement
s if their IDs overlap with Iris'.
Additionally, due to the parallel nature of Mod Startup in NeoForge it probably isn't threadsafe.
The advice I got on what to pass to the ID parameter was to AT the ELEMENTS
array in VertexFormatElement
and use its size()
method; doing so, on the NeoForge side, in FMLClientSetupEvent#enqueueWork
, so it's thread safe.
Additionally XFactHD mentioned that the passed values to the index
parameter are not correct
Apparently, what should be passed there is how often the specific USAGE has occurred before, so you'd have to count through the ELEMENTS
array how many are there already.
Here's the direct quote from the Discord:
What should be passed to the
index
parameter?
The occurence of the "element usage". It's 0 for most things, but UV for example has indices 0, 1 and 2 for texture, hurt overlay and light respectively. They'd have to count how many elements with any given usage are already registered and use that as the index (you should ideally do that too)
Screenshots
No response
Log output
Minecraft Version
1.21.1
Iris Version
iris-neoforge-1.8.0-beta.5
Operating System
Arch Linux
What is your GPU?
AMD Radeon 7900XT
Additional context
See discussion on the NeoForge discord
I discovered this while trying my port to 1.21.1 of Stellar View with Iris