fix(render3d): nothing allocated in the steady state - the Vulkan allocator reuses its records
gvk_mem_new made a one-slot []pointer per allocation, and turned the requirement's size and alignment into strings to read them as ints; gvk_list_drop_last rebuilt the spare-record list to drop its last entry; gvk_mem_id did the string round trip on every free. One slot is kept (gvk_map_slot), int() truncates a long, the spare list pops. Every Text.to_int(string(x)) in render3d is int(x) now. Vk.heap_bytes() (vk_mac.ll: malloc_zone_statistics' size_in_use; 0 on Windows) and examples/rendering/steady.ludic, in the suite: a buffer released and made again 5000 times and 600 whole frames gain 0 bytes each - the allocator before this, 1,120,000 over the 5000. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
3915af34c2
commit
866037a0d7
9 changed files with 119 additions and 19 deletions
|
|
@ -678,7 +678,7 @@ function gvk_frame_init(render3d_st: mut Render3dState) -> bool {
|
|||
let props = bytes(VkPhysicalDeviceProperties_sizeof)
|
||||
Vk.get_physical_device_properties(render3d_st.gvk_pd, props)
|
||||
let al = Vk.get_i64(props, VkPhysicalDeviceProperties_limits + VkPhysicalDeviceLimits_minUniformBufferOffsetAlignment)
|
||||
render3d_st.gvk_ring_align = Text.to_int(string(al))
|
||||
render3d_st.gvk_ring_align = int(al)
|
||||
if render3d_st.gvk_ring_align < 16 { render3d_st.gvk_ring_align = 16 }
|
||||
# MSAA: the most samples (up to the 4 the scene asks for) both a colour and a depth target can take
|
||||
let lim = VkPhysicalDeviceProperties_limits
|
||||
|
|
@ -908,7 +908,7 @@ function gvk_sc_make(render3d_st: mut Render3dState, p: int, nt: int) -> long {
|
|||
}
|
||||
let iw = VkDescriptorImageInfo_sizeof
|
||||
for t in 0 .. nt {
|
||||
let tex = Text.to_int(string(render3d_st.gvk_sc_tmp[t * 2] / 65536))
|
||||
let tex = int(render3d_st.gvk_sc_tmp[t * 2] / 65536)
|
||||
Vk.put_i64(iis, t * iw + VkDescriptorImageInfo_sampler, render3d_st.gvk_sc_tmp[t * 2 + 1])
|
||||
Vk.put_i64(iis, t * iw + VkDescriptorImageInfo_imageView, render3d_st.gvk_tex_view[tex])
|
||||
Vk.put_i32(iis, t * iw + VkDescriptorImageInfo_imageLayout, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL)
|
||||
|
|
@ -1855,9 +1855,9 @@ function gvk_prof_frame(render3d_st: mut Render3dState) -> void {
|
|||
render3d_st.gvk_prof_frames += 1
|
||||
if render3d_st.gvk_prof_frames < 120 { return }
|
||||
let f = render3d_st.gvk_prof_frames
|
||||
let pipe = Text.to_int(string(render3d_st.gvk_us_pipe)) / f
|
||||
let set = Text.to_int(string(render3d_st.gvk_us_set)) / f
|
||||
let draw = Text.to_int(string(render3d_st.gvk_us_draw)) / f
|
||||
let pipe = int(render3d_st.gvk_us_pipe) / f
|
||||
let set = int(render3d_st.gvk_us_set) / f
|
||||
let draw = int(render3d_st.gvk_us_draw) / f
|
||||
print(`r3d: vulkan per frame: {render3d_st.gvk_n_draws / f} draws, {render3d_st.gvk_n_flush / f} flushes; pipelines {pipe / 1000}.{(pipe / 100) % 10} ms, sets {set / 1000}.{(set / 100) % 10} ms, inside draws {draw / 1000}.{(draw / 100) % 10} ms; {render3d_st.gvk_n_pipe_new} pipelines made`)
|
||||
# every draw asked for should have been made: a gap is a layer missing from the frame, which is how
|
||||
# MoltenVK's refused skinned pipelines went unseen (the drawstats session found it by counting)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue