OK, I'm trying to clear my mind, make some order out of chaos in my spaghetti code and finally reorganize the code I learned (more or less) around before starting do something more challenging (like cool things with shaders, for that I just ordered a book).
So, one of the first things I want to implement to throw away my "dummy" forward rendering is a sort of rendering command managements.
And here comes the dilemma: in what kind of container store the commands?
Let me first (correctly I think) exclude some common containers type:
- "simple" array, well don't think I will never able to establish the maximum number of commands per frame.
- every associative container (for me is just unintuitive).
- a stack, why should just process commands in a LIFO policy?
Now let's try to think simple: could a FCFS policy feeds well the GPU?
If yes, these could be good candidates:
- A double linked list, easy to reuse some commands, but I never liked lists performance for "small" contents.
- A FIFO queue, maybe implemented with a deque? It should fit well the FCFS policy, but prevents reuse of commands.
- Directly a deque or a dynamic array, providing a little more freedom then a FIFO queue.
- My own custom container, maybe providing a good way to reuse commands? (how?!? )
Simple assumption: different container for different "living state" commands could be a better strategy (ie: a container for use-only-one commands and another for reusing commands).
Please, share your thoughts, opinions or a draft of partial solution to this .