Files
Lorenz Junglas a9cf53c047 Vulkan Per-Thread-Data rewrite (#4407)
Rewrites Vulkan per-thread resource management to use a pooled PerThreadDataVulkan_t slot system with a TLS fast-path, replacing the previous thread-index/map/array approach and updating Vulkan call sites to pass PerThreadDataVulkan_t* instead of thread indices.

* Remove ThreadIndex, SetAssociatedThreadIndex & MaxDeviceThreads (see what breaks)

* Refactor per-thread vulkan data into a single pooled struct

Replace fixed-array per-thread Vulkan data with a dynamic slot pool.
Threads grab slots on demand, hot path is just a TLS read, completly lock-free

Two mechanisms manage slot lifetime:
- Ref counting: render contexts and the render thread AddRef to keep
  their slot alive as long as they need it.
- Idle reclaim: slots nobody is holding onto get recycled after N frames
  of inactivity. Keeps short-lived threads (async shader compiles, texture
  uploads) from leaking slots, while still letting a thread that calls
  GetPerThreadData() every frame hang onto the same slot and all its
  resources (command pools, descriptor pools, pipeline cache, etc).

Moved VkPipelineCache into the per-thread struct with lazy creation.

* Add CRenderDeviceVulkan::GetPerThreadData() acquires from pool

* Use PerThreadData eveywhere instead of ThreadIndex

And do proper thread data shutdown cleanup

* Main render thread gets it's own permaned PerThreadData instance

* Rework pipelinecache to use PerThreadData instead of VkPipelineCache directly
2026-03-29 23:08:08 +02:00
..
2025-11-24 09:05:18 +00:00
2025-11-24 09:05:18 +00:00
2025-11-24 09:05:18 +00:00
2025-11-24 09:05:18 +00:00
2026-03-27 12:07:24 +00:00