-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
GLControl #3386
GLControl #3386
Conversation
runs on an elderly windows laptop here, I had to add .0 to the float literals in the shaders and mediump to the shared uDisco and uTime. |
# Conflicts: # src/Avalonia.Native/GlPlatformFeature.cs # src/Skia/Avalonia.Skia/PlatformRenderInterface.cs
PR should be ready for review |
I used this to embedd libmpv into Avalonia. Worked like a charm, but I had a weird resize issue. The video from mpv would resize, the control would resize, but the visible part would stay exactly the size it was during OnOpenGlInit.
|
@gulek |
Ah, it seems that your code changes the current texture binding and doesn't restore it back. |
Will this be compatible with libraries like OpenTK (4.0)? |
@dfkeenan that entirely depends on the library. If it's capable of using an external OpenGL context and external glGetProcAddress and isn't afraid of the context being of different types (EGL for Win32, desktop GL for Linux/OSX), it should work. |
Isn't it better to use swiftshader (https://swiftshader.googlesource.com/SwiftShader) for ANGLE instead of relying on directx WARP? |
WARP allows interop with other DirectX-based APIs which is kinda important for WPF integration and future support for advanced features like DirectComposition. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did a quick check of this PR, I would need to see how this affects other custom GPU implementations as well.
|
||
namespace Avalonia.Rendering | ||
{ | ||
public class ManagedDeferredRendererLock : IDeferredRendererLock | ||
public class ManagedDeferredRendererLock : DisposableLock, IDeferredRendererLock |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is kinda weird - you derive from DisposableLock
but all methods here are just hiding base implementation and it ends up having two different locks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since DisposableLock class contents are copy-pasted from ManagedDeferredRendererLock, it's most likely an unfinished attempt to extract disposable lock logic to a different class
100); | ||
var data = "#version " + version + "\n"; | ||
if (DisplayType == GlDisplayType.OpenGLES) | ||
data += "precision mediump float\n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon after float
will cause shader compilation error.
CheckError(GL); | ||
|
||
// Create the vertex buffer object (VBO) for the vertex data. | ||
_vertexBufferObject = GL.GenBuffer(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fails for me on Win32 ANGLE that supports only GLES 2.0.
# Conflicts: # src/Skia/Avalonia.Skia/DrawingContextImpl.cs # src/Windows/Avalonia.Win32/WindowImpl.cs
# Conflicts: # src/Skia/Avalonia.Skia/PlatformRenderInterface.cs # src/Skia/Avalonia.Skia/SkiaOptions.cs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MarchingCube has tested it, things were fixed it looks good,
@danwalmsley, @grokys and @kekekeks agreed this is a YOLO merge.
Note there is a bug in ANGLE that prevents us from using stencil buffer on software-rendered DirectX (Microsoft Basic Render Device). I have a patch to fix that, but it will be shipped with our angle nuget separately.