Foam​Fix

Foam​Fix

97M Downloads

Crash With < 16x16 Textures

ChloeDawn opened this issue · 2 comments

commented

The game crashed whilst applying mipmaps for a < 16x16 texture.
The texture, in this case, was a particle for Better Foliage.
Something in FoamFix is assuming textures will be >= 16x16.

FoamFix version: 0.8.2-1.12.2
Forge version: 1.12.2-14.23.1.2560
Crash report: crash-2017-12-08_21.11.36-client.txt

commented

This is caused by a broken assumption when calling uploadTextureSub here: https://github.com/asiekierka/FoamFix/blob/0.8.x-1.12.2/src/main/java/pl/asie/foamfix/client/FastTextureAtlasSprite.java#L202

It is possible for the sprite in question to be <16x, and since width>>4 == 0 for values <16 this causes a /0 error on the first line of uploadTextureSub. The solution is to just add a !=0 check like forge does here: https://github.com/MinecraftForge/MinecraftForge/blob/1.12.x/patches/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java.patch#L7

commented

Thanks! The code was adapted more or less directly from Kobata's fix, which was written two years ago.

I'll look into it. I have to add code to disable this on nVidia cards by default anyway, as it only slows down performance there...