@@ -15,14 +15,16 @@ namespace Avalonia.Win32.OpenGl.Angle
15
15
{
16
16
internal class AngleWin32EglDisplay : EglDisplay
17
17
{
18
+ private readonly bool _flexibleSurfaceSupported ;
19
+
18
20
protected override bool DisplayLockIsSharedWithContexts => true ;
19
21
20
22
public static AngleWin32EglDisplay CreateD3D9Display ( EglInterface egl )
21
23
{
22
24
var display = egl . GetPlatformDisplayExt ( EGL_PLATFORM_ANGLE_ANGLE , IntPtr . Zero ,
23
25
new [ ] { EGL_PLATFORM_ANGLE_TYPE_ANGLE , EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE , EGL_NONE } ) ;
24
26
25
- return new AngleWin32EglDisplay ( display , new EglDisplayOptions ( )
27
+ return new AngleWin32EglDisplay ( display , egl , new EglDisplayOptions ( )
26
28
{
27
29
Egl = egl ,
28
30
ContextLossIsDisplayLoss = true ,
@@ -35,7 +37,7 @@ public static AngleWin32EglDisplay CreateSharedD3D11Display(EglInterface egl)
35
37
var display = egl . GetPlatformDisplayExt ( EGL_PLATFORM_ANGLE_ANGLE , IntPtr . Zero ,
36
38
new [ ] { EGL_PLATFORM_ANGLE_TYPE_ANGLE , EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE , EGL_NONE } ) ;
37
39
38
- return new AngleWin32EglDisplay ( display , new EglDisplayOptions ( )
40
+ return new AngleWin32EglDisplay ( display , egl , new EglDisplayOptions ( )
39
41
{
40
42
Egl = egl ,
41
43
ContextLossIsDisplayLoss = true ,
@@ -125,7 +127,7 @@ void Cleanup()
125
127
throw OpenGlException . GetFormattedException ( "eglGetPlatformDisplayEXT" , egl ) ;
126
128
127
129
128
- var rv = new AngleWin32EglDisplay ( display ,
130
+ var rv = new AngleWin32EglDisplay ( display , egl ,
129
131
new EglDisplayOptions
130
132
{
131
133
DisposeCallback = Cleanup ,
@@ -148,9 +150,11 @@ void Cleanup()
148
150
}
149
151
}
150
152
151
- private AngleWin32EglDisplay ( IntPtr display , EglDisplayOptions options , AngleOptions . PlatformApi platformApi ) : base ( display , options )
153
+ private AngleWin32EglDisplay ( IntPtr display , EglInterface egl , EglDisplayOptions options , AngleOptions . PlatformApi platformApi ) : base ( display , options )
152
154
{
153
155
PlatformApi = platformApi ;
156
+ var extensions = egl . QueryString ( display , EGL_EXTENSIONS ) ;
157
+ _flexibleSurfaceSupported = extensions ? . Contains ( "EGL_ANGLE_flexible_surface_compatibility" ) ?? false ;
154
158
}
155
159
156
160
public AngleOptions . PlatformApi PlatformApi { get ; }
@@ -175,7 +179,14 @@ public EglSurface WrapDirect3D11Texture(IntPtr handle, int offsetX, int offsetY,
175
179
{
176
180
if ( PlatformApi != AngleOptions . PlatformApi . DirectX11 )
177
181
throw new InvalidOperationException ( "Current platform API is " + PlatformApi ) ;
178
- return CreatePBufferFromClientBuffer ( EGL_D3D_TEXTURE_ANGLE , handle , new [ ] { EGL_WIDTH , width , EGL_HEIGHT , height , EGL_FLEXIBLE_SURFACE_COMPATIBILITY_SUPPORTED_ANGLE , EGL_TRUE , EGL_TEXTURE_OFFSET_X_ANGLE , offsetX , EGL_TEXTURE_OFFSET_Y_ANGLE , offsetY , EGL_NONE } ) ;
182
+ return CreatePBufferFromClientBuffer ( EGL_D3D_TEXTURE_ANGLE , handle ,
183
+ new [ ]
184
+ {
185
+ EGL_WIDTH , width , EGL_HEIGHT , height , EGL_TEXTURE_OFFSET_X_ANGLE , offsetX ,
186
+ EGL_TEXTURE_OFFSET_Y_ANGLE , offsetY ,
187
+ _flexibleSurfaceSupported ? EGL_FLEXIBLE_SURFACE_COMPATIBILITY_SUPPORTED_ANGLE : EGL_NONE , EGL_TRUE ,
188
+ EGL_NONE
189
+ } ) ;
179
190
}
180
191
}
181
192
}
0 commit comments