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.APIFunction
VulkanGen.WrapperConfig
VulkanGen._wrap_implicit_return
VulkanGen.func_ptr_args
VulkanGen.func_ptr_args
VulkanGen.func_ptrs
VulkanGen.idiomatic_julia_type
VulkanGen.is_consumed
VulkanGen.is_pointer_start
VulkanGen.must_return_status_code
VulkanGen.must_return_success_code
VulkanGen.wrap_identifier
VulkanGen.APIFunction
— MethodExtend 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.
VulkanGen.WrapperConfig
— TypeConfiguration 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.
VulkanGen._wrap_implicit_return
— FunctionBuild 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 Ref
s or Vector
s 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}
VulkanGen.func_ptr_args
— MethodFunction 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}
VulkanGen.func_ptr_args
— MethodFunction 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}
VulkanGen.func_ptrs
— MethodCorresponding pointer argument for a Vulkan function.
func_ptrs(spec::Spec) -> AbstractVector
VulkanGen.idiomatic_julia_type
— MethodReturn a new type easier to deal with.
idiomatic_julia_type(spec::Spec) -> Any
VulkanGen.is_consumed
— MethodThese 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.".
is_consumed(spec::SpecHandle)
VulkanGen.is_pointer_start
— MethodRepresent an integer that gives the start of a C pointer.
is_pointer_start(
spec::Union{SpecFuncParam, SpecStructMember}
) -> Union{Missing, Bool}
VulkanGen.must_return_status_code
— MethodWhether it makes sense to return a success code (i.e. when there are possible errors or non-SUCCESS
success codes).
must_return_status_code(spec::SpecFunc) -> Bool
VulkanGen.must_return_success_code
— MethodWhether the success code must be returned because it is informative (e.g. notifying of timeouts).
must_return_success_code(spec::SpecFunc) -> Bool
VulkanGen.wrap_identifier
— MethodGenerate an identifier from a Vulkan identifier, in lower snake case and without pointer prefixes (such as in pNext
).
wrap_identifier(identifier) -> Any