-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Replacement of GL methods with Silk.NET #5663
Conversation
I'd be happy to move OpenGlPage example to Silk.NET (and remove APIs needed only for that example page from Avalonia.OpenGL), but the rest of the core library has to stay as is. |
Also, note that Silk.NET is not strong-named, so we can't have it as a dependency for core and platform assemblies. |
I understand the problem of not wanting an(other) external dependency, but I'm confident Silk.NET works well with both partial, OpenGL, and OpenGLES implementations (though I will look into changing the reference to the OpenGLES package then), and I also believe Silk.NET is easy to integrate with other bindings due to us exposing all the loading mechanisms.
this should be solved soon, once the transition to the dotnet foundation has completed. If a dependency is a big problem though, do close this PR, as I don't think this can lead anywhere in that case. |
OpenGL and OpenGLES are different APIs. They have a shared subset that we are using to wire up ANGLE, but that's it. There is no binding library I'm aware of that exposes only the shared subset.
The "primary" OpenGL context should not be used by the user code except for rare circumstances. One is expected to create their own context (OpenGLControlBase does that under the hood). |
I agree that we don't want a dependency on a 3rd party library at this level. That would mean that if someone wants to use Silk.NET on top of Avalonia they'd be forced to use a version compatible with the version that Avalonia uses. We've had these sorts of dependencies in Avalonia before in the past and it always causes problems for somebody. |
Fair point. We will introduce (a) package(s) to support using Silk.NET on top of Avalonia instead. |
Where can I find this? I have a Core DLL, separate from my main App, that I don't want to depend on a specific GUI framework; I want things in Core to just take a generic GL Context, and then App can pass a GL Context from Avalonia to it. "silknet avalonia" gives no Google results, where can I find a well-maintained SilkNetControl? |
It hasn't been developed yet. It's on our list for Silk.NET 3.0. |
Sounds good. Is there something I should be doing in the mean time wrt not tying GL-dependent code to Avalonia? |
What does the pull request do?
This replaces Avalonias own GL bindings with Silk.NET, @Perksey mentioned to me that this was not a thing, and I gave it a shot this weekend.
I believe this is much easier to maintain, and Silk.NET always tries to improve bindings in terms of performance and usability, these improvements will trickle down to Avalonia with little effort now (updating a NuGet package).
This also "solves" #4310 as an added bonus (giving OpenGLControl much more power)
What is the current behavior?
Avalonia has it's own GL bindings, which are more difficult to use and have a higher startup cost.
What is the updated/expected behavior with this PR?
There should be no visual changes anywhere.
How was the solution implemented (if it's not obvious)?
I believe this is obvious looking at the changes in src/Avalonia.OpenGL/ from where the changes simply trickled down, but I can detail this if needed.
Checklist
Breaking changes
Breakes users of
OpenGlControlBase
Changes to be done / considerations
GlInterface
currently still exists asGlContextInfo
which is used (?) for other loading mechanisms, ieegl...
CompileShaderAndGetError
but I believe this could be moved elsewhere