Sodium Reloaded (Unofficial)

Sodium Reloaded (Unofficial)

0 Downloads

Clear the texture atlas of unloaded textures to reduce VRAM usage.

djmrFunnyMan opened this issue ยท 3 comments

commented

Bug Description

This is a vanilla bug which was marked as won't fix (MC-263119)
I described it in a duplicate issue MC-274736 which is where I will be getting the reproduction steps from.

Basically even after removing a rsp, minecraft will keep the textures in the atlas and won't shrink the dimensions of the atlas either. This will cause excessive and unnecessary VRAM usage if you're frequently loading and unloading texture packs (particularly high res ones)

Reproduction Steps

  • Save the atlas by pressing F3 + S
  • Load this texture pack (generate it from this txt on vanilla tweaks website first selected packs)
  • Unload this pack (go back to vanilla textures)
  • Save the atlas again and view it

You will notice the following:

  • Non vanilla textures are still present in the atlas
  • Various vanilla textures have been duplicated
  • The atlas is keeps its expanded dimensions

Before:
minecraft_textures_atlas_blocks png_0_before
After:
minecraft_textures_atlas_blocks png_0_after

Log File

Not relevant

Crash Report

Not relevant

commented

After looking at the code of TextureAtlas, it seems like this issue is actually a driver bug or optimization, which is why the Mojira report was marked as won't fix. The code always calls glTexImage2D on all mip levels of the atlas texture before populating it with sprites, but since all parameters except the width and height stay the same, the driver may have an optimization to not reallocate the texture if it is already allocated with dimensions that are greater than or equal to the given dimensions.

commented

Well even if this is the case (which it might not be) it would only prevent you from shrinking the atlas dimensions, not from clearing the excess textures.

commented

The excess textures don't affect performance or memory usage so it doesn't matter if they are cleared or not. The dimensions definitely affect memory usage.