Documentation
¶
Overview ¶
Package ffi is the slice of goffi's API the Vulkan bindings call through, carried out by github.com/ebitengine/purego: purego and goffi each link a runtime shim (fakecgo) and cannot share a program, and purego is the one lys-ui's applications already use to load native libraries.
Every Vulkan argument and result is an integer, a handle or a pointer, passed in integer registers. Float arguments (only a few rarely used commands, such as vkCmdSetLineWidth, take any) would travel in float registers, which purego.SyscallN does not fill, so a call with one panics rather than pass garbage.
Index ¶
- Variables
- func CallFunction(cif *CallInterface, fn unsafe.Pointer, rvalue unsafe.Pointer, ...) (uintptr, error)
- func FreeLibrary(handle unsafe.Pointer) error
- func GetSymbol(handle unsafe.Pointer, name string) (unsafe.Pointer, error)
- func LoadLibrary(name string) (unsafe.Pointer, error)
- func PrepareCallInterface(cif *CallInterface, _ CallingConvention, ret *TypeDescriptor, ...) error
- type CallInterface
- type CallingConvention
- type TypeDescriptor
- type TypeKind
Constants ¶
This section is empty.
Variables ¶
var ( VoidTypeDescriptor = &TypeDescriptor{Kind: VoidType} UInt32TypeDescriptor = &TypeDescriptor{Kind: UInt32Type} SInt32TypeDescriptor = &TypeDescriptor{Kind: SInt32Type} UInt64TypeDescriptor = &TypeDescriptor{Kind: UInt64Type} PointerTypeDescriptor = &TypeDescriptor{Kind: PointerType} FloatTypeDescriptor = &TypeDescriptor{Kind: FloatType} )
The C types the bindings use.
Functions ¶
func CallFunction ¶
func CallFunction(cif *CallInterface, fn unsafe.Pointer, rvalue unsafe.Pointer, avalue []unsafe.Pointer) (uintptr, error)
CallFunction calls fn with the arguments avalue points at, each read as its prepared type, and stores the result where rvalue points (nil for a void function). The errno result is always zero. The C side gets the arguments as integers, which keep nothing alive, so avalue, and through it every structure an argument points at, stays reachable until the call returns: otherwise a collection during a long call (vkCreateInstance) frees what the driver is reading, and another goroutine's allocation overwrites it.
func FreeLibrary ¶
FreeLibrary closes a library LoadLibrary opened.
func LoadLibrary ¶
LoadLibrary opens the shared library name.
func PrepareCallInterface ¶
func PrepareCallInterface(cif *CallInterface, _ CallingConvention, ret *TypeDescriptor, args []*TypeDescriptor) error
PrepareCallInterface records a function's result and argument types.
Types ¶
type CallInterface ¶
type CallInterface struct {
// contains filtered or unexported fields
}
CallInterface is a prepared signature.
type CallingConvention ¶
type CallingConvention int
CallingConvention is goffi's; only the platform default exists here.
const DefaultCall CallingConvention = 0
DefaultCall is the platform's C calling convention.
type TypeDescriptor ¶
type TypeDescriptor struct{ Kind TypeKind }
TypeDescriptor describes a C type.