Skip to main content

webgpu

LuaJIT bindings for the embedded wgpu-native library

Foreign Function Interface
This is a low-level module; misuse can easily crash the runtime!

Status

External: Functionality is provided by a third-party library, which may or may not give semantic versioning guarantees

Availability

This module is preloaded. You can simply require it:

local webgpu = require("webgpu")

Fields

cdefs

A string representing the C type definitions that were used to load the FFI bindings. Do not attempt to ffi.load them manually.

bindings

A pointer to the statically-loaded exports table that exposes the bound functions to Lua. For more details, see this note.

Functions

initialize

Initializes the bindings by loading the C type definitions. Automatically called by the runtime when it sets up the Lua environment.

Native Bindings

The API is based on the shared WebGPU headers, with all function names converted to snake_case. A full list can be found here, and external documentation for the Rust-based implementation is located here. The Lua bindings map to the WebGPU C/FFI headers 1:1.

All C functions can be accessed via webgpu.bindings and must be called with the appropriate cdata values.

wgpu_version

Returns the embedded wgpu-native library version.

const char* (*wgpu_version)(void);

Changelog

VersionWhat happened?
v0.0.6Initial release