Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.12.2] Photo frame and TV optimizations #608

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open

[1.12.2] Photo frame and TV optimizations #608

wants to merge 14 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Aug 9, 2020

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

StackDroid added 14 commits August 7, 2020 13:15
* Updated Forge to 1.12.2-14.23.5.2847
* Switched gif decoder to fmsware version, fixes decoding
* Support for animations that are not 20 fps
* Keep all animated texture frames loaded for current channel
* Optimized texture data upload
* Removed reflection from photo frames
* Switched to linear resampling for TVs
* Added mipmapping to photo frames
* Added thread pooling for image downloading
Requires texconv.exe to be extracted in the data directory
@ghost
Copy link
Author

ghost commented Aug 9, 2020

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

@Ocelot5836
Copy link
Contributor

I'm pretty sure the plan is to update to 1.15 and 1.16 with parity to 1.12

@1871847400
Copy link

Is this a client-specific version?
NoClassDefFoundError appears after the server is installed.

@ghost
Copy link
Author

ghost commented Oct 7, 2020

I actually never tested it on a server, but yes you only need it in the client.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants