Docs: a new texture reads zero for a stated reason, and its cost stays counted

The runtime README called the zero clear of a new texture the runtime's choice. It now gives the
reasons the answer stands on: Metal leaves a new texture's contents undefined, programs read
textures they never wrote, an Apple M3 Max answered zero for new Shared and Managed textures, and
zero is the one answer that cannot show a program bytes something else left in the device's
memory. The clear is counted by Metrics::texture_clears and texture_clear_bytes. No behaviour
changes.

Verified: the paragraph reads as one, and no other doc states the old reason.
This commit is contained in:
Anees Iqbal committed 2026-12-03 00:17:20 -08:00
1 parent cb09012f99
commit 8140229b9c
1 file changed
+5 -4
+5 -4
View File
@@ -394,11 +394,12 @@ in its memory.
`new_texture_for_views`'s and `new_managed_texture`'s. The upload of the next commit clears every
subresource of its image once, ahead of every command buffer committed after the call: a colour
clear, a depth-stencil clear, or copies from the zero source for a block-compressed format, which
no clear writes. This is the runtime's choice, not Metal's rule: Metal does not say what a new
no clear writes. This is the runtime's answer, not Metal's rule: Metal does not say what a new
texture holds (`newTextureWithDescriptor:` is "Allocate a new texture with privately owned
storage."). The runtime chose zero because programs read textures they never wrote, an Apple M3
Max answered zero for new Shared and Managed textures, and the memory's last bytes would follow
process history. The clear runs on every device. `Metrics::texture_clears` and
storage."). The runtime answers zero because programs read textures they never wrote, an Apple
M3 Max answered zero for new Shared and Managed textures, and zero is the one answer that cannot
show a program bytes something else left in the device's memory. The clear runs on every device,
and its cost stays visible: `Metrics::texture_clears` and
`texture_clear_bytes` count the clears. A texture in a heap's memory, over a buffer, of a
surface's plane, or a drawable's is not cleared: it reads its memory's bytes, or the swapchain's.
A view reads its parent's image.