-
Notifications
You must be signed in to change notification settings - Fork 546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
On-screen rendering and ganesh backend support #24
Comments
Since opengl-related calls are too platform-specific and complex for the end-user it's better to keep Garesh backend initialization and surface-flipping in the native lib. I also can see that currently your bindings don't have built-in on-screen rendering support and you leave the task of blitting image to screen to the user. In Perspex we have a concept of a render target that allows to create a rendering session which, when disposed, is flipped back to screen. It may be worth to do the same. interface IRenderTarget
{
IRenderingContext CreateContext();
}
interface IRenderingContext : IDisposable
{
SkCanvas Canvas { get; }
} To end user it will look like this: var target = new OSWindowRenderTarget(hWnd/xid/nswindow);
...
using(var ctx = target.CreateContext())
{
ctx.Canvas.DrawRectangle(...);
} That render target will manage everything required to initialize ganesh-backend using ANGLE/EGL/GLX/AGLX/whatever or fall back to sw rendering. Currently we have in Perspex: iOS render target using GLKView OS window abstraction with sw/hw rendering switch with backends for
EGL/ANGLE hw-accel backend for Win/Linux/Android That code provides a simple C++ API: class RenderingContext
{
public:
SkCanvas* Canvas;
virtual ~RenderingContext() {}
};
class RenderTarget
{
public:
virtual RenderingContext* CreateRenderingContext() = 0;
virtual ~RenderTarget() {}
}; Code is MIT-licensed and could be easily ported if you agree with the design. |
@kekekeks I will be looking into this soon. I have got most of the GPU bits building for all platforms right now. The next step is to get ANGLE for Windows added, then wrap all the necessary types. As the GPU bits are building already, initial wrapper can be created for OpenGL right now, except the UWP will have to wait for ANGLE. Win32 can have initial GL support until ANGLE arrives - giving it more options for devs. |
@kekekeks Hardware support is here (-ish) The global issue for hardware / GPU is here: #138 There is also a preview NuGet: https://www.nuget.org/packages/SkiaSharp/1.53.2-gpu1 |
Do you plan to add hardware acceleration support? I have some native code for win/linux/ios/android that we use in Perspex for hw-accelerated drawing using Skia. For Windows it will add dependency on ANGLE, but performance improvements are worth of adding such dependency.
The text was updated successfully, but these errors were encountered: