Just rereading some of this thread, and an FYI:

>Well normally you can use 0 to 65535 pallettes but as only a few games use a lot of pallettes,
>its better to allocate sufficient buffer for pallettes on need. We can suppose if a game wants
>more 255 palettes, he'll probably use 65535.


The dx8 sdk docs state "There is a maximum of 16,384 palettes", so in theory MAX_PALETTES could be increased to that value. Depends on whether the memory overhead by doing that is too high (which it might be, 256 palettes * 256 entries * 4 bytes/entry = 256K but 16384 palettes works out at 16mb?) - In which case as Raphael states - maybe we can start with 256 and only go to 16384 if required.

Another alternative is to look at the lights support - Have a linked list of the palettes which are 'used', and effectively only allocate a new palette on demand and add it to the list. This would save on wasted memory, but have an overhead on accessing an entry.

Feel free to code it - A while ago, I was trying to find a demo of a game which used color index mode (ie palettes), and couldnt - gta3 is the only one I could find and there is (was) no demo.

Jason


Reply via email to