We are using skia built into WASM for 2D rendering.
Currently we need skia to draw many rects (say 1000 per SkSurface) each with a different transforming matrix and a little argument variation with a same SkRuntimeEffect. We find skia calls a lot of glUniformMatrix3fv. Is it normal? Why can't we batch that transform matrix?
code is something like:
auto surface = SkSurface::makeRenderTarget(...);
auto canvas = surface.getCanavas();
auto rect = SkRect::MakeXY(256, 256);
for (auto i = 0; i < 1000; i++) {
SkPaint p;
auto shader = runtime_effect.makeShader();
p.setShader(shader);
SkAutoCanvasRestore restore(canvas, true);
canvas->concat(some_unique_transform);
canvas->drawRect(rect, p);
}
//run other shader that samples the surface...