Sodium Extra

Sodium Extra

25M Downloads

[Bug] Beacon beam rendering optimizations breaks when using Iris shaders

terzag opened this issue · 33 comments

commented

Make sure you are not opening a duplicate.

Minecraft version.

1.20.1

Sodium Extra version.

0.4.21

Sodium version.

0.4.10

What happened?

After updating to Sodium Extra 0.4.21, the game freezes just after loading my world. In most cases I then have to kill the process but it sometimes crashes to desktop instead. Got the following error but not every time:

The game crashed whilst rendering block entity
Error: java.lang.IllegalArgumentException: Source format has fewer elements than destination format

Version 0.4.20 works fine. Adding crash report and latest.log related to the error above.

Playing on Linux with an AMD GPU, if that's relevant.

Relevant logs

crash-2023-07-17_11.27.59-client.txt
latest.log

Additional information

No response

commented
commented

In all the tests I've made, I was a few blocks away from a beacon. I would need to check if being in the same chunk as the beacon beam has some influence on the freezes but in any case, I would have been at most ~20 blocks from the beacon's beam every time.

  • 0.4.20 works (nothing in sodium-extra.properties)
  • 0.4.21 initially uploaded to Modrinth −i.e. the one that was there when I opened the bug report− freezes (nothing in sodium-extra.properties)
  • 0.4.21 "unknown build" you uploaded above works, no freeze at all (nothing in sodium-extra.properties)
  • 0.4.22 from Modrinth freezes with empty sodium-extra.properties but doesn't seem to after adding the option mixin.optimizations.beacon_beam_rendering=false

EDIT: you say that you're on Linux with an AMD GPU too and everything works on your side. A difference between our setups that could lead to a different behavior could be the version of Mesa, maybe? I didn't specify it as it didn't seem important but I use the flatpak version of Minecraft (from FlatHub) and flatpak apps use a special package of Mesa instead of the system one. In my case, it would be 23.1.1 (which is more recent than the system one: 23.0.4 on Xubuntu 23.04).
Or the GPU model? I have a Radeon RX 6500 XT.

Of course, it could also be a conflict with a mod. I didn't mention the ones I use initially given that everything worked fine using Sodium Extra 0.4.20, so I assumed it was more likely that the issue came from a bug in the new version.

commented

I added beacon beam rendering optimizations in >0.4.20 but it doesn't explain why 0.4.21-unknown build fixes it but 0.4.22 is just the same as that except with new version number. Hence why I'm a bit confused.

My mesa driver is 23.1.3 and I have the RX 6600, this optimization commit was a while ago so previous mesa drivers likely worked just fine.

I'm going to revert a patch for some mixin changes I did in 0.4.22 hopefully that wasn't the cause. File below is with the patch reverted.
sodium-extra-0.4.22+mc1.20.1-unknown.zip

commented

That one seems to work. Have tried several times to save/reload the game (at different places), no more crash or freeze so far.

commented

Cool I will drop an release

commented

Er... I've just tried 0.4.22 that you uploaded on Modrinth and it still freezes. It even froze once on the "entering world" screen before rendering anything in the game. Haven't had the error message I mentioned with it, though, only freezes.

Reverted to the 0.4.21 "unknown" build that you put above and that one works. So, either the specific bug fix has been skipped in 0.4.22 or the issue is completely random and I've been lucky that the 0.4.21 above works (I've tried several times with both versions, so it's really unlikely).

commented

Using the 0.4.22 build, add mixin.optimizations.beacon_beam_rendering=false to .minecraft/config/sodium-extra.properties. Post a log and let me know if it freezes. It's a bit weird since I'm also running Linux and using the same family GPU as you and I can't replicate your issue.

commented

With that option, it doesn't seem to freeze. And thinking about it, it's quite possible that the freezes happened previously at the exact moment my beacon powered on. Should I try without the option but loading the world outside of the beacon's effect range? or maybe far enough of it to be sure that the beam doesn't render (not sure how far I would need to go)?

Not sure if you need the log given that it doesn't freeze but just in case here is the current latest.log.
latest.log

Tell me if you need a different one and/or if you want a new log + eventual crash file without the option, after the game freezes.

commented

Does the 0.4.21-unknown build freeze when near a beacon beam; without the changes I requested to add in .minecraft/config/sodium-extra.properties?
I'm actually not sure what's going on. It seems like the beacon optimization is not working as intended "but it works fine on my computer"

commented

That build seems to work (no freeze). I've removed the option from sodium-extra.properties beforehand (back to the original empty file).

Also, not sure if that matters but in my world, I have tainted glass above the beacon to change the beam's color. It's a detail and I don't see how it would have any influence but given that the issue seems to be related to the rendering of the beam and that you can't reproduce it, I guess it could come from some weird specific stuff like that that changes the beam's properties in any way.

And I use Mizuno's texture pack, in case the texture used for the beam can have some importance.

commented

As for beam color and any other customizations it shouldn't matter because we haven't touch those areas.

Can you test this with empty file near beacon?
sodium-extra-0.4.22+mc1.20.1-unknown2.zip

If this breaks then I know what might be causing the freeze(which might be a separate new issue)

commented

That one works too (no freeze). I haven't re-added the option to the .properties file.

commented

This makes zero sense, alright I need to check that build on Modrinth. unknown2 was the exact same as 0.4.22 except it was compiled on my computer. 0.4.22 was compiled by my CI pipeline

Edit: After decompiling 0.4.22 from Modrinth, they contain the same patches. At this point I have no idea what's going on all I can ask is that if you can do one final test for me by redownloading 0.4.22 from Modrinth and testing again.

commented

Re-downloaded the version from Modrinth and it still freezes. It even crashed just after the freeze with the error in my first message (though theses crashes seem to be random).

Just to be sure that it isn't a download issue, the md5sum of the file I have is c1b4bbc974cca643f2a1c44c931efa12. Is that correct?

EDIT: oh, wait, no, I realize I've made a mistake, I have to do the previous tests again.

commented

Yes that is the correct md5sum. I'm out of ideas, a version string change can not cause crashes. Just to rule out the possibility can I bother you by asking you to compile the mod on your own? https://github.com/FlashyReese/sodium-extra-fabric#compiling

commented

I can try but first, I just realized that I made a big mistake: I didn't notice that the versions you posted here were zip archives in which there were the .jar (the fact that both formats have basically the same icon on my system didn't help). So I put the .zip in the mods folder. That's why the game worked with the test builds: the mod wasn't loaded.

So, I restarted the tests from the start and 0.4.21 unknown build actually still froze. Same for the last two 0.4.22 unknown and unknown2 builds, they freeze.

Sorry for the misleading bad testing, we're actually back to step 1. :/

commented

It's okay, I was going have a bigger heart attack if you told me crazy magic that was going on.

Since you mention you are testing with other mods and resource packs. Can you run just Sodium and Sodium Extra?

commented

@terzag , are you using shaders?

commented

Yes, I'm using ComplementaryReimagined shaders. I'll try to remove all the mods apart from Sodium and Sodium Extras.

commented

I just managed to replicate your issue with shaders enabled.

commented

Oh, so do I still need to check with all mods removed? Or check with the mods but without the shaders?

commented

You need to disable the shaders

commented

Ok, so with shaders disabled, 0.4.22 from Modrinth and empty .properties file, no freeze.

It didn't occur to me that it could be related to the shaders given that Sodium Extra has Iris as a dependency. Would it be an issue with ComplementaryReimagined specifically?

commented

Nope, I have the freeze with bsl and kappa
It's probably a bug in sodium extra latest update

commented

image

We are overwriting a method that Iris mixins into.
https://github.com/IrisShaders/Iris/blob/1.19.4/src/main/java/net/coderbot/iris/mixin/shadows/MixinBeaconRenderer.java#L14-L25

I guess for now I could disable this patch when Iris is detected. Probably integrate proper compatibility down the line. I'm going to leave this issue open for tracking purposes and I will drop a patch to disable the optimization if Iris is detected.

commented

Ok, so with shaders disabled, 0.4.22 from Modrinth and empty .properties file, no freeze.

It didn't occur to me that it could be related to the shaders given that Sodium Extra has Iris as a dependency. Would it be an issue with ComplementaryReimagined specifically?

We don't have a hard dependency, it's mostly a recommendation dependency.

I have released 0.4.23 which contains the commit d401c9d to temporary disables the patch if Iris is detected.

Edit: I have also marked 0.4.21 and 0.4.22 as alpha on CurseForge and Modrinth; and as a pre-release on GitHub.

commented

Just came here because I was having the same issue. Or rather my game was just fully crashing.

Glad to see you have already found the problem and a fix is incoming, thanks for your mod and quick patch :)

EDIT: no longer crashing as of 0.4.23

commented

I can confirm that 0.4.23 works fine with shaders enabled. Thanks!

commented

Same for me, it no longer crashes!

commented

image
I think I have a solution done

commented

It's going to get released soon?

commented

Probably not, this needs testing and I probably want IMS to look over the changes but fun fact.
With optimization: (FPS is capped at 75)
image
Without optimization:
image

Edit: The commit can be downloaded here