-
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
Add GPU Feature Support #138
Comments
So far, we have these types:
And these enums:
|
I just noticed that although Skia can have an OpenGL backend or a DirectX (through ANGLE) backend, it cannot have both. This is sort of a "problem" on Windows desktop as which is best? There is a way to have "both" and that is to have two sets of dlls, one with OpenGL and the other DirectX. Then, as a developer, you can set either a MSBuild property (or something similar) and select the desired backend, without having to change the code. We could also split the NuGet into per-platform packages, and just have two packages for Windows. |
@mattleibow Actually you can create GrContext with needed opengl interface using GrGLAssembleGLInterface by passing a pointer to glGetProcAddress from corresponding opengl implementation. |
It may be worth to allow user to manually initialize that from C# code (by passing glGetProcAddress pointer) |
@kekekeks Thanks! I did some work and added code so you could do this: var openGLES = ObjCRuntime.Dlfcn.dlopen("/System/Library/Frameworks/OpenGLES.framework/OpenGLES", 0);
var glInterface = GRGlInterface.AssembleGlesInterface((ctx, name) => {
return ObjCRuntime.Dlfcn.dlsym(openGLES, name);
}); Which is similar to what The value which is returned inside the delegate/callback is the pointer to the function that was requested using the |
Hello. I have tried the latest Windows GL demo app with latest SkiaSharp 1.53.2-gpu2 nuget and vector drawing operations are all messed up. Simple operations like DrawCircle do not work when bound to a GL Backend. I also tried previous gpu1 nuget and it does not work either. The Shader based demos all work fine. Any eta on when this could be fixed? |
@jazzay I am not able to reproduce any issues. All the demos work on both Mac and Windows. Are you able to indicate which demo and send a screenshot? |
That might be related to particular OpenGL drivers. I'd recommend to use ANGLE on windows instead of relying on proper OpenGL support. |
Hey @kekekeks! I assume that is something I must configure on my machine? And then SkiaSharp will just pick up that driver configuration? Update: I investigated ANGLE, but see no way to install/use it within the OS. This appears to be a application linked solution, which is not accessible from SkiaSharp. Correct me if i'm wrong @kekekeks |
Hey I installed the latest NVidia GTX 660 TI driver (my video card), ran GL Bench passing with flying colors. Then build/run exact copy of the source from here: https://github.com/mono/SkiaSharp/tree/gpu-support/samples/Skia.WindowsDesktop.GLDemo. This is what I see for first demo, note how there is no logo (vector path) visible: Perlin noise demo runs fine, and fast indicating HW acceleration: Fonts also work fine: I doubt this is an issue w my driver/hw setup. Also note that I did code up a custom drawing method with simple circle - filled/stroked combinations. The fills never showed up. I could get the Stroke to show up only if the StrokeWidth = 1. Greater than 1 and it disappeared. Seems like some issue with the fill/stroke code path on Open GL. |
This appears to be working for most cases, so I am merging this into master and see what happens :) |
@mattleibow , where can I find a sample showing how to enable gpu acceleration on Android? thanks. |
Check out this issue #148, it had info and a branch with code |
@mattleibow thanks a lot, got it working after commenting this line (Flush() not found): https://github.com/mono/SkiaSharp/blob/skiasharp-views/views/SkiaSharp.Views.Android/SKGLSurfaceViewRenderer.cs#L28 |
@DanWBR that one is not yet released to 1.54.x. Once I get the Windows views done, I will update the SkiaSharp NuGet to v1.54.1 and see if I can get a beta out for the views. Just a note: I reworked all the iOS views/layers (and I think they are better for it) |
This is going to be the root issue where we discuss how and what we put forward to get the GPU / hardware accelerated drawing in place. Our aim is to make sure everything that needs to be is here, but not adding too much more just because we can.
The idea behind SkiaSharp is to make sure that we wrap the C++ as nicely as we can, but not create a new engine. If we add lots of code, when Google makes a change, we will then have to go and update all that code. SkiaSharp is supposed to be thin. We can always create a set of extension APIs or packages that make everything awesome.
First things first, we are working in the gpu-support branch for the C#/managed section and the gpu-support branch for the native C++ Skia.
You can view the managed diff and the native diff.
If you think we need an API, just leave a comment and we can make sure that we add it. If you created another issue already, just add a link so we can have everything in one place. If your feature is too big for normal support, just create another issue and leave a comment. It doesn't matter what you do, we will make sure that everything gets organized for you!
The text was updated successfully, but these errors were encountered: