CanvasKit and WebGL Textures

153 views
Skip to first unread message

Micha

unread,
Oct 27, 2022, 10:49:27 AM10/27/22
to skia-discuss
Hi all,
this is a question about CanvasKit.
Using the CanvasKit API, it is possible to create a Skia Surface for rendering to a WebGL Texture?
We want to use a layer-based drawing concept, where individual WebGL textures will compose the final image. Some layers are 3D (we render on them directly using WebGL), some will be 2D and we would like to use CanvasKit to render on those.

The Layer Manager already exists, it cares for allocating and managing the required WebGL textures as well as the correct order of blitting the textures together. 

What is missing, is to hand over one (or more) of the WebGL Textures/Layers to CanvasKit and make them accessible for rendering using CanvasKit.

I found the following Surface creators, which all seem not to match our scenario:

CanvasKit.MakeSWCanvasSurface   --- CPU, not GPU
 CanvasKit.MakeOnScreenGLSurface, --- OnScreen, not a texture
 CanvasKit.MakeGPUCanvasSurface,  --- we're using WebGL, not WebGPU
 CanvasKit.MakeGPUTextureSurface.   --- we're using WebGL, not WebGPU

Any help or idea greatly appreciated;
Michael.


 

Micha

unread,
Nov 3, 2022, 11:57:54 AM11/3/22
to skia-discuss
just to clarify: We're looking for a CanvasKit/JavaScript version of C++'s SkSurface::MakeFromBackendTexture.
As far as I see, only WebGPU textures, but not WebGL textures can be used to be rendered onto using CanvasKit.
Reply all
Reply to author
Forward
0 new messages