Package club.doki7.vulkan.bitmask


package club.doki7.vulkan.bitmask

Bitmask (flags) types of Vulkan API.

Quick start

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

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

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

    void usage(@EnumType(VkBufferUsageFlags.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:

VkBufferUsageFlags.explain(someFlags)