-
Notifications
You must be signed in to change notification settings - Fork 0
Naming Conventions
This page contains some notes about how names in the API were translated in the generated API.
Note: API naming conventions changed in 1.2.162. This page reflects these changes.
Type names are equivalent to their C API names. Bitmask types use their ...Flags
naming, instead of the ...FlagBits
naming.
Examples:
-
VkExtent3D
->VkExtent3D
-
VkSurfaceKHR
->VkSurfaceKHR
-
VkMemoryAllocateFlagBits
->VkMemoryAllocateFlags
Struct fields are translated into TitleCase to match the standard naming conventions for C# public fields. If they use Hungarian Notation (such as pp
for pointer-to-pointer fields), those prefixes are removed from the name. The only time this is not followed is for the sType
and pNext
fields in "typed" structs, since they are special "internal" (kinda) fields specific to the type and API.
Enum values are in the form "VK_<ENUM_NAME>_<VALUE_NAME>_<EXTENSION>". Because enums are strongly-typed in C#, we drop the enum type name from the name. The leading "VK_" is also dropped. The remaining name is converted into TitleCase, and the extension is kept at the end. If the resulting name starts with a digit, then an "E" is prepended (following the C++ API convention).
Additionally, the ending "_BIT" is removed from enum values that are used as bitmasks.
Examples:
-
VK_COMPARE_OP_NEVER
->VkCompareOp.Never
-
VK_DYNAMIC_STATE_DISCARD_RECTANGLE_EXT
->VkDynamicState.DiscardRectangleExt
-
VK_IMAGE_TYPE_1D
->VkImageType.E1D
-
VK_MEMORY_ALLOCATE_DEVICE_MASK_BIT
->VkMemoryAllocateFlags.DeviceMask
Handle types are split into two different components in the API. The raw handles (basically just a wrapped void*
) are in the type VulkanHandle<VkTYPE>
, where VkTYPE
matches one of the wrapper classes generated for the handles. These wrapper classes have names like the struct types, but contain references to function tables and related handles, as well as the functions related to the object. These can be freely cast to the raw handle types, making them a nice solution to keeping the raw handles compatible with unmanaged code.
Examples:
-
VkInstance
and the associatedVulkanHandle<VkInstance>
-
VkDevice
and the associatedVulkanHandle<VkDevice>
Constant values keep their API names, minus the "VK_", and get placed in the VkConstants
static class. This includes the "*_SPEC_VERSION" and "*_EXTENSION_NAME" constants.
Examples:
-
VK_TRUE
->VkConstants.TRUE
-
VK_UUID_SIZE
->VkConstants.UUID_SIZE
-
VK_KHR_SURFACE_SPEC_VERSION
->VkConstants.KHR_SURFACE_SPEC_VERSION