gpu: destroy_shader/buffer/texture on the GPU protocol (issue-0029)

Three new method signatures on the GPU protocol. Metal backend sends
`release` to the MTLTexture/Buffer/RenderPipelineState and nulls the
slot in its backing List so the handle becomes inert; handles are not
re-used. glyph_cache.grow() now destroys the old atlas before
allocating its replacement, eliminating the per-grow leak the file's
comment had been flagging since Session 62.
This commit is contained in:
agra
2026-05-18 23:09:32 +03:00
parent 79419b99bd
commit f41a121a29
4 changed files with 72 additions and 50 deletions

View File

@@ -38,6 +38,14 @@ GPU :: protocol {
create_texture :: (w: s32, h: s32, format: TextureFormat, pixels: *void) -> TextureHandle;
update_texture_region :: (tex: TextureHandle, x: s32, y: s32, w: s32, h: s32, pixels: *void);
// Release a GPU resource. Implementations release the backing object and
// null the slot so the handle becomes inert. Calling with handle 0 or
// an already-destroyed handle is a no-op. Handles are not re-used; the
// backing List entry stays at its index with a null sentinel.
destroy_shader :: (sh: ShaderHandle);
destroy_buffer :: (buf: BufferHandle);
destroy_texture :: (tex: TextureHandle);
set_shader :: (sh: ShaderHandle);
set_vertex_buffer :: (buf: BufferHandle);
set_texture :: (slot: u32, tex: TextureHandle);