Optimizing text drawing
Posted: Sun Jul 22, 2018 9:08 am
I'm making a frontend for a Rockchip RK3066 board, which apparently has a, say, "modest" GPU. A friend of mine is helping me with building LÖVE for this board (he's modifying SDL and other dependencies as needed), and I'm changing my LÖVE code to improve performance. So far we've managed to make the frontend run at 40-50fps (to give you an idea, it runs at 450fps on my Windows gaming laptop).
We currently have two bottlenecks: textures (I'm working on making spritebatches to improve this) and texts. Correct me if I'm wrong but texts seem to be drawn treating each character as a texture, which results in a very noticable slowdown when there the character amount displayed is high. Printing 50 characters is around 4-7fps slower than printing 5 characters.
I tried changing from using print of printf to display texts, to making a canvas and drawing the texts there, then drawing the canvas (less drawing calls). It got a little better, but eats too much GPU memory (I have around 200 different texts, and could have more) and the application is still very slow. So I tried drawing the canvas in runtime. Not bad, but switching texts quickly resulted in higher slowdowns. So I switched back to printing texts with print and printf again.
I wonder if there's anything we could do, either in LÖVE code or in SDL or any other dependency. My friend still wants to try to add triple buffer to SDL, but we're starting to run out of ideas. Any advice would be greatly appreciated
We currently have two bottlenecks: textures (I'm working on making spritebatches to improve this) and texts. Correct me if I'm wrong but texts seem to be drawn treating each character as a texture, which results in a very noticable slowdown when there the character amount displayed is high. Printing 50 characters is around 4-7fps slower than printing 5 characters.
I tried changing from using print of printf to display texts, to making a canvas and drawing the texts there, then drawing the canvas (less drawing calls). It got a little better, but eats too much GPU memory (I have around 200 different texts, and could have more) and the application is still very slow. So I tried drawing the canvas in runtime. Not bad, but switching texts quickly resulted in higher slowdowns. So I switched back to printing texts with print and printf again.
I wonder if there's anything we could do, either in LÖVE code or in SDL or any other dependency. My friend still wants to try to add triple buffer to SDL, but we're starting to run out of ideas. Any advice would be greatly appreciated