perf(render3d): Vulkan draws find pipelines by integer and reuse descriptor sets
R3D_VK_PROF at the camp view (about 2950 draws a frame) showed the frame spent in bookkeeping: 19.5 ms a frame finding pipelines by string key and 16 ms building descriptor sets. - Pipelines: a mesh carries an interned vertex-layout id (dropped only when an attribute's shape changes, not when an instance buffer is swapped), render state packs into an int and the pass formats into another; the program's last hit is tried first. The string path only builds. - Samplers: each texture keeps the sampler for its parameters until they change. - Descriptor sets: a program's last set is reused within the frame while its blocks and resolved textures are unchanged; a uniform write that repeats the value it already holds changes nothing. Headless on the RTX 3070 Ti at 1920x1080: 21.7 -> 53.3 fps (pipelines 0.2 ms, sets 8.5 ms, inside draws 10 ms a frame; OpenGL 114 fps). The camp frame is unchanged and validation-clean. OpenGL frames byte-identical at the five viewpoints; 59 self-tests pass; VKRES OK. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
6942c36853
commit
f5d1a62ccf
4 changed files with 132 additions and 8 deletions
|
|
@ -16,7 +16,8 @@ property Mesh {
|
|||
vbufs: words, # every vertex buffer the mesh owns, freed with it
|
||||
n_vbufs: int = 0,
|
||||
cur_buf: int = 0, # the buffer the next attribute reads (while building)
|
||||
ibuf: int = 0 # the instance buffer attached last
|
||||
ibuf: int = 0, # the instance buffer attached last
|
||||
vk_layout: int = 0 # the Vulkan backend's interned id for the recorded layout (0: not yet)
|
||||
}
|
||||
|
||||
function mesh_draw(m: Mesh) -> void { gpu_draw_mesh(m) }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue