MrCrayfishFurnitureMod
MrCrayfishFurnitureMod copied to clipboard
[1.12.2] Photo frame and TV optimizations
This PR consists of numerous optimizations and bug fixes for photo frames and TVs. The goal is to allow for a huge number of photo frames and TVs to be used in a single world.
These changes are backwards compatible with the server, so if you'd like to make use of these optimizations you can update your client-side mod if the server uses 6.3.1:
furniture-6.3.1-1.12.2.jar.zip
Photo frame optimizations
All images are now stored as compressed DDS textures in the image cache, this allows a large number of photo frames to be used with high-resolution images while keeping VRAM usage low. These textures will be loaded with mipmaps if enabled in the minecraft settings. If Fancy Graphics are enabled then anisotropic filtering will also be applied to the photo relative to how many mipmap levels are enabled.
The compression is done through the included texconv.exe
from the DirectXTex toolkit. For non-windows platforms it will fall back to no compression. It is possible to implement support for compression on other platforms through cross-platform compressors such as Compressonator.
As a personal preference I've also removed the glass reflection texture from the photo frame and fixed the small black rectangle that was drawn in the bottom-right of the frame.
TV bug fixes and optimizations
This PR addresses some issues with animated textures, it now respects the time delay of each frame instead of trying to play all GIFs at 20 fps. The GIF decoder has also been replaced with a new version which fixes some decoding issues.
All animated texture frames are now kept in VRAM instead of uploading every frame as needed, this ensures smooth operation even with many TVs active. The upload format to VRAM has also been optimized to use the BGRA format, this reduces reshuffling of channels on both the GPU driver side and the application side.
As a personal preference I've changed the TV renderer to use linear filtering instead of nearest-neighbour when scaling the image on the screen.
General fixes
- Thread pooling has been added for image downloading limiting the number of parallel downloads and conversions to 4
- Photo frames and TVs now only unload their associated textures when the chunk they're in is unloaded
- All textures in the cache are now unloaded when the player quits the current world
- Caches now use a concurrent hash map to reduce synchronization
- Image data is no longer redundantly kept in RAM after being uploaded to VRAM
Also as a side note, I'm wondering if there are any plans to support the photo frame and TV for later versions of Minecraft
I'm pretty sure the plan is to update to 1.15 and 1.16 with parity to 1.12
Is this a client-specific version? NoClassDefFoundError appears after the server is installed.
I actually never tested it on a server, but yes you only need it in the client.