Draw textures separately, and keep them out of Primitives

Interleaving textures with primitives was solving a problem that does not
exist: within a layer, order is already undefined because freeing an
instance swap-removes it, and layering is what layers are for. So the run
batching is gone.

A layer is now `LayerDraws`: a `Primitives` and a texture `InstanceList`
side by side, with `updated` covering both. `Primitives` holds only
primitives again -- its instance list plus the group-1 data those
instances read -- and `InstanceList` is the shared push/free/apply_free
the two lists have in common rather than a second copy of it.
`PrimitiveHandle` names which list with `InstanceKind`, and
`PrimitiveChange` carries the same, since the two index independently.
The handle no longer carries a group-1 index at all: a primitive
instance already records where its entry is.

The renderer gives each layer a second instance buffer and draws its
textures one at a time after the instanced draw, each binding its own
group 2.

Review fixes alongside: `GlyphAtlas::allocate` returns the `PageUpload`
it reserved instead of a bare tuple; a page or image region uploads
through a new `write_region`, which passes the row stride to
`write_texture` rather than copying the rectangle out first.

Verified by replaying taps into the `tabs` example: three images added
and one deleted leaves two drawn with two live texture slots, and the
masked text-edit tab still clips, with the images freed on tab switch.
This commit is contained in:
iris committed 2026-09-13 13:32:05 -04:00
1 parent f5864da3c4
commit b3d3da5dab
10 files changed
+282 -241

No files matched your search

-3
View File
@@ -83,9 +83,6 @@ impl UiRenderer {
.block_on()
.expect("Could not get adapter!");
// No binding-array features or limits: the atlas is one
// texture_2d_array and an image its own bind group, so nothing here
// needs VK_EXT_descriptor_indexing the way the old layout did.
let (device, queue) = adapter
.request_device(&DeviceDescriptor {
required_limits: Limits {