Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

How to Optimize canvas.draw Calls and Reduce skpaint_to_grpaint_impl Overhead in a Scene with Multiple Identical Shapes?

22 views
Skip to first unread message

程洋

unread,
Feb 10, 2025, 6:25:05 AMFeb 10
to skia-discuss

I have a scene where I'm drawing over 50 nearly identical non-rectangular shapes on the screen. The only difference between them is the position; the shader, texture, and sampler are all identical. To render these shapes, I need to call ·canvas.draw· 50 times, and each call takes around 80-100µs, leading to a total of about 5ms spent on drawing calls per frame.

Upon investigating, I found that half of the time is spent in skpaint_to_grpaint_impl. Given that everything except the drawing position is the same, is there a way to avoid making too many calls to skpaint_to_grpaint_impl? Maybe cache the result of skpaint_to_grpaint_impl?

Reply all
Reply to author
Forward
0 new messages