SkiaTexture does not work receiving a video via DrawImage from a video source

SkiaTexture seems to have a problem with Video (IVideoSource) Input via SKImage/Layer. Works with Image file via SKImage/Layer though.

grafik

See patch attached:
240604_skiatexture.zip (459.7 KB)

(of course it would be better to play the video in Stride, but it should work however)

Stride and Skia render pipelines use different graphics devices. When bridging from one world into the other (SkiaTexture) we might run into resources which have been created on the other device and therefor are not valid on the one we’re rendering on. In your case that’s the SkImage produced by the VideoSourceToSkImage node. However what you could try is to tell that node to produce images backed by CPU memory (instead of GPU) by setting the prefer GPU pin to false. These images should then be renderable in both worlds.

That there even are two devices at play is unfortunate and a known issue since quite a while. However there’s no proper fix yet due to incompatibilities with blend modes in the used APIs. Sorry for that.

Yep, setting VideoSourceToSkImage’s “Prefer Gpu”-Pin to fals does the trick. Thanks for the explanation, this makes sense.

However, ideally this would be somehow recognized and handled internally (in the SkiaTexture), or?
But I understand it seems more complex then I thought.

Hey, are you refering to this?

Looks like the sRGB color type is available in the 3.0.0 previews:

Couldn’t find any roadmap for the stable release though.

This also looks interesting:

3 Likes

These are all super nice developments in the SkiaSharp repo!