From 7e74c9efd985331e68bd2acdf01888057968470e Mon Sep 17 00:00:00 2001 From: chrg6 Date: Fri, 13 Nov 2026 12:34:38 -0500 Subject: [PATCH] Say in the architecture notes when mesh_fallback = auto takes the fallback, and that a count the GPU wrote is cut to the fallback's buffers. Co-Authored-By: Claude Opus 5.5 --- docs/architecture.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/architecture.md b/docs/architecture.md index 96385f08..40b4c3fb 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -145,15 +145,18 @@ keeps per-core data without locks and relies on that, so the host models it (`ru ring of Vulkan `{x, y, z}` records filled on the GPU. The copy cannot be recorded inside a pass, so the first such draw of a pass fills the records of the mesh draws that follow it too, and the pass is not cut at each of them (`runtime/vk_exec_draw.c` `mesh_ring_entry`). -- Mesh fallback (`mesh_fallback`: `auto` on a device without the extension, `1` on any device for testing): the task - and mesh stages run as compute dispatches and the result is drawn as ordinary triangles. +- Mesh fallback (`mesh_fallback`: `auto` on a device without the extension and on AMD's Windows driver for RDNA 1 and + 2, where native mesh pipelines lost the device in play, `1` on any device for testing, `0` never; + `runtime/vk_mesh_path.h`): the task and mesh stages run as compute dispatches and the result is drawn as ordinary + triangles. - The modules come from the translations the shader cache already holds, not from the translator (`runtime/mesh_fb.c`): a translated task or mesh module is the program as a compute function over shared memory plus an entry function that hands that memory to the mesh pipeline, and the fallback replaces the entry function by one that copies the memory into a storage buffer. The translator, its identity and every cache key stay as they are, so a device with mesh shaders keeps its shaders and never sees these modules, and a device without needs no other cache or prepared shader list. - - A draw is: its record (the workgroup count, copied on the GPU when the game's record holds it); the task + - A draw is: its record (the workgroup count, copied on the GPU when the game's record holds it, then cut to what + the buffers hold by `shaders/meshfb_clamp.comp`, so a garbage count cannot launch work past them); the task dispatch, which writes each task workgroup's payload into the task buffer; a scan (`shaders/meshfb_scan.comp`) that lists the mesh workgroups the tasks started, in task order, and writes their number into the record; the mesh dispatch, which writes each workgroup's vertex lines and primitive bytes into its slot of the mesh buffer;