Hey folks,
I'm working on a 2d drawing app (think scrollable canvas where users can draw various paths/shapes/objects) and came across skia as a potential for the rendering system.
I spun up a quick test app (using a dev debug built skia) on mac using metal where I created an SkSurface and associated SkCanvas from an MTKView. To get a sense of performance, I set up a basic loop inside of my drawInMTKView delegate to render 5000 rects into the gpu backed SkCanvas. When doing this, the app seems to be rendering around 10 frames per second, with CPU usage pegged to 100%. Profiling the cpu usage has 83% of the cpu time being taken during the SkCanvas::onDrawRect call, slowly decreasing as the call stack goes down into the skgpu::SurfaceDrawContext::addDrawOp call. (So most of the time is taken in SkCanvas::onDrawRect, skgpu::SurfaceDrawContext::drawRect ... fillRectToRect ... drawFilledQuad)
The idea here was to move to skia rendering, so when a user moves the app canvas or moves an object the frame redraw would be handled by the GPU, instead of being bound by CPU based 2d drawing like I currently am using quartz as my drawing framework.
I also ran a test where I was thinking each object could be redrawn into an SkImage using a raster surface as required with a cached image for each object being composited during each draw call into the gpu backed surface, but even then compositing all the cached images into the gpu backed SkCanvas was giving poor performance once I was at 1000 or so.
Does anyone have any thoughts as to if I'm missing something with my config here, totally misunderstood what I could hope to achieve with skia, or thoughts as to different approaches I could take to improve rendering performance?
Thanks for any help