Skip to content

Commit 1227a3c

Browse files
authored
Add ANGLE to GLFW (#1321)
1 parent ac29e73 commit 1227a3c

File tree

4 files changed

+115
-1
lines changed

4 files changed

+115
-1
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
namespace Silk.NET.GLFW
5+
{
6+
/// <summary>
7+
/// Values for the Initialization Hint AnglePlatformType used in <see cref="InitHint" />
8+
/// which sets the rendering backend when using ANGLE.
9+
/// </summary>
10+
public enum AnglePlatformType
11+
{
12+
/// <summary>
13+
/// No Rendering Backend.
14+
/// </summary>
15+
None = 0x00037001,
16+
17+
/// <summary>
18+
/// Use OpenGL ANGLE Platform Type.
19+
/// </summary>
20+
OpenGL = 0x00037002,
21+
22+
/// <summary>
23+
/// Use OpenGLES ANGLE Platform Type.
24+
/// </summary>
25+
OpenGLES = 0x00037003,
26+
27+
/// <summary>
28+
/// Use Direct3D 9 ANGLE Platform Type.
29+
/// </summary>
30+
D3D9 = 0x00037004,
31+
32+
/// <summary>
33+
/// Use Direct3D 11 ANGLE Platform Type.
34+
/// </summary>
35+
D3D11 = 0x00037005,
36+
37+
/// <summary>
38+
/// Use Vulkan ANGLE Platform Type.
39+
/// </summary>
40+
Vulkan = 0x00037007,
41+
42+
/// <summary>
43+
/// Use Metal (Apple Devices like Mac/iOS, etc) ANGLE Platform Type.
44+
/// </summary>
45+
Metal = 0x00037008
46+
}
47+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
namespace Silk.NET.GLFW
5+
{
6+
/// <summary>
7+
/// Used where the GLFW Library expects GLFW_FALSE and GLFW_TRUE.
8+
/// </summary>
9+
public enum Bool
10+
{
11+
/// <summary>
12+
/// Use where the library would expect GLFW_FALSE.
13+
/// </summary>
14+
False = 0,
15+
16+
/// <summary>
17+
/// Use where the Library would expect GLFW_TRUE.
18+
/// </summary>
19+
True = 1,
20+
}
21+
}

src/Windowing/Silk.NET.GLFW/Enums/InitHint.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,17 @@ public enum InitHint
1717
/// </summary>
1818
JoystickHatButtons = 0x00050001,
1919

20+
/// <summary>
21+
/// Introduced in GLFW 3.4, this enum is used to specify the platform
22+
/// type (rendering backend) to request when using OpenGL ES and EGL via
23+
/// ANGLE. If the requested platform type is unavailable, ANGLE will use
24+
/// its default. Please see <see cref="AnglePlatformType" /> for
25+
/// possible values. The ANGLE platform type is specified via the
26+
/// EGL_ANGLE_platform_angle extension. This extension is not used if
27+
/// this hint is AnglePlatformType.None, which is the default value.
28+
/// </summary>
29+
AnglePlatformType = 0x00050002,
30+
2031
/// <summary>
2132
/// Used to specify whether to set the current directory to the application to the Contents/Resources
2233
/// subdirectory of the application's bundle, if present.
@@ -37,4 +48,4 @@ public enum InitHint
3748
/// </remarks>
3849
CocoaMenubar = 0x00051002
3950
}
40-
}
51+
}

src/Windowing/Silk.NET.GLFW/Glfw.cs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,41 @@ public static void ThrowExceptions()
172172
/// </remarks>
173173
public partial void InitHint(InitHint hint, bool value);
174174

175+
/// <summary>
176+
/// <para>
177+
/// This function sets hints for the next initialization of GLFW.
178+
/// </para>
179+
/// <para>
180+
/// The values you set hints to are never reset by GLFW, but they only take effect during initialization.
181+
/// </para>
182+
/// <para>
183+
/// Once GLFW has been initialized,
184+
/// any values you set will be ignored until the library is terminated and initialized again.
185+
/// </para>
186+
/// <para>
187+
/// Some hints are platform specific.
188+
/// These may be set on any platform but they will only affect their specific platform.
189+
/// Other platforms will ignore them. Setting these hints requires no platform specific headers or functions.
190+
/// </para>
191+
/// </summary>
192+
/// <param name="hint">The <see cref="NET.GLFW.InitHint" /> to set.</param>
193+
/// <param name="value">You may use <see cref="Bool"/> for GL_TRUE
194+
/// and GL_FALSE, <see cref="AnglePlatformType"/> for the
195+
/// AnglePlatformType enum, or any other GLFW supported integer value.
196+
/// </param>
197+
/// <remarks>
198+
/// <para>
199+
/// This function may be called before <see cref="Init" />.
200+
/// </para>
201+
/// <para>
202+
/// This function must only be called from the main thread.
203+
/// </para>
204+
/// <para>
205+
/// Possible errors include <see cref="ErrorCode.InvalidEnum" /> and <see cref="ErrorCode.InvalidValue" />.
206+
/// </para>
207+
/// </remarks>
208+
public partial void InitHint(InitHint hint, int value);
209+
175210
/// <summary>
176211
/// <para>
177212
/// This function retrieves the major, minor and revision numbers of the GLFW library.

0 commit comments

Comments
 (0)