GLFW Internal FFI Bindings #
Low-level FFI bindings to GLFW and WebGPU rendering functions.
Resources are automatically managed via Lean.External with C++ finalizers. No manual cleanup is required.
Initialize GLFW. Must be called before creating windows. Throws error on failure.
Terminate GLFW. Should be called when done with all windows.
Check if a window should close
Poll for window events (must be called regularly in the render loop)
Create a WebGPU surface for the given window. Automatically cleaned up by GC.
Get the preferred texture format for the surface
Get the current texture from the surface for rendering. Automatically cleaned up by GC.
Present the surface (swap buffers)
Create a view of the texture for rendering. Automatically cleaned up by GC.
Create a command encoder for recording commands. Automatically cleaned up by GC.
Begin a render pass with the given texture view. Automatically cleaned up by GC.
Set the render pipeline for the render pass
Draw vertices
End the render pass
Finish recording commands and create a command buffer. Automatically cleaned up by GC.
Submit a command buffer to the GPU queue
Create a shader module from WGSL code. Automatically cleaned up by GC.
Create a render pipeline from a shader module. Automatically cleaned up by GC.