engines: support direct injection mode
Currently, WebGL and WebGPU support rendering via RTT (render-to-texture). We can also support direct injection with appropriate context management. This integration could improve rendering performance on target platforms. Make this an optional mode so users can choose the integration method based on their needs and environments. Basically, ThorVG has considered to support this with the Canvas target() API.
It's good to begin.
On native machines, we can have direct FBO injection now. However, it's just a POC waiting for fine-tuning, such as MSAA, color space, and so on.
Comparison
@wenjieshen what do you think at performance?
@wenjieshen what do you think at performance?
In the edge case, for example, a 4K resolution canvas with simple animation can experience a 3x speedup through direct rendering. It represents an ideal value, but I haven't aligned the quality of results between the two approaches.