Use existing ANGLE definitions

This commit is contained in:
Jonas Boesch 2016-01-06 15:29:34 +01:00 committed by Manuel Zanin
parent 84a210bda5
commit fc33246600
4 changed files with 20 additions and 56 deletions

View file

@ -1,42 +0,0 @@
using System;
using System.Runtime.InteropServices;
namespace OpenTK.Platform.Egl
{
using EGLDisplay = IntPtr;
using EGLNativeDisplayType = IntPtr;
using EGLSurface = IntPtr;
using ShareHandle = IntPtr;
static partial class Egl
{
// See
// - ANGLE_platform_angle
// - ANGLE_platform_angle_d3d
// - ANGLE_platform_angle_opengl
public const int PLATFORM_ANGLE = 0x3202;
public const int PLATFORM_ANGLE_TYPE = 0x3203;
public const int PLATFORM_ANGLE_MAX_VERSION_MAJOR = 0x3204;
public const int PLATFORM_ANGLE_MAX_VERSION_MINOR = 0x3205;
public const int PLATFORM_ANGLE_TYPE_DEFAULT = 0x3206;
public const int PLATFORM_ANGLE_TYPE_D3D9 = 0x3207;
public const int PLATFORM_ANGLE_TYPE_D3D11 = 0x3208;
public const int PLATFORM_ANGLE_DEVICE_TYPE = 0x3209;
public const int PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE = 0x320A;
public const int PLATFORM_ANGLE_DEVICE_TYPE_WARP = 0x320B;
public const int PLATFORM_ANGLE_DEVICE_TYPE_REFERENCE = 0x320C;
public const int PLATFORM_ANGLE_TYPE_OPENGL = 0x320D;
public const int PLATFORM_ANGLE_TYPE_OPENGLES = 0x320E;
// See EGL_ANGLE_surface_d3d_texture_2d_share_handle
public const int EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE = 0x3200;
[DllImport("libEGL.dll", EntryPoint = "eglGetPlatformDisplayEXT")]
public static extern EGLDisplay GetPlatformDisplay(int platform, EGLNativeDisplayType display_id,
int[] attrib_list);
[DllImport("libEGL.dll", EntryPoint = "eglQuerySurfacePointerANGLE")]
public static extern bool QuerySurfacePointerANGLE(EGLDisplay display, EGLSurface surface,
int attribute, out IntPtr value);
}
}

View file

@ -120,32 +120,32 @@ namespace OpenTK.Platform.Egl
{
// default to D3D9 for ES2, but use D3D11 for ES3 as required by Angle.
var platform_type = major == 2
? Platform.Egl.Egl.PLATFORM_ANGLE_TYPE_D3D9
: Platform.Egl.Egl.PLATFORM_ANGLE_TYPE_D3D11;
? Platform.Egl.Egl.PLATFORM_ANGLE_TYPE_D3D9_ANGLE
: Platform.Egl.Egl.PLATFORM_ANGLE_TYPE_D3D11_ANGLE;
if (FlagEnabled(flags, GraphicsContextFlags.AngleD3D11))
{
platform_type = Platform.Egl.Egl.PLATFORM_ANGLE_TYPE_D3D11;
platform_type = Platform.Egl.Egl.PLATFORM_ANGLE_TYPE_D3D11_ANGLE;
}
else if (FlagEnabled(flags, GraphicsContextFlags.AngleD3D9))
{
platform_type = Platform.Egl.Egl.PLATFORM_ANGLE_TYPE_D3D9;
platform_type = Platform.Egl.Egl.PLATFORM_ANGLE_TYPE_D3D9_ANGLE;
}
else if (FlagEnabled(flags, GraphicsContextFlags.AngleOpenGL))
{
platform_type = Platform.Egl.Egl.PLATFORM_ANGLE_TYPE_OPENGL;
platform_type = Platform.Egl.Egl.PLATFORM_ANGLE_TYPE_OPENGL_ANGLE;
}
else
{
// make sure the correct flag is set.
switch (platform_type)
{
case Platform.Egl.Egl.PLATFORM_ANGLE_TYPE_D3D9:
case Platform.Egl.Egl.PLATFORM_ANGLE_TYPE_D3D9_ANGLE:
flags |= GraphicsContextFlags.AngleD3D9;
break;
case Platform.Egl.Egl.PLATFORM_ANGLE_TYPE_D3D11:
case Platform.Egl.Egl.PLATFORM_ANGLE_TYPE_D3D11_ANGLE:
flags |= GraphicsContextFlags.AngleD3D11;
break;
case Platform.Egl.Egl.PLATFORM_ANGLE_TYPE_OPENGL:
case Platform.Egl.Egl.PLATFORM_ANGLE_TYPE_OPENGL_ANGLE:
flags |= GraphicsContextFlags.AngleOpenGL;
break;
}
@ -153,15 +153,15 @@ namespace OpenTK.Platform.Egl
var attribs = new[]
{
Platform.Egl.Egl.PLATFORM_ANGLE_TYPE, platform_type,
Platform.Egl.Egl.PLATFORM_ANGLE_MAX_VERSION_MAJOR, Platform.Egl.Egl.DONT_CARE,
Platform.Egl.Egl.PLATFORM_ANGLE_MAX_VERSION_MINOR, Platform.Egl.Egl.DONT_CARE,
Platform.Egl.Egl.PLATFORM_ANGLE_DEVICE_TYPE, Platform.Egl.Egl.PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE,
Platform.Egl.Egl.PLATFORM_ANGLE_TYPE_ANGLE, platform_type,
Platform.Egl.Egl.PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE, Platform.Egl.Egl.DONT_CARE,
Platform.Egl.Egl.PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE, Platform.Egl.Egl.DONT_CARE,
Platform.Egl.Egl.PLATFORM_ANGLE_DEVICE_TYPE_ANGLE, Platform.Egl.Egl.PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE,
Platform.Egl.Egl.NONE
};
return Platform.Egl.Egl.GetPlatformDisplay(
Platform.Egl.Egl.PLATFORM_ANGLE,
Platform.Egl.Egl.PLATFORM_ANGLE_ANGLE,
dc,
attribs
);

View file

@ -135,7 +135,6 @@
<Compile Include="Platform\DisplayDeviceBase.cs" />
<Compile Include="Platform\Egl\AngleWindowInfo.cs" />
<Compile Include="Platform\Egl\EglException.cs" />
<Compile Include="Platform\Egl\EglAngle.cs" />
<Compile Include="Platform\Egl\EglUnixContext.cs" />
<Compile Include="Platform\Egl\EglWinContext.cs" />
<Compile Include="Platform\Egl\EglAnglePlatformFactory.cs" />

View file

@ -210,6 +210,11 @@ namespace OpenTK.Platform.Egl
// EGL_ANGLE_query_surface_pointer
[DllImport("libEGL.dll", EntryPoint = "eglQuerySurfacePointerANGLE")]
public static extern bool QuerySurfacePointerANGLE(EGLDisplay display, EGLSurface surface, int attribute, out IntPtr value);
[DllImport("libEGL.dll", EntryPoint = "eglGetPlatformDisplayEXT")]
public static extern EGLDisplay GetPlatformDisplay(int platform, EGLNativeDisplayType display_id,
int[] attrib_list);
// EGL_ANGLE_software_display
public static readonly EGLNativeDisplayType SOFTWARE_DISPLAY_ANGLE = new EGLNativeDisplayType(-1);
// EGL_ANGLE_direct3d_display
@ -235,6 +240,8 @@ namespace OpenTK.Platform.Egl
// EGL_ANGLE_platform_angle_opengl
public const int PLATFORM_ANGLE_TYPE_OPENGL_ANGLE = 0x320D;
public const int PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE = 0x320E;
// See EGL_ANGLE_surface_d3d_texture_2d_share_handle
public const int EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE = 0x3200;
[DllImportAttribute("libEGL.dll", EntryPoint = "eglGetError")]
public static extern ErrorCode GetError();