Mipzip files

For xupdf, before we move to using real PDF rendering in realtime, and also for real photos later, we need a way to quickly load and discard mipmap levels.

The Mipzip file format is simple: a zip file with a single entry for each mipmap level, and a metadata entry "texformat". The metadata is stored in comments so that unzip -l will show it. The format is stored as an callGL-accepted OpenGL token, e.g. COMPRESSED_RGB_S3TC_DXT1_EXT.

Mipzip.gen.html#mipzipformat mipzipformat

The following classes collaborate to provide Mipzip functionality. First of all, MipzipLoader has a nested class, Level, for representing a mipmap level, and uses GL.Texture to store the texture which it loads and unloads.

gzz.gfx.gl.MipzipLoader MipzipLoader.Level GL.Texture Mipzip.gen.html#mipziploaderStruct mipziploaderStruct

MipzipMemoryConsumer provides a published API for requesting the Texture ID and posts at the same time requests for consuming memory.

gzz.gfx.gl.MipzipLoader gzz.mem.MemoryConsumer gzz.mem.MemoryPartitioner gzz.gfx.gl.MipzipMemoryConsumer Mipzip.gen.html#mipziploaderThread mipziploaderThread

The process of loading a single mipzip level is rather intricate. Due to the requirements of memory handling and GL threads, we need to separate loading the mipmap level and teximaging it to different threads.