Prune commentary and stale Rust port notes

This commit is contained in:
iris committed 2026-09-10 00:44:13 -04:00
1 parent 5428cd75c9
commit 25370731d0
193 files changed
+693 -16219

No files matched your search

@@ -1,33 +1,3 @@
//! Why a GPU test segfaults *after* it has passed, and what stops it.
//!
//! Measured here 2026-09-08, on this VM's Venus adapter. Destroying the
//! last `VkInstance` makes the Vulkan loader `dlclose` the ICD; Mesa's
//! ICD (`/usr/lib/libvulkan_virtio.so`) registers a `pthread_key_create`
//! destructor pointing into its own text and is not linked `-z nodelete`,
//! so glibc calls that destructor through unmapped memory when the thread
//! that used Vulkan exits. libtest runs every `#[test]` on a spawned
//! thread, which is why it looked like "wgpu crashes on drop": the drop
//! itself completes, and the crash lands as the thread unwinds.
//!
//! The four modes are the experiment, and each is one variable:
//!
//! | mode | what it does | 2026-09-08 |
//! |---|---|---|
//! | `main` | wgpu instance + device on the main thread, dropped | exits 0 |
//! | `thread` | the same on a spawned thread | **SIGSEGV** |
//! | `keep` | the same, but the instance is never dropped | exits 0 |
//! | `raw` | raw Vulkan (`ash`), instance + device, spawned thread | **SIGSEGV** |
//!
//! `raw` is the one that says whose bug it is: no wgpu is involved, so
//! there is nothing for wgpu or a caller to fix in its drop order. `keep`
//! is the fix -- hold one `wgpu::Instance` for the process, which is what
//! wgpu asks for anyway. `iris/tests/mask_sdf.rs` does exactly that.
//!
//! `VK_LOADER_DISABLE_DYNAMIC_LIBRARY_UNLOADING=1` also makes every mode
//! exit cleanly, which is the confirmation that the unload is the
//! mechanism -- but it is an environment variable every caller would have
//! to remember, so it belongs in this comment rather than in a script.
use ash::vk;
use pollster::block_on;
use wgpu::*;
@@ -42,12 +12,9 @@ fn main() {
other => panic!("unknown mode {other:?}: main | thread | keep | raw"),
};
std::thread::spawn(body).join().expect("the spawned thread");
// Not reached when the thread's exit takes the process with it.
eprintln!("thread joined");
}
/// A wgpu instance and device, opened and closed. `keep_instance` is the
/// fix under test: everything else still drops normally.
fn wgpu_open_and_close(keep_instance: bool) {
let instance = Instance::default();
let adapter =
@@ -71,8 +38,6 @@ fn wgpu_open_and_close(keep_instance: bool) {
eprintln!("wgpu closed");
}
/// The same shape with no wgpu in it at all, which is what makes this a
/// loader/driver bug rather than a wgpu one.
fn raw_vulkan_open_and_close() {
unsafe {
let entry = ash::Entry::load().expect("vulkan loader");