Comments (3)
@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.
from skiasharp.
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
- Win32 window using
SetDIBitsToDevice
- X11 using
XPutImage
- Android using
ANativeWindow
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.
from skiasharp.
@kekekeks Hardware support is here (-ish)
I have started with getting all the bits together and I think it is working quite well. Right now All the platforms should have OpenGL support (DirectX is coming in a few). This means all the platforms, except UWP, can draw with hardware acceleration.
The global issue for hardware / GPU is here: #138
Please leave comments and suggestions so we can get the best product out.
There is also a preview NuGet: https://www.nuget.org/packages/SkiaSharp/1.53.2-gpu1
Please try that out and be sure to comment on how it went - if there are any features needed, just let us know!
from skiasharp.
Related Issues (20)
- [FEATURE] Support Direct3D HOT 4
- [BUG] `SKNativeObject` instances are not kept alive during native API calls
- [BUG] Annoying warning on .NET Framework 4.8 project with SkiaSharp 2.88.6 or 2.88.7 HOT 17
- [BUG] Text Missing When Running From AWS Lambda HOT 3
- [BUG] SkiaSharp 3.0 Preview 3.1 crashes the release version of the .NET MAUI app at start, debug works fine HOT 9
- [BUG] Drawing is warped during window resize on NVIDIA graphics card
- Canvas Info shows huge size when using Chrome Debugger and using Device Emulation
- [BUG] Build outputs duplicate native libraries HOT 2
- Skia Blazor Runs in debugger but not when deployed
- [BUG] SKGLElement gives black screen on Intel integrated graphics
- [BUG] SKGLView on .NET MAUI is missing a handler (the return) HOT 6
- [BUG] On iOS, with .NET 9.0 Preview 2 and 3 and SkiaSharp 3.0 Preview 2.1 / 3.1, SKGLView corrupts SkiaSharp memory and stops SkiaSharp from functioning HOT 7
- [BUG] The position draw on SKXamCanvas is not correct. #1585 Was this a bug that you worked around? HOT 3
- [PERFORMANCE] On iOS, layout speed of pages with SKGLView is slow, making layout wobbly at start (SKCanvasView is instantaneous)
- [BUG] SkiaSharp 2.88.8 (Xamarin) crashes randomly with Mali GPUs HOT 4
- [BUG] SKPaint's IsAntiAlisasing is on on Android but off on iOS by default (Xamarin / SkiaSharp 2.88.8) HOT 1
- [BUG] SkiaSharp crashes in WebAssembly if building with non-Release/Debug build config HOT 1
- [BUG] Canvas.DrawPath Cause Memory Leak on Windows 11 HOT 1
- [BUG] SKBitmap.ColorSpace is always null. Unable to check for CMYK, RGB, etc. HOT 1
- [BUG] CR2 image orientation being detected incorrectly.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from skiasharp.