|
|
|
@ -42,34 +42,64 @@ internal static class EglDisplayUtils |
|
|
|
}; |
|
|
|
|
|
|
|
var cfgs = versions |
|
|
|
.Where(x => x.Type == GlProfileType.OpenGLES) |
|
|
|
.Select(x => |
|
|
|
{ |
|
|
|
var typeBit = EGL_OPENGL_ES3_BIT; |
|
|
|
|
|
|
|
switch (x.Major) |
|
|
|
if (x.Type == GlProfileType.OpenGLES) |
|
|
|
{ |
|
|
|
case 2: |
|
|
|
typeBit = EGL_OPENGL_ES2_BIT; |
|
|
|
break; |
|
|
|
var typeBit = EGL_OPENGL_ES3_BIT; |
|
|
|
|
|
|
|
case 1: |
|
|
|
typeBit = EGL_OPENGL_ES_BIT; |
|
|
|
break; |
|
|
|
} |
|
|
|
switch (x.Major) |
|
|
|
{ |
|
|
|
case 2: |
|
|
|
typeBit = EGL_OPENGL_ES2_BIT; |
|
|
|
break; |
|
|
|
|
|
|
|
case 1: |
|
|
|
typeBit = EGL_OPENGL_ES_BIT; |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
return new |
|
|
|
return new |
|
|
|
{ |
|
|
|
Attributes = new[] |
|
|
|
{ |
|
|
|
EGL_CONTEXT_MAJOR_VERSION, x.Major, |
|
|
|
EGL_CONTEXT_MINOR_VERSION, x.Minor, |
|
|
|
EGL_NONE |
|
|
|
}, |
|
|
|
Api = EGL_OPENGL_ES_API, |
|
|
|
RenderableTypeBit = typeBit, |
|
|
|
Version = x |
|
|
|
}; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
Attributes = new[] |
|
|
|
var attrs = (x.Major > 3 || (x.Major == 3 && x.Minor >= 2)) |
|
|
|
? new[] |
|
|
|
{ |
|
|
|
EGL_CONTEXT_MAJOR_VERSION, x.Major, |
|
|
|
EGL_CONTEXT_MINOR_VERSION, x.Minor, |
|
|
|
EGL_CONTEXT_OPENGL_PROFILE_MASK, |
|
|
|
x.IsCompatibilityProfile |
|
|
|
? EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT |
|
|
|
: EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT, |
|
|
|
EGL_NONE |
|
|
|
} |
|
|
|
: new[] |
|
|
|
{ |
|
|
|
EGL_CONTEXT_MAJOR_VERSION, x.Major, |
|
|
|
EGL_CONTEXT_MINOR_VERSION, x.Minor, |
|
|
|
EGL_NONE |
|
|
|
}; |
|
|
|
|
|
|
|
return new |
|
|
|
{ |
|
|
|
EGL_CONTEXT_MAJOR_VERSION, x.Major, |
|
|
|
EGL_CONTEXT_MINOR_VERSION, x.Minor, |
|
|
|
EGL_NONE |
|
|
|
}, |
|
|
|
Api = EGL_OPENGL_ES_API, |
|
|
|
RenderableTypeBit = typeBit, |
|
|
|
Version = x |
|
|
|
}; |
|
|
|
Attributes = attrs, |
|
|
|
Api = EGL_OPENGL_API, |
|
|
|
RenderableTypeBit = EGL_OPENGL_BIT, |
|
|
|
Version = x |
|
|
|
}; |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
foreach (var cfg in cfgs) |
|
|
|
@ -101,7 +131,7 @@ internal static class EglDisplayUtils |
|
|
|
egl.GetConfigAttrib(display, config, EGL_SAMPLES, out var sampleCount); |
|
|
|
egl.GetConfigAttrib(display, config, EGL_STENCIL_SIZE, out var returnedStencilSize); |
|
|
|
return new EglConfigInfo(config, cfg.Version, surfaceType, cfg.Attributes, sampleCount, |
|
|
|
returnedStencilSize); |
|
|
|
returnedStencilSize, cfg.Api); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -119,9 +149,10 @@ internal class EglConfigInfo |
|
|
|
public int[] Attributes { get; } |
|
|
|
public int SampleCount { get; } |
|
|
|
public int StencilSize { get; } |
|
|
|
public int Api { get; } |
|
|
|
|
|
|
|
public EglConfigInfo(IntPtr config, GlVersion version, int surfaceType, int[] attributes, int sampleCount, |
|
|
|
int stencilSize) |
|
|
|
int stencilSize, int api) |
|
|
|
{ |
|
|
|
Config = config; |
|
|
|
Version = version; |
|
|
|
@ -129,5 +160,6 @@ internal class EglConfigInfo |
|
|
|
Attributes = attributes; |
|
|
|
SampleCount = sampleCount; |
|
|
|
StencilSize = stencilSize; |
|
|
|
Api = api; |
|
|
|
} |
|
|
|
} |
|
|
|
|