package dev.photosync.mcapi.render;

/**
 * A texture living on the GPU, owned by whoever asked {@link TextureSink} for it.
 *
 * <p>Closing it is not optional: the browser can walk through thousands of
 * thumbnails in a session, and a leaked texture is leaked video memory for as
 * long as the game runs. The UI's cache is what closes these, on eviction and
 * when its screen goes away.
 */
public interface TextureHandle extends AutoCloseable {

    int width();

    int height();

    /** Releases the GPU resource. Must be called on the render thread. Idempotent. */
    @Override
    void close();
}
