Class PictureInPictureRendererPool<T extends PictureInPictureRenderState>

java.lang.Object
net.neoforged.neoforge.client.gui.PictureInPictureRendererPool<T>
All Implemented Interfaces:
AutoCloseable

@Internal public class PictureInPictureRendererPool<T extends PictureInPictureRenderState> extends Object implements AutoCloseable
Pools PictureInPictureRenderer for a single type of PictureInPictureRenderState and tries to reuse renderers on subsequent frames.

Vanilla only ever uses one PIP renderer per PIP state type. This can lead to crashes or visual artifacts, since the backing render target textures are stored within the renderer, and if two or more of the same type of state are submitted in one frame, the states will begin interfering with each other.

We solve this by using one renderer per distinct PictureInPictureRenderState state per frame, and use this class to pool them for reuse in subsequent frames.