Skip to content

Commit 7a5299e

Browse files
authored
[3.0] Improve handling of Khronos enum native names (#2534)
* Fix incorrect GLEnum native name (and similar); Fix non-ideal native name for certain Vulkan enums * Edit comment * Use uint as the base type for GL-style enums instead of GLenum * Use GLenum/ALenum/ALCenum has the base type and specify C# type in typemap * Improve handling of OpenGL-style bitmask enums * Replace primary constructor of EnumGroup with explicit properties * Fix my incorrect handling of WGL/GLX namespaces * Use cl_bitfield for backing type of OpenCL enums
1 parent 84dd96f commit 7a5299e

21 files changed

Lines changed: 258 additions & 147 deletions

.silktouch/openal-clangsharp.stout

-2 Bytes
Binary file not shown.

.silktouch/opengl-clangsharp.stout

0 Bytes
Binary file not shown.

.silktouch/vulkan-clangsharp.stout

12.6 KB
Binary file not shown.

generator.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@
147147
"SpecPath": "eng/submodules/opengl/xml/gl.xml",
148148
"Namespace": "Silk.NET.OpenGL",
149149
"TypeMap": {
150+
"GLenum": "uint",
150151
"TraceMaskMESA": "uint",
151152
"PathRenderingTokenNV": "byte",
152153
"PathCoordType": "byte"
@@ -252,6 +253,10 @@
252253
"MixKhronosData": {
253254
"SpecPath": "eng/submodules/openal-soft/registry/xml/al.xml",
254255
"Namespace": "Silk.NET.OpenAL",
256+
"TypeMap": {
257+
"ALenum": "uint",
258+
"ALCenum": "uint"
259+
},
255260
"NonStandardExtensionNomenclature": true,
256261
"Vendors": [
257262
"SOFT",

sources/OpenAL/OpenAL/Enums/ALCEnum.gen.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
namespace Silk.NET.OpenAL;
1212

13-
[NativeName("ALCEnum")]
13+
[NativeName("ALCenum")]
1414
public enum ALCEnum : uint
1515
{
1616
[NativeName("ALC_INVALID")]

sources/OpenAL/OpenAL/Enums/ALEnum.gen.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
namespace Silk.NET.OpenAL;
1212

13-
[NativeName("ALEnum")]
13+
[NativeName("ALenum")]
1414
public enum ALEnum : uint
1515
{
1616
[NativeName("AL_NONE")]

sources/OpenGL/OpenGL/Enums/FragmentShaderDestMask.gen.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,18 @@
88
namespace Silk.NET.OpenGL;
99

1010
[NativeName("FragmentShaderDestMaskATI")]
11+
[Flags]
1112
public enum FragmentShaderDestMask : uint
1213
{
1314
[NativeName("GL_NONE")]
14-
None = 0,
15+
None = 0x0,
1516

1617
[NativeName("GL_RED_BIT_ATI")]
17-
RedBitATI = 1,
18+
RedBitATI = 0x1,
1819

1920
[NativeName("GL_GREEN_BIT_ATI")]
20-
GreenBitATI = 2,
21+
GreenBitATI = 0x2,
2122

2223
[NativeName("GL_BLUE_BIT_ATI")]
23-
BlueBitATI = 4,
24+
BlueBitATI = 0x4,
2425
}

sources/OpenGL/OpenGL/Enums/FragmentShaderDestModMask.gen.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,30 @@
88
namespace Silk.NET.OpenGL;
99

1010
[NativeName("FragmentShaderDestModMaskATI")]
11+
[Flags]
1112
public enum FragmentShaderDestModMask : uint
1213
{
1314
[NativeName("GL_NONE")]
14-
None = 0,
15+
None = 0x0,
1516

1617
[NativeName("GL_2X_BIT_ATI")]
17-
X2XBitATI = 1,
18+
X2XBitATI = 0x1,
1819

1920
[NativeName("GL_4X_BIT_ATI")]
20-
X4XBitATI = 2,
21+
X4XBitATI = 0x2,
2122

2223
[NativeName("GL_8X_BIT_ATI")]
23-
X8XBitATI = 4,
24+
X8XBitATI = 0x4,
2425

2526
[NativeName("GL_HALF_BIT_ATI")]
26-
HalfBitATI = 8,
27+
HalfBitATI = 0x8,
2728

2829
[NativeName("GL_QUARTER_BIT_ATI")]
29-
QuarterBitATI = 16,
30+
QuarterBitATI = 0x10,
3031

3132
[NativeName("GL_EIGHTH_BIT_ATI")]
32-
EighthBitATI = 32,
33+
EighthBitATI = 0x20,
3334

3435
[NativeName("GL_SATURATE_BIT_ATI")]
35-
SaturateBitATI = 64,
36+
SaturateBitATI = 0x40,
3637
}

sources/OpenGL/OpenGL/Enums/GLEnum.gen.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
namespace Silk.NET.OpenGL;
99

10-
[NativeName("GLEnum")]
10+
[NativeName("GLenum")]
1111
public enum GLEnum : uint
1212
{
1313
[NativeName("GL_DEPTH_BUFFER_BIT")]

sources/OpenGL/OpenGL/Enums/PathFontStyle.gen.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@
88
namespace Silk.NET.OpenGL;
99

1010
[NativeName("PathFontStyle")]
11+
[Flags]
1112
public enum PathFontStyle : uint
1213
{
1314
[NativeName("GL_NONE")]
14-
None = 0,
15+
None = 0x0,
1516

1617
[NativeName("GL_BOLD_BIT_NV")]
17-
BoldBitNV = 1,
18+
BoldBitNV = 0x1,
1819

1920
[NativeName("GL_ITALIC_BIT_NV")]
20-
ItalicBitNV = 2,
21+
ItalicBitNV = 0x2,
2122
}

0 commit comments

Comments
 (0)