VulkanGen

VulkanGen, the generator project, converts the XML specification into a custom IR, and then generates wrapper code.

Platform-specific wrapping

Some parts of the Vulkan API depend on system headers that are platform-specific; these notably include WSI (Window System Integration) extensions, which allow the developer to attach Vulkan devices to surfaces like windows. These platform-specific dependencies can be grouped into operating systems, notably Windows, MacOS, Linux and BSD. Each of these systems is associated with a set of WSI extensions and has a separate wrapper file with extensions specific to other operating systems removed.

VulkanGen.consumed_handlesConstant

These handle types are consumed by whatever command uses them. From the specification: "The following object types are consumed when they are passed into a Vulkan command and not further accessed by the objects they are used to create.".

source
VulkanGen.APIFunctionMethod

Extend functions that create (or allocate) one or several handles, by exposing the parameters of the associated CreateInfo structures. spec must have one or several CreateInfo arguments.

source
VulkanGen.WrapperConfigType

Configuration structure which allow the selection of specific parts of the Vulkan API.

struct WrapperConfig
  • wrap_core::Bool

    Include core API (with core extensions).

  • include_provisional_exts::Bool

    Include beta (provisional) exensions. Provisional extensions may break between patch releases.

  • include_platforms::Vector{PlatformType}

    Platform-specific families of extensions to include.

  • destfile::String

    Path the wrapper will be written to.

source
VulkanGen._wrap_implicit_returnFunction

Build a return expression from an implicit return parameter. Implicit return parameters are pointers that are mutated by the API, rather than returned directly. API functions with implicit return parameters return either nothing or a return code, which is automatically checked and not returned by the wrapper. Such implicit return parameters are Refs or Vectors holding either a base type or a core struct Vk*. They need to be converted by the wrapper to their wrapping type.

_wrap_implicit_return(
    return_param::SpecFuncParam
) -> Union{Expr, Symbol}
_wrap_implicit_return(
    return_param::SpecFuncParam,
    next_types;
    with_func_ptr
) -> Union{Expr, Symbol}
source
VulkanGen.func_ptr_argsMethod

Function pointer arguments for a function. Takes the function pointers arguments of the underlying handle if it is a Vulkan constructor, or a unique fptr if that's just a normal Vulkan function.

func_ptr_args(spec::SpecFunc) -> Vector{Expr}
source
VulkanGen.func_ptr_argsMethod

Function pointer arguments for a handle. Includes one fptr_create for the constructor (if applicable), and one fptr_destroy for the destructor (if applicable).

func_ptr_args(spec::SpecHandle) -> Vector{Expr}
source
VulkanGen.func_ptrsMethod

Corresponding pointer argument for a Vulkan function.

func_ptrs(spec::Spec) -> AbstractVector
source
VulkanGen.wrap_identifierMethod

Generate an identifier from a Vulkan identifier, in lower snake case and without pointer prefixes (such as in pNext).

wrap_identifier(identifier) -> Any
source