UI groundwork
The UI library is staged under ui/ until it moves into the standard library as std/ui.
ui/protocolsholds the Wayland protocol XML the library is built from:wayland.xmlandxdg-shell.xml.go run ./cmd/wlgen -o wayland.low ui/protocols/wayland.xml ui/protocols/xdg-shell.xmlgenerates Low bindings for libwayland-client.- Every interface given in one run shares an
Interfacesrecord ofwl_interfacetables thatinterfaces()builds in C memory. A reference to an interface that no given protocol declares is an error. - A request becomes
interface_request(...)overwl_proxy_marshal_flags, taking theInterfacesrecord when it creates an object of a known interface.wl_registry_bindtakes the interface table and version. - Destructor requests pass
WL_MARSHAL_FLAG_DESTROY, and an interface without adestroyrequest gets one that callswl_proxy_destroy. - Objects are
ptr, stringsptr[u8],fixedani32. - Events become an
extern structlistener ofextern fnfields, each defaulting to a generated function that ignores the event, so a listener names only the events it handles.interface_add_listenercopies it into C memory. Callbacks receive the listener'sdatapointer, usually a pinned Low object. - Enum entries are functions such as
wl_shm_format_argb8888() -> u32. Names that clash with Low keywords or builtins gain a trailing_.
- Every interface given in one run shares an
ui/shadersholds GLSL for instanced quads with per-corner radii, borders and clipping, blurred shadows, and monochrome glyph sprites sampled from anR8atlas. Instances are read from a storage buffer at set 0 binding 0 and the viewport size is a push constant.go run ./cmd/shadergen ui/shaderscompiles each stage withglslcto a checked-in.spvand records the sources' SHA-256 sums insources.sum.ui/registryholds the Vulkan registry,vk.xml.gzfrom Vulkan-Docs v1.4.363, andvulkan.list, which selects extensions, commands and extra types such aspNextstructures.go run ./cmd/vkgen -registry ui/registry/vk.xml.gz -select ui/registry/vulkan.list -o vulkan.lowgenerates Low bindings for the selected commands and every type they reach, skipping Vulkan SC variants. Enum values come from the core enums, every Vulkan feature level and the selected extensions.- A handle is a one-field
extern struct,ptrfor dispatchable handles andi64for the others, soVkBuffer {}is the null handle and handles of different kinds do not mix. - Structures and unions become
extern structs whose fields all have defaults: zero,null, the empty handle, or forsTypethe structure's own value, so a literal names only what it sets. A union takes the layout of its widest member. - A fixed C array becomes numbered fields,
name_0toname_N, with an accessorStruct_name(s)that returns them as a slice, or as astrfor a character array. - Vulkan types map to
u32(uint32_t,VkBool32,VkFlags, 32-bit flag bits),i32(int32_t, enums),i64(uint64_t,VkDeviceSize,VkFlags64,size_t),u16,u8,f32andf64. - Pointers to known types become
ptr[T];void*, function pointers and pointers to pointers becomeptr. A command's single input or output through a pointer is amutparameter; an array or optional pointer is aptr[T]. - Enum entries and API constants are functions such as
VK_FORMAT_R8G8B8A8_UNORM() -> i32, andvk_make_api_versionbuilds version numbers.