Just after some idea's really regarding ui rendering on the GPU. Specifically, methods/ideas to keep draw calls batched while being interactive.
A batch of say 20 items in a list, all grouped in one draw call. What are my options for interactivity, say rollover effects.
Let us say for example 1 texture will be shown in the normal state and when selected or interacted with, another texture is displayed.
Hear are my current thoughs:
Just render the offending item again on top of itself ignoring depth.
This would add only one draw call and would allow for alpha based transitions,
It may lead to issues if the over state were smaller than the original though.
Somehow stencil/mask out the old item then redraw the new one:
I guess this would add 2 draw calls but the original item would be completely hidden.
No way to transition though?
Lerp between the 2 textures (1 texture atlas) for every item and update constants to drive the distinction between the 2 textures:
All still done in 1 draw call and could animate the lerp float on the cpu no probs.
This would waste a texture read most of the time but probably not a performance issue at all, 128 constants allowed so it would limit the list size.
Right, so that was might thinking of the top of my head, now smash me with better ideas of brilliance!!! (or just critique the ideas I had above)
I am looking for the right balance of flexibility and performance. Never really done UI stuff on the GPU so don't be angry if I am approaching this like drunk 6 year old!
In summary, how to draw interactive UI efficiently on the GPU assuming a shader model 2 environment?
Thanks for your time!