I am writing a 2D game engine framework not yet publicly released. I'm looking for ways to improve my rendering strategy.
Currently, I have three render layers; background, sprite and UI; I want to expand this without hindering performance. Also, currently the sprite type dictates which layer to render them on. This seems like bad design to me.
What I mean by performance is that I handle every pixel and how it is rendered. Algorithm is very efficient. Layer is chosen as target and rendering takes place only on that layer.
Once the rendering job is done for a single update cycle, the layers are merged and displayed.
Any suggestions as to what I could do to make my system scalable but, still maintain efficiency? Would there ever be a need to render more than 3 layers or 9 (assuming I could implement a depth within each layer)? What strategy could I use to determine where sprites should be rendered based on their sprite type without forcing users of my framework to explicitly declare?
Note: in this context, sprites could be as large as a background or as small as a particle