Package club.doki7.vulkan.enumtype


package club.doki7.vulkan.enumtype

Enumeration (enum) types of Vulkan API.

Quick start Link icon

In vulkan4j ecosystem, we don't use Java class types to represent C enum types. We will be still using Java integers (int or long), also club.doki7.ffm.ptr types when representing pointer to or array of enums.

In order to tell what enum type an integral value represents, we use the annotation @EnumType. For example:

public record VkBufferCreateInfo(MemorySegment segment) {
    @EnumType(VkSharingMode.class) int sharingMode() {
        // implementation omitted
    }

    void sharingMode(@EnumType(VkSharingMode.class) int value) {
        // implementation omitted
    }

    // ...
}

The @EnumType annotation provides useful in-IDE and JavaDoc links, so you can Ctrl-Click on the annotation argument to jump to the definition of the bitmask type.

Also, there's a handy explain function to explain a bitmask integral value. For example:

VkSharingMode.explain(someSharingMode)