Archived

This topic is now archived and is closed to further replies.

IndirectX

std::list in D3DFont

Recommended Posts

IndirectX    122
Hi! I want to push D3DFont to the extreme. I decided to use a single batch info struct to hold all possible text drawing requests coupled with static VBs (since all fonts have the same FVF anyway). I keep the batch request list sorted by texture, then by XYZ/XYZRHW FVF. To make insertions in the middle of batch record container fast, I decided to use std::list. However, it must allocate memory on the free store for the links. Is that fast enough or slow? Using vector and sorting it after all batch requests have been added should be slower IMO because I will have to swap my structs around. Vectors of pointers use new anyway, so no improvement here. Is std::list<BATCH_INFO> the (only) way to go? Thanks.

Share this post


Link to post
Share on other sites
jobless    122
You might want to try having a pre-allocated buffer (just an array) of structs. Then you have a list or vector of pointers that point to positions in the array. This is easy if you''re able to flush the buffer all at once (for instance, you process all requests and start again with an empty buffer). That way, you don''t have to worry about which places in the buffer are in use and which are not.

Share this post


Link to post
Share on other sites