source: golgotha/src/render/tex_cache_readme.txt

Last change on this file was 80, checked in by Sam Hocevar, 11 years ago
  • Adding the Golgotha source code. Not sure what's going to be interesting in there, but since it's all public domain, there's certainly stuff to pick up.
  • Property svn:keywords set to Id
File size: 2.0 KB
Line 
1Texture cache readme file
2-------------------------
3
4The texture management works as follows. I'll highlight the changes from Jonathans original implementation.
5
6Each texturemanager has a heap manager (or a non-heap manager). I've implemented each in
7tex_heap.hh and tex_no_heap.hh. tex_heap is used when you have actual access to the texture memory
8chunk, as with the software or Glide implementation of R1, however with something like Direct3D or
9OpenGL, you dont, so the non-heap manager will keep track of those textures, how much memory they're using,
10how old they are, etc.
11
12Aside from the heap manager, each texture manager has to implement an immediate_mip_load() and async_mip_load().
13What each does should be obvious from the name. The way I have the async loads handled currently is that
14the reads are started during the frame, but the upload isnt processed until next_frame() is called. Most
15cards wont like it if you upload in mid-frame, so if you DO find yourself wanting to call immediate_mip_load(),
16make sure its not in the middle of the frame.
17
18Aside from that, the texture managers dont do much other than "select" a texture. The reason the "select"
19function exists is so the heap manager can keep track of how old textures are, but not much else. It could
20do other things if the texture manager wants to implement a 2d tile system of combining textures, or whatever,
21but it currently does nothing of the sort.
22
23As far as the texture file system goes, its a bit complicated.
24
25There is a texture directory (a physical directory, c:\tmp\ctext)
26and a file inside of it called the "cache" file (c:\tmp\ctext\tex_cache.dat).
27The cache knows what pixel format the textures in the directory are in, the
28maximum size of the textures, and it also contains their lowest mip levels.
29The reason it contains the lowest levels is to speed up the game startup, but
30I've noticed its rather useless because the game still has to chunk on the
31higher miplevels that it needs when you actually start drawing scenes.
Note: See TracBrowser for help on using the repository browser.