-
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.
Type names in the API take the form "Vk" in TitleCase. The generated API keeps the names, but moves the extension to be the namespace name. Bitmask types (which end in "FlagBits") is changed to "Flags".
Examples:
-
VkExtent3D
->Vk.Extent3D
-
VkSurfaceKHR
->Vk.KHR.Surface
-
VkMemoryAllocateFlagBits
->Vk.MemoryAllocateFlags
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
->Never
(in theCompareOp
enum) -
VK_DYNAMIC_STATE_DISCARD_RECTANGLE_EXT
->DiscardRectangleEXT
(in theDynamicState
enum) -
VK_IMAGE_TYPE_1D
->E1D
(in theImageType
enum) -
VK_MEMORY_ALLOCATE_DEVICE_MASK_BIT
->DeviceMask
(in theMemoryAllocateFlags
enum)
Handle types are split into two different components in the API. The raw handles (basically just a wrapped void*
) are in the type Vk.Handle<TYPE>
, where TYPE
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:
-
Vk.Instance
and the associatedVk.Handle<Vk.Instance>
-
Vk.Device
and the associatedVk.Handle<Vk.Device>
Constant values keep their API names, minus the "VK_", and get placed in the Vk.Constants
static class. This includes the "*_SPEC_VERSION" and "*_EXTENSION_NAME" constants.
Examples:
-
VK_TRUE
->Vk.Constants.TRUE
-
VK_UUID_SIZE
->Vk.Constants.UUID_SIZE
-
VK_KHR_SURFACE_SPEC_VERSION
->Vk.Constants.KHR_SURFACE_SPEC_VERSION