|
From: James T. <ja...@fl...> - 2022-02-08 11:59:29
|
> On 8 Feb 2022, at 11:41, Erik Hofman <er...@eh...> wrote: > > Canvas is about painting to a texture end then uploading it to the GPU (as I understand it). If you do the painting on the GPU then you would free the GPU from doing a compute intensive task. Unfortunately, there’s no fully-GPU based solution for this which is portable. The non-portable approach is ‘NV path rendering’, which basically implements the OpenVG API (similar to SVG and what ShivaVG does in partial software / partial OpenGL 1.x) . But it only works on nVidia GPUs, so no option for us. To support Canvas on Core profile, the plan is to migrate from Shiva to ‘something else’ which implements the required drawing operations. Unfortunately two of the probable solutions (Skia from Chrome and Cairo from Gtk) are both enormous and a pain to deploy on macOS and Windows. My current view is to replace Shiva with this: https://github.com/inniyah/nanovg <https://github.com/inniyah/nanovg> .. which should be small enough to drop in directly, *and* we believe, supports the required Path rendering features which Canvas needs. (Eg, line thickness, dot/dash, clipping) Unlike Shiva, NanoVG can target Core-profile OpenGL, using its own shaders, and because they both aim to implement the same VG spec, should be close enough at the pixel level, to keep everything working. (Let’s see how that works in reality) What could then be added to Canvas, is the option to use shaders when using a Canvas.Image. Qt Quick calls this a ‘layer’ (like in Photoshop) : basically when drawing this intermediate texture (which is what an Image or Canvas-in-a-Canvas is), add the option to use a custom shader in a very similar manner to an ALS filter. That would definitely be a nice enhancement to Canvas capabilities. Kind regards, James |