fix(gpu,metal): lazily populate texture_buffer views for typed and structured buffers #336
No reviewers
Labels
No labels
accessibility
bug
claimed
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
tester report
urgent
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LakshanSivakumar--Native-Victory-macOS!336
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-278"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
victory-shader lowers MUBUF buffer_load_format_, buffer_store_format_, and their getDimensions queries to DXIL TypedBuffer (bufferLoad.f32 / bufferStore.f32 / getDimensions), skipping view_stride (lower.rs: && !typed). Tested on a small synthetic DXIL program of our own, Metal Shader Converter compiles those operations to air.read_texture_buffer_1d.v4f32, air.write_texture_buffer_1d.v4f32, and air.get_width_texture_buffer_1d, reading word 1 (textureViewID at +8) of the 24-byte IRDescriptorTableEntry rather than word 0 (gpuVA at +0).
Metal::write_buffer wrote [gpu, 0, size], leaving word 1 null so formatted stores were silently dropped and formatted loads/size queries returned 0 even when raw buffer_store_dwordx4 on the same entry succeeded.
Keep NativeHost::mirror free of Metal texture allocations by marking two pending bits per entry (PendingTyped, ~10 KiB for 40,000 entries) and promoting entries via ResourceBackend::write_typed_buffer lazily at draw or dispatch only when a bound shader's DXIL uses TypedBuffer operations (Binding::typed_buffers), scoped to bound Root::Table spans plus explicit (stride == 0) typed buffer views when the shader also indexes ResourceDescriptorHeap directly. Retain the MTLTexture in Heap::refs while counting only the backing MTLBuffer in residency sets, and warn once if an unaligned pool offset falls back to write_buffer.
Refs #255
Refs #258