Spike wrote:Though I feel I should add that multiple Hunk_Alloc calls are wasteful, and can be compacted by making a single alloc for all surfaces instead of an alloc for each and every surface. There's a couple of situations where such optimisations will save a noticable chunk of ram.
True, this. BuildSurfaceDisplayList is one good example here (just tot up how many polys you need and the size of each in your Mod_LoadFaces and do one single alloc at the end of it) - each surface has additional memory used for the hunk header and padding.
This is another case where switching to shaders is hugely advantageous - you can completely get rid of warp surface subdivision (not that it ever worked right anyway) and just use the original polygons from the BSP. That also enables you to use a static VBO for your water and sky surfaces (can the PSP use VBOs?) - performance, memory saving and higher quality all in one. A rare case where you can get all 3.
Baker wrote:Boring note: FitzQuake's texture manager does actually use those guys if bpp changes during a video mode switch, it reloads the pixels from memory.
Fitz actually reloads them from file too. Unfortunately it loads the full PAK file (or maybe it's just the BSP file - same potential end result either way) into memory then jumps to the offset location, where a simpler fopen/fseek/fread would have accomplished the same thing. (That's also a potential crasher if you're already tight on memory, although in this case it will Sys_Error rather than go down in flames.)