Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
169 commits
Select commit Hold shift + click to select a range
75ee80f
Start of khronos-bindings branch
Exanite Jun 11, 2026
c0ec96a
Add initial set of required submodules
Exanite Jun 12, 2026
2b7e239
Explain that the API-Specific Notes sections may be empty
Exanite Jun 12, 2026
39f5e07
Change OpenXR XML spec link in docs
Exanite Jun 12, 2026
c90d3ec
Set new submodules to use their latest tagged commit
Exanite Jun 12, 2026
0c27aa5
Update existing Khronos submodules
Exanite Jun 12, 2026
90e3292
Regenerate OpenAL on Linux after updating submodule
Exanite Jun 12, 2026
214f330
Regenerate OpenGL on Linux after updating submodule
Exanite Jun 12, 2026
799917a
Regenerate Vulkan on Linux after updating submodule
Exanite Jun 12, 2026
8b050e2
Add prefix override for VkImageCreateFlags2KHR
Exanite Jun 12, 2026
8cd91a0
Cleanup XML spec links in docs
Exanite Jun 12, 2026
a9f490b
Update Vulkan copyright year
Exanite Jun 14, 2026
04edaf7
Regenerate Vulkan on Linux after updating header copyright year
Exanite Jun 14, 2026
d9dc9e4
Add OpenXR to API notes and reorganize so that Khronos-like bindings …
Exanite Jun 14, 2026
126dd9e
Add initial OpenXR .rsp files
Exanite Jun 14, 2026
8648911
Add OpenXR to generator.json
Exanite Jun 14, 2026
d048c9b
Add Initial Project Creation section to Using the Generator docs
Exanite Jun 14, 2026
344bcf3
Create initial OpenXR .csproj file
Exanite Jun 14, 2026
4f35e5e
Fix formatting of solution file (oops)
Exanite Jun 14, 2026
b43f072
Configure IdentifySharedPrefixes for OpenXR
Exanite Jun 14, 2026
3cd7ebe
Configure TransformEnums for OpenXR
Exanite Jun 14, 2026
437db8d
Add naive symbol resolution to MetadataUtils.GetTypeDetails to fix Op…
Exanite Jun 15, 2026
5105bed
Update OpenXR API notes
Exanite Jun 15, 2026
469abc4
Regenerate OpenXR on Linux to create initial bindings
Exanite Jun 15, 2026
6e7fd33
Rename Khronos submodules so that they use the full name of the repo
Exanite Jun 15, 2026
594080d
Add opencl-headers submodule
Exanite Jun 15, 2026
4f2b751
Add section for OpenCL in API notes
Exanite Jun 15, 2026
218207a
Add response files for OpenCL
Exanite Jun 15, 2026
07a8db0
Create project for OpenCL
Exanite Jun 15, 2026
954885b
Add OpenCL SilkTouch configuration
Exanite Jun 15, 2026
103e5e2
Fix OpenCL include path
Exanite Jun 15, 2026
9ca5baa
Change opencl-headers submodule to point to latest tag
Exanite Jun 15, 2026
c8d6473
Add information about CL_TARGET_OPENCL_VERSION warning to API notes
Exanite Jun 15, 2026
f37f390
Enable -Wno-invalid-constexpr for OpenCL
Exanite Jun 15, 2026
4d50c8b
Regenerate OpenCL on Linux to create initial bindings
Exanite Jun 15, 2026
ce57a5d
Disable IdentifyFunctionDataTypes and IdentifyEnumTypeNonExclusiveVen…
Exanite Jun 15, 2026
399c4b6
Update vendor suffix identification (but not preservation/prettificat…
Exanite Jun 15, 2026
e8cc43e
Regenerate OpenCL on Linux for vendor suffix identification fix (not …
Exanite Jun 15, 2026
cef0c36
Clarify that non `.gen.cs` files are not modified
Exanite Jun 17, 2026
2281a07
Add ReapplyAffixesProcessor tests (indirect)
Exanite Jun 17, 2026
06432f0
Add option to capitalize name affixes
Exanite Jun 17, 2026
70fbcc2
Enable Capitalize for OpenCL KhronosVendor suffixes
Exanite Jun 17, 2026
7019668
Regenerate OpenCL on Linux for capitalize KhronosVendor change
Exanite Jun 17, 2026
9452f4c
Replace EndingsNotToTrim with EndingsToNotIdentifyInto
Exanite Jun 18, 2026
743d87f
Update vendor suffix identification to use CanIdentifySuffix
Exanite Jun 18, 2026
458f2d0
Regenerate OpenCL on Linux for ContEXT fix
Exanite Jun 18, 2026
8d43965
Fix unwanted change in OpenGL bindings caused by EndingsToNotIdentify…
Exanite Jun 18, 2026
543bc0d
Also include cl_ext.h
Exanite Jun 18, 2026
6c76aa3
Regenerate OpenCL on Linux after including cl_ext.h
Exanite Jun 18, 2026
b9c7357
Add _cl as a global prefix hint for OpenCL
Exanite Jun 18, 2026
09e05cd
Regenerate OpenCL on Linux after adding _cl as global prefix hint
Exanite Jun 18, 2026
b9d13f7
Rename variable to not collide with C# keyword
Exanite Jun 19, 2026
5ebc2b4
Add typemappings for OpenCL enum base types
Exanite Jun 19, 2026
602bb15
Rework how OpenCL enum type nodes are parsed
Exanite Jun 19, 2026
8cd4aee
Fix issue where we were losing enum base type information for OpenCL
Exanite Jun 19, 2026
83f8dae
Rename VendorFromString to VendorFromName and add docs
Exanite Jun 19, 2026
f364dce
Move FixupGroupNameForOpenCL out of ReadGroups
Exanite Jun 19, 2026
d6127c5
Add docs on ReadGroups helper methods
Exanite Jun 19, 2026
5f06eb3
Edit doc comment wording for MixKhronosData ReadGroups helpers
Exanite Jun 20, 2026
e6513ec
Add base type for ErrorCodes enum
Exanite Jun 20, 2026
873cf4d
Regenerate OpenCL on Linux for ErrorCodes change
Exanite Jun 20, 2026
bc9fa21
Manually add base types for all remaining OpenCL enums
Exanite Jun 20, 2026
bf5e04f
Add OpenCL to solution
Exanite Jun 20, 2026
25760d4
Regenerate OpenCL on Linux after defining enum base types
Exanite Jun 20, 2026
0b258d5
Typemap intptr_t to long for OpenCL (see commit description)
Exanite Jun 20, 2026
dad0bb3
Regenerate OpenCL on Linux for intptr_t change
Exanite Jun 20, 2026
3dd831a
Trim whitespace from non-namespaced enum names to handle OpenCL enum …
Exanite Jun 20, 2026
6c57b54
Expand OpenCL ErrorCodes handling to apply for all enums with block n…
Exanite Jun 20, 2026
1b12b1f
Regenerate OpenCL on Linux for block number trimming change
Exanite Jun 20, 2026
4f1fbdb
Add NativeName attribute to structs generated by AddOpaqueStructs
Exanite Jun 20, 2026
6b52711
Regenerate OpenGL on Linux for AddOpaqueStructs change
Exanite Jun 20, 2026
77a5751
Add AddOpaqueStructs to OpenCL config
Exanite Jun 20, 2026
dfc1156
Regenerate OpenCL on Linux for AddOpaqueStructs change
Exanite Jun 20, 2026
1f340d4
Restore ErrorCodes block in FixupGroupNameForOpenCL since it's needed…
Exanite Jun 20, 2026
34bd454
Add TransformHandles mod to OpenGL and OpenCL
Exanite Jun 20, 2026
33f7de7
Regenerate OpenCL on Linux for TransformHandles change
Exanite Jun 20, 2026
2ff8d92
Regenerate OpenGL on Linux for TransformHandles change
Exanite Jun 20, 2026
83583e2
Fix TransformHandles overwriting existing attributes
Exanite Jun 20, 2026
a335738
Fix ExtractHandles not adding the NativeName attribute to generated s…
Exanite Jun 20, 2026
825f61d
Change OpenCL to use ExtractHandles instead of AddOpaqueStructs
Exanite Jun 20, 2026
4778525
Regenerate OpenCL on Linux due to handle type changes
Exanite Jun 20, 2026
0e5d2bd
Exclude XR_NULL_HANDLE
Exanite Jun 20, 2026
195b066
Regenerate OpenXR on Linux for XR_NULL_HANDLE change
Exanite Jun 20, 2026
d7749c9
Clarify MixKhronosData FlagsTypes remark comment
Exanite Jun 21, 2026
b812ae2
Add constants for the name affixes used by MixKhronosData
Exanite Jun 21, 2026
236e5ae
Change NativeName for ErrorCodes to be "ErrorCodes" instead of "Error…
Exanite Jun 21, 2026
9bcd801
Regenerate OpenCL on Linux for ErrorCodes NativeName change
Exanite Jun 21, 2026
d9a2461
Change GetMissingEnums to use the native name when typemapping
Exanite Jun 21, 2026
60c0233
Potentially controversial: Cleanup OpenCL names that have the format …
Exanite Jun 21, 2026
cd6708e
Regenerate OpenCL on Linux after OpenCL enum name cleanup*
Exanite Jun 21, 2026
dde45c7
Add todo for changing the Groups dictionary to be keyed by native nam…
Exanite Jun 21, 2026
dbf8930
Change enum vendor suffix identification to consistently always use t…
Exanite Jun 21, 2026
ec2e58a
Regenerate OpenCL on Linux after fixing vendor suffix identification …
Exanite Jun 21, 2026
4c8ff36
Undo the Vulkan header change since it makes review tedious
Exanite Jun 21, 2026
ccd32fe
Regenerate Vulkan on Linux for header change
Exanite Jun 21, 2026
9b4be6d
Rename Khronos-like Bindings section to be just for Khronos Bindings
Exanite Jun 21, 2026
0e3c0a6
Add doc section on how to run the generator
Exanite Jun 21, 2026
5e05860
Fix extra space in SkipOption description
Exanite Jun 21, 2026
f3323db
Cleanup VendorFromEnumName
Exanite Jun 21, 2026
affe7e6
Don't merge cl_intel_advanced_motion_estimation.cl_motion_detect_desc…
Exanite Jun 21, 2026
c41ef07
Regenerate OpenCL on Linux for block merging change
Exanite Jun 21, 2026
f485f16
Change RewriterPhase1 to track native names instead of managed names
Exanite Jun 21, 2026
42ae407
Add OpenCL and XR to the changelog
Exanite Jun 21, 2026
a4870cc
Update native binaries for 42ae407cff8630ac331877f9ccb6490e7ceb1e2f
dotnet-bot Jun 21, 2026
8a863ee
Clarify comment for OpenCL group name processing
Exanite Jun 23, 2026
eb13ab1
Add info about nuget.config file to experimental feed docs
Exanite Jun 23, 2026
2264796
Format Vk.cs (was written before I had CSharpier configured)
Exanite Jun 23, 2026
3a45b31
Remove duplicate RegisterHook call in Vk (hack)
Exanite Jun 23, 2026
78419a4
Implement Xr.cs
Exanite Jun 23, 2026
6934dd8
Update opencl-docs submodule for trailing space fix
Exanite Jun 24, 2026
8472b84
Regenerate OpenCL on Linux after trailing space fix and submodule update
Exanite Jun 24, 2026
6d667ba
Improve document rename collision detection to account for casing dif…
Exanite Jun 24, 2026
9915fd2
Edit path collision error message
Exanite Jun 24, 2026
d9e688d
Document ClangScraper handling of C long
Exanite Jul 5, 2026
9d93bf8
Also link to ClangSharp's README in Using the Generator docs
Exanite Jul 16, 2026
9195af6
Update opencl-docs submodule
Exanite Jul 16, 2026
62ae9ed
Regenerate OpenCL on Linux after updating submodule
Exanite Jul 16, 2026
8a521bd
Update ClangSharp.PInvokeGenerator
Exanite Jul 16, 2026
482b793
Regenerate OpenCL on Linux after updating ClangSharp
Exanite Jul 16, 2026
4a1cc34
Document why DllImport is used over LibraryImport
Exanite Jul 23, 2026
ff526d1
Implement Cl.cs
Exanite Jul 23, 2026
967951c
Edit OpenCL AddVTables.ThisThread settings
Exanite Jul 23, 2026
0ab7050
Regenerate OpenCL on Linux after modifying AddVTables settings
Exanite Jul 23, 2026
c16bb23
Update Cl.cs to work with new AddVTables settings
Exanite Jul 23, 2026
02c317a
Remove duplicate RegisterHook call in OpenCL/XR
Exanite Jul 23, 2026
f81ce5c
Register alternative library names for OpenCL
Exanite Jul 23, 2026
a55d8f6
Add OpenCL.Tutorial001.SimpleKernel project
Exanite Jul 23, 2026
b370926
Fix index out of bounds error
Exanite Jul 24, 2026
cafb03a
Add ExtractNestedTypes and ExtractFunctionPointers to OpenCL mod order
Exanite Jul 24, 2026
125ac02
Regenerate OpenCL on Linux after adding ExtractNestedTypes and Extrac…
Exanite Jul 24, 2026
a52e249
Remove resolved todos in OpenCL Tutorial001
Exanite Jul 24, 2026
0576d64
Add the underscore back to extracted struct names
Exanite Jul 24, 2026
9a246ad
Accept changes to OpenCL MixKhronosData snapshots
Exanite Jul 24, 2026
916ef7a
Accept changes to Extract/TransformHandlesTests snapshots
Exanite Jul 24, 2026
52d4be3
Fix IdentifiesNamespaceEnumPrefix test case by handling native and ma…
Exanite Jul 24, 2026
b416790
Document that we prefer the Flags version of the name for Flags/FlagB…
Exanite Jul 25, 2026
df6b0ad
Rework MixKhronosData to identify enums by native names and prefer Fl…
Exanite Jul 25, 2026
5df8efa
Update MixKhronosData parsing test cases now that groups are keyed by…
Exanite Jul 25, 2026
c274ed3
Fix typo
Exanite Jul 25, 2026
89d39b3
Add LocationTransformationTests and fix method group reference not ge…
Exanite Jul 25, 2026
3c4ef0b
Add support for handling qualified referenced name affixes to NameAff…
Exanite Jul 25, 2026
11ce725
Add support for qualified referenced affixes
Exanite Jul 25, 2026
397a382
Add NameAffix referenced affixes for the extracted function pointer s…
Exanite Jul 25, 2026
c7d7887
Update name processing docs to reflect that qualified name affix refe…
Exanite Jul 27, 2026
ee4cb8f
Add FunctionPointerNameFallbackParent to ExtractFunctionPointers mod …
Exanite Jul 27, 2026
4830f9b
Remove prefix trimming todos
Exanite Jul 28, 2026
0775657
Fall back to DefaultNativeContext for loading OpenCL functions
Exanite Jul 28, 2026
fd27c00
Add todo about how ICl should be disposable
Exanite Jul 28, 2026
18484c8
Add todo for potentially exposing INativeContext
Exanite Jul 28, 2026
f9ca5cb
Add todo for potentially returning the concrete API object type inste…
Exanite Jul 28, 2026
ffbc7e7
Silk 2 overrides DeviceInfo and ContextProperties, so this ports them…
Exanite Jul 29, 2026
e8b502e
Add a few more OpenCL headers to generation process
Exanite Jul 29, 2026
08f7eef
Add todo for discussing INativeContext.LoadFunction
Exanite Jul 29, 2026
7db48ef
Merge branch 'develop/3.0' into feature/khronos-bindings
Exanite Jul 29, 2026
9540214
Regenerate all except Core/Microsoft on Windows
Exanite Jul 29, 2026
0e4fe4c
Add ALTERA as OpenCL vendor suffix
Exanite Jul 30, 2026
9b87bea
Regenerate OpenCL on Windows for ALTERA vendor suffix
Exanite Jul 30, 2026
2df3f4a
Add prefix overrides for cl_context_properties and cl_device_integer_…
Exanite Jul 30, 2026
6fb7882
Note that OpenXR is not usable yet
Exanite Jul 30, 2026
c46c76d
Fix bad grammar
Exanite Jul 30, 2026
4bb176d
Remove todo
Exanite Jul 30, 2026
8e50bd4
Disable ExtractEnumConstants for OpenXR and Vulkan
Exanite Jul 30, 2026
1f18c07
Regenerate OpenXR, Vulkan bindings on Windows for ExtractEnumConstant…
Exanite Jul 30, 2026
8830a7c
Remove recommendation about including all Extract- mods together
Exanite Jul 30, 2026
b1b0edd
Add prefix override for XrPerfSettingsNotificationLevelEXT
Exanite Jul 31, 2026
d4be857
Add prefix override for XrSceneMarkerQRCodeSymbolTypeMSFT
Exanite Jul 31, 2026
485b0ab
Add prefix override for XrStructureType
Exanite Jul 31, 2026
6049916
Manually add cast to Xr.gen.cs
Exanite Jul 31, 2026
58b01a3
Add todo marking manual cast in Xr.gen.cs
Exanite Aug 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
48 changes: 42 additions & 6 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[submodule "submodules/terrafx.interop.windows"]
path = eng/submodules/terrafx.interop.windows
url = https://github.com/terrafx/terrafx.interop.windows
[submodule "eng/submodules/opengl"]
path = eng/submodules/opengl
[submodule "eng/submodules/opengl-registry"]
path = eng/submodules/opengl-registry
url = https://github.com/KhronosGroup/OpenGL-Registry.git
[submodule "eng/submodules/egl"]
path = eng/submodules/egl
[submodule "eng/submodules/egl-registry"]
path = eng/submodules/egl-registry
url = https://github.com/KhronosGroup/EGL-Registry/
[submodule "eng/submodules/sdl"]
path = eng/submodules/sdl
Expand All @@ -16,9 +16,45 @@
[submodule "eng/submodules/openal-soft"]
path = eng/submodules/openal-soft
url = https://github.com/kcat/openal-soft
[submodule "eng/submodules/vulkan"]
path = eng/submodules/vulkan
[submodule "eng/submodules/vulkan-docs"]
path = eng/submodules/vulkan-docs
url = https://github.com/KhronosGroup/Vulkan-Docs.git
[submodule "eng/submodules/vulkan-headers"]
path = eng/submodules/vulkan-headers
url = https://github.com/KhronosGroup/Vulkan-Headers.git
[submodule "eng/submodules/assimp"]
path = eng/submodules/assimp
url = https://github.com/assimp/assimp
[submodule "eng/submodules/spirv-tools"]
path = eng/submodules/spirv-tools
url = https://github.com/KhronosGroup/SPIRV-Tools
[submodule "eng/submodules/spirv-reflect"]
path = eng/submodules/spirv-reflect
url = https://github.com/KhronosGroup/SPIRV-Reflect.git
[submodule "eng/submodules/spirv-headers"]
path = eng/submodules/spirv-headers
url = https://github.com/KhronosGroup/SPIRV-Headers
[submodule "eng/submodules/spirv-cross"]
path = eng/submodules/spirv-cross
url = https://github.com/KhronosGroup/SPIRV-Cross
[submodule "eng/submodules/shaderc"]
path = eng/submodules/shaderc
url = https://github.com/google/shaderc
[submodule "eng/submodules/moltenvk"]
path = eng/submodules/moltenvk
url = https://github.com/KhronosGroup/MoltenVK
[submodule "eng/submodules/vulkan-memory-allocator"]
path = eng/submodules/vulkan-memory-allocator
url = https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git
[submodule "eng/submodules/glslang"]
path = eng/submodules/glslang
url = https://github.com/KhronosGroup/glslang.git
[submodule "eng/submodules/openxr-sdk"]
path = eng/submodules/openxr-sdk
url = https://github.com/KhronosGroup/OpenXR-SDK.git
[submodule "eng/submodules/opencl-docs"]
path = eng/submodules/opencl-docs
url = https://github.com/KhronosGroup/OpenCL-Docs.git
[submodule "eng/submodules/opencl-headers"]
path = eng/submodules/opencl-headers
url = https://github.com/KhronosGroup/OpenCL-Headers.git
Binary file added .silktouch/opencl-clangsharp.stout
Binary file not shown.
Binary file added .silktouch/openxr-clangsharp.stout
Binary file not shown.
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<!-- Analyzers -->
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="5.3.0" />
<!-- SilkTouch -->
<PackageVersion Include="ClangSharp.PInvokeGenerator" Version="21.1.8.3" />
<PackageVersion Include="ClangSharp.PInvokeGenerator" Version="21.1.8.4" />
<PackageVersion Include="CSharpier.Core" Version="1.3.0" />
<PackageVersion Include="Humanizer.Core" Version="2.14.1" />
<PackageVersion Include="Microsoft.Build.Locator" Version="1.11.2" />
Expand Down
9 changes: 9 additions & 0 deletions Silk.NET.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
<Folder Name="/examples/CSharp/OpenAL/">
<Project Path="examples/CSharp/OpenAL/Tutorial001.HelloSound/OpenAL.Tutorial001.HelloSound.csproj" />
</Folder>
<Folder Name="/examples/CSharp/OpenCL/">
<Project Path="examples/CSharp/OpenCL/Tutorial001.SimpleKernel/OpenCL.Tutorial001.SimpleKernel.csproj" />
</Folder>
<Folder Name="/examples/CSharp/SDL/">
<Project Path="examples/CSharp/SDL/Tutorial001.HelloWindow/SDL.Tutorial001.HelloWindow.csproj" />
</Folder>
Expand Down Expand Up @@ -54,9 +57,15 @@
<Project Path="sources/OpenAL/OpenAL/Silk.NET.OpenAL.csproj" />
<Project Path="sources/OpenAL/Soft.Native/Silk.NET.OpenAL.Soft.Native.csproj" />
</Folder>
<Folder Name="/sources/OpenCL/">
<Project Path="sources/OpenCL/OpenCL/Silk.NET.OpenCL.csproj" />
</Folder>
<Folder Name="/sources/OpenGL/">
<Project Path="sources/OpenGL/OpenGL/Silk.NET.OpenGL.csproj" />
</Folder>
<Folder Name="/sources/OpenXR/">
<Project Path="sources/OpenXR/OpenXR/Silk.NET.OpenXR.csproj" />
</Folder>
<Folder Name="/sources/SDL/">
<Project Path="sources/SDL/Native/Silk.NET.SDL.Native.csproj" />
<Project Path="sources/SDL/SDL/Silk.NET.SDL.csproj" />
Expand Down
2 changes: 2 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Silk.NET 3.0 Preview 1

- Added combined OpenGL bindings using the 3.0 bindings style.
- Added OpenAL bindings using the 3.0 bindings style.
- Added OpenCL bindings using the 3.0 bindings style.
- Added OpenXR bindings using the 3.0 bindings style (needs more work to be usable).
- Added SDL3 bindings using the 3.0 bindings style.
- Added Vulkan bindings using the 3.0 bindings style.
- Improved the bindings style to be more accessible, IDE-friendly, and AOT-friendly. Learn more at **TODO ADD A LINK TO DOCUMENTATION HERE**.
Expand Down
64 changes: 57 additions & 7 deletions docs/for-contributors/Generator/api-specific-notes.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,73 @@
# API-Specific Notes

This document's purpose is to note down any decisions or quirks that are specific to a library that Silk is generating
bindings for.
bindings for. It is fine for a section to be empty if we do not have any notes specific to that library.

This is meant to be a living document. Please update this as new work is being done on the generator.

## OpenAL
Certain APIs are grouped together because they share similar characteristics.

Currently empty.
## C Bindings

These are APIs that can be categorized as being straightforward C APIs or are C APIs that simply do not share
characteristics with other bindings.

## OpenGL
### SDL

Currently empty.

## SDL
## Khronos Bindings

Currently empty.
These are APIs managed either by Khronos or APIs managed in a similar way to the official Khronos APIs.
These use the `MixKhronosData` mod and come with an XML spec.

Be aware that the XML spec links point to the latest version. Silk's repo may be using an older version of these XML
files.

---

For APIs that use the `Flags/FlagBits` pattern, the `Flags` version of the name is use for both the native name and
managed name. This is because the XML data uses the `Flags` version to provide base type data. There was a time where
we preferred the `FlagBits` version instead for the `[NativeName]` attribute. This is because searching for the
`FlagBits` version online brings up a more useful documentation page.

### OpenAL

Spec file used: https://raw.githubusercontent.com/kcat/openal-soft/master/registry/xml/al.xml

### OpenCL

Spec file used: https://raw.githubusercontent.com/KhronosGroup/OpenCL-Docs/main/xml/cl.xml

The following warning is expected since we do not want to hardcode the version in our entrypoint header:

```
warning: cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 310 (OpenCL 3.1) [-W#pragma-messages]
```

### OpenGL

Spec file used: https://raw.githubusercontent.com/KhronosGroup/OpenGL-Registry/main/xml/gl.xml

### OpenXR

Spec file used: https://raw.githubusercontent.com/KhronosGroup/OpenXR-SDK/main/specification/registry/xr.xml

There will be the following errors in the generation log. This is expected. These types are part of the XML
specification, but not part of the main `openxr.h` header.

API Constants shows up here, but not in Vulkan because OpenXR's XML lacks the `type="constants"` attribute that
Vulkan's XML has.

```
fail: Silk.NET.SilkTouch.Mods.MixKhronosData[0] Enum "API Constants" has no base type. Please add TypeMap entry to the configuration. This enum group will be skipped.
fail: Silk.NET.SilkTouch.Mods.MixKhronosData[0] Enum "XrAndroidThreadTypeKHR" has no base type. Please add TypeMap entry to the configuration. This enum group will be skipped.
fail: Silk.NET.SilkTouch.Mods.MixKhronosData[0] Enum "XrLoaderInterfaceStructs" has no base type. Please add TypeMap entry to the configuration. This enum group will be skipped.
```

### Vulkan

## Vulkan
Spec file used: https://raw.githubusercontent.com/KhronosGroup/Vulkan-Docs/main/xml/vk.xml

There will be the following errors in the generation log. This is expected. These types are part of the XML
specification, but not part of the main `vulkan.h` header.
Expand Down
49 changes: 23 additions & 26 deletions docs/for-contributors/Generator/generator-mods.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ Stateless APIs are typically accessed through static methods, while stateful API
objects. More information on this can be found in the
[Static vs Instance Bindings](../../silk.net/static-vs-instance-bindings.md) document.

`[DllImport]` is used over `[LibraryImport]` because `[LibraryImport]`'s source generator ends up using `[DllImport]`
in its generated code.

Usage recommendations:

(TODO: To be added)
Expand Down Expand Up @@ -170,6 +173,9 @@ provide cross-platform bindings.
- Enums use `uint` as their backing type on Linux instead of `int` like on Windows. Silk handles this by using
`TransformEnums` to "coerce" the backing types to their Windows equivalents when possible.

- C `long` is output as C# `long` on Windows and C# `nint` on Linux. Silk handles this by generating bindings on Windows

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't support 32 bit right?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Silk.NET 2.X made an explicit choice that 32-bit support was on a "best effort" basis. We never tried to explicitly not support 32-bit, and indeed with .NET being as wonderful as it is there are seldom issues with doing so. But I think when we added Direct3D 9 bindings we made an explicit choice that 32-bit support would not be at any cost, we'd prioritise 64-bit if necessary. Regarding this specific issue, it is my expectation that the CLong type is used where possible, but I obviously recognise that can't be used for an enum's backing type. That being said, if you do Constant<CLong, SomeEnum>, it should do the right thing. I can't remember whether there's anything in the generator currently that would stop that being possible.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. I'll add a task to my tracker to look over the bindings and update the bindings to use CLong where possible.

where possible.

Note: There may be other differences not yet documented here. In the case new differences are discovered, please
update this section. API-specific differences should not be documented here and should be documented in the
[API-Specific Notes](api-specific-notes.md) document.
Expand Down Expand Up @@ -213,10 +219,6 @@ Usage recommendations:

This mod should be used when the API being bound makes use of the pre-C99 enum pattern described above.

This mod was originally part of the now removed `ExtractNestedTyping` mod. For simplicity, feel free to include all
mods originally from `ExtractNestedTyping`. However, you may also include the mods strictly needed for the bindings
being generated.

### ExtractFunctionPointers

Mod categories: Creation
Expand All @@ -237,8 +239,15 @@ Name affix categories:
delegate representation of a function pointer type to distinguish the delegate type from the struct type for extracted
function pointers.

- `FunctionPointerParent` - This is a prefix used by the delegate representation of a function pointer type. This is
used to ensure that the delegate type always uses the current name of its struct counterpart as part of its own name.
- `FunctionPointerNameFallbackParent` - This is a prefix used by the struct representation of a function pointer type.
This is used in cases where a "fallback" name is used since there is no other native name available. For example, if
an unmanaged delegate was extracted from a method parameter, the method name and parameter name are joined together.
This prefix references the method name to ensure that the struct type uses the final name of the method as part of
its own name during name prettification.

- `FunctionPointerParent` - This is a prefix used by the delegate representation of a function pointer type. This
prefix references the name of its struct counterpart to ensure that the delegate type uses the final name of its
struct counterpart as part of its own name during name prettification.

These affixes are usually left unconfigured in `PrettifyNames`.

Expand All @@ -247,10 +256,6 @@ Usage recommendations:
This mod should be used when a set of bindings contains unmanaged delegates annotated with `[NativeTypeName]`
attributes.

This mod was originally part of the now removed `ExtractNestedTyping` mod. For simplicity, feel free to include all
mods originally from `ExtractNestedTyping`. However, you may also include the mods strictly needed for the bindings
being generated.

### ExtractHandles

Mod categories: Creation
Expand Down Expand Up @@ -297,10 +302,6 @@ Furthermore, this mod should be used alongside `TransformHandles` so that the ha
user-friendly version. `ExtractHandles` should be positioned before `TransformHandles` and any other mods that might use
its results in the mod order.

This mod was originally part of the now removed `ExtractNestedTyping` mod. For simplicity, feel free to include all
mods originally from `ExtractNestedTyping`. However, you may also include the mods strictly needed for the bindings
being generated.

### ExtractNestedTypes

Mod categories: Creation
Expand All @@ -316,8 +317,8 @@ Examples for how `ExtractNestedTypes` works can be found in the `ExtractNestedTy
Name affix categories:

- `NestedStructParent` - This is a prefix that references the name of the type that the extracted type was previously
nested in. This is used to ensure that the extracted type always uses the current name of its original "parent" type
as part of its own name.
nested in. This ensures the extracted type uses the final name of its original "parent" type as part of its own name
during name prettification.

These affixes are usually left unconfigured in `PrettifyNames`.

Expand All @@ -328,10 +329,6 @@ bindings. This is because `PrettifyNames` does not handle nesting when renaming
restrictions. This restriction is generally because nesting increases complexity, and as such, mods are written with the
assumption that nested types are extracted beforehand.

This mod was originally part of the now removed `ExtractNestedTyping` mod. For simplicity, feel free to include all
mods originally from `ExtractNestedTyping`. However, you may also include the mods strictly needed for the bindings
being generated.

### IdentifySharedPrefixes

Mod categories: Metadata, Naming
Expand Down Expand Up @@ -496,13 +493,13 @@ the mod.

Khronos-style XML specifications:

- OpenAL: https://raw.githubusercontent.com/kcat/openal-soft/refs/heads/master/registry/xml/al.xml
- OpenCL: https://raw.githubusercontent.com/KhronosGroup/OpenCL-Docs/refs/heads/main/xml/cl.xml
- OpenGL: https://raw.githubusercontent.com/KhronosGroup/OpenGL-Registry/refs/heads/main/xml/gl.xml
- OpenAL: https://raw.githubusercontent.com/kcat/openal-soft/master/registry/xml/al.xml
- OpenCL: https://raw.githubusercontent.com/KhronosGroup/OpenCL-Docs/main/xml/cl.xml
- OpenGL: https://raw.githubusercontent.com/KhronosGroup/OpenGL-Registry/main/xml/gl.xml
- OpenGL Windows: https://raw.githubusercontent.com/KhronosGroup/OpenGL-Registry/main/xml/wgl.xml
- OpenGL X11: https://github.com/KhronosGroup/OpenGL-Registry/blob/main/xml/glx.xml
- OpenXR: https://raw.githubusercontent.com/KhronosGroup/OpenXR-SDK-Source/main/specification/registry/xr.xml
- Vulkan: https://raw.githubusercontent.com/KhronosGroup/Vulkan-Docs/refs/heads/main/xml/vk.xml
- OpenGL X11: https://raw.githubusercontent.com/KhronosGroup/OpenGL-Registry/main/xml/glx.xml
- OpenXR: https://raw.githubusercontent.com/KhronosGroup/OpenXR-SDK/main/specification/registry/xr.xml
- Vulkan: https://raw.githubusercontent.com/KhronosGroup/Vulkan-Docs/main/xml/vk.xml

Be aware that these link to the latest version. Silk's repo may be using an older version of these XML files.

Expand Down
14 changes: 10 additions & 4 deletions docs/for-contributors/Generator/name-processing.md
Original file line number Diff line number Diff line change
Expand Up @@ -386,10 +386,16 @@ public struct GamepadBindingInput;
public struct GamepadBindingInputAxis;
```

Limitation: Only simple references are allowed because references are resolved manually by `PrettifyNames` and not by
Roslyn. For example, `nameof(GamepadBinding.Member)` will not work because member access expressions are not handled.
Currently, only identifiers that exist in the current scope or parent scope can be referenced. That said, this should be
enough for most use cases.
Or from the OpenCL bindings:
```cs
[NameAffix("Prefix", "FunctionPointerNameFallbackParent", nameof(Cl.EnqueueSvmFreeARM))]
public struct EnqueueSvmFreeArmPfnFreFunc;

public class Cl
{
public int EnqueueSvmFreeARM();
}
```

## Symbol-based Renamer

Expand Down
Loading
Loading