'How to enable GPU for SkiaSharp GL

I'm using this code in constructor of MainPage (which is devired from ContentPage):

        canvasView = new SKGLView();
        canvasView.PaintSurface += OnCanvasViewPaintSurface;
        canvasView.EnableTouchEvents = true;
        canvasView.Touch += OnTouch;
        Content = canvasView;

I somehow have the feeling that GPU is not used, because with many shapes in the canvas it begins to lag quite soon. I've tried to enable GPU by using

        var GPUContext = GRContext.CreateGl();
        var gpuSurface = SKSurface.Create(GPUContext, true, new SKImageInfo(500, 500));

before creating the SKGLView but the GPUContext is null. What am I'm doing wrong? Can someone give an example how to properly enable GPU for SkiaSharp?

My longterm goal is to develop an app for iOS and Android, but for practically reasons I'm currently developing for Windows. I assume, GPU can also be used on mobile devices, right?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source