Skip to content

refactored Command Buffer logic#506

Merged
jnyfah merged 30 commits intodevelopfrom
user/kernel/fix-command-buffer-manager
Apr 7, 2026
Merged

refactored Command Buffer logic#506
jnyfah merged 30 commits intodevelopfrom
user/kernel/fix-command-buffer-manager

Conversation

@JeanPhilippeKernel
Copy link
Copy Markdown
Owner

@JeanPhilippeKernel JeanPhilippeKernel commented Feb 16, 2026

In this PR, we reviewing the whole logic behind the Command Manager that helps to create and distribute Command Buffer across engine Main Thread, Render Thread and Worker threads.

This new approach give us more flexibilities and make things for explicit about which, how and how many CB run per thread given an InFlight frame.

In addition to the Command Buffer Manager fixes, we had to review the Device swapchain creation and how it reacts to the Window resizing request -

all the mentioned above open the road to introduce the multi-threading support to engine -
This PR introduces support of dedicated Render Thread which is focusing on processing RenderPayload data and execute GPU commands.

@JeanPhilippeKernel JeanPhilippeKernel added this to the Born baby (0.2.0) milestone Feb 16, 2026
@JeanPhilippeKernel JeanPhilippeKernel self-assigned this Feb 16, 2026
@JeanPhilippeKernel JeanPhilippeKernel added area-rendering area-linux Work on Linux system area-macOS Work on macOS system critical labels Feb 16, 2026
@JeanPhilippeKernel JeanPhilippeKernel linked an issue Feb 16, 2026 that may be closed by this pull request
@JeanPhilippeKernel JeanPhilippeKernel marked this pull request as ready for review March 7, 2026 02:02
@JeanPhilippeKernel JeanPhilippeKernel force-pushed the user/kernel/fix-command-buffer-manager branch 2 times, most recently from 6d920f9 to 064d323 Compare March 7, 2026 06:48
@JeanPhilippeKernel JeanPhilippeKernel force-pushed the user/kernel/fix-command-buffer-manager branch from 064d323 to 2f40f5f Compare March 7, 2026 06:53
@JeanPhilippeKernel JeanPhilippeKernel force-pushed the user/kernel/fix-command-buffer-manager branch 2 times, most recently from 824ace9 to 43db662 Compare March 7, 2026 07:14
@JeanPhilippeKernel JeanPhilippeKernel force-pushed the user/kernel/fix-command-buffer-manager branch from 43db662 to 70f32aa Compare March 7, 2026 07:25
@JeanPhilippeKernel JeanPhilippeKernel moved this to In Progress in ZEngine Board Mar 7, 2026
@JeanPhilippeKernel JeanPhilippeKernel force-pushed the user/kernel/fix-command-buffer-manager branch from 7e086ca to 61910cb Compare March 8, 2026 13:11
@JeanPhilippeKernel JeanPhilippeKernel force-pushed the user/kernel/fix-command-buffer-manager branch 3 times, most recently from 6d83344 to 2c7b70a Compare March 19, 2026 13:18
@JeanPhilippeKernel JeanPhilippeKernel force-pushed the user/kernel/fix-command-buffer-manager branch from 2c7b70a to 5a00110 Compare March 19, 2026 13:22
@JeanPhilippeKernel JeanPhilippeKernel force-pushed the user/kernel/fix-command-buffer-manager branch from 5a00110 to ea32b30 Compare March 27, 2026 11:43
@JeanPhilippeKernel JeanPhilippeKernel force-pushed the user/kernel/fix-command-buffer-manager branch from c3e66fb to 13075f2 Compare March 31, 2026 23:44
@JeanPhilippeKernel JeanPhilippeKernel force-pushed the user/kernel/fix-command-buffer-manager branch from 13075f2 to f274291 Compare April 1, 2026 09:04
@JeanPhilippeKernel JeanPhilippeKernel force-pushed the user/kernel/fix-command-buffer-manager branch from 15d4c12 to 46bd183 Compare April 1, 2026 09:18
@JeanPhilippeKernel JeanPhilippeKernel force-pushed the user/kernel/fix-command-buffer-manager branch from a3ac903 to a16de16 Compare April 1, 2026 13:37
@JeanPhilippeKernel
Copy link
Copy Markdown
Owner Author

JeanPhilippeKernel commented Apr 6, 2026

Thanks @MathewBensonCode and @jnyfah for testing -

Actually, the issue wasn't related to the driver, but mostly how we allocate texture resources-
at the origin, we were using Combined texture sampler, which is great when we want to combine the texture + sampler directly. but the issue with it is this approach doesnt scale enough for a engine - let's say we want to handle 600 textures - it will have the consequence to create 600 textures + 600 samplers !!

On some drivers, like intel, it crashes immediately, while others will weird things like on @jnyfah screenshot - and some will simply silence the issue - macOS.

In addition the issue above, there were some threading issues between the RenderThread and MainThread and ownership of vulkan resources -
Most of it have been solved by redesigning the AsynchronousLoader class to ensure that each resource is available per frame -per thread - per pool

For better coordination, I had to introduce the use of Timeline semaphore and Binary semaphore for the rendering and presentation operation.

While this new way of rendering is great and stable than the previous (again Intel driver is very strict about usage of timeline semaphore, a small mistake or omitted config, it crashes everything), it surfaces another threading issue around the HandleManager which helps a lot for the texture/attachement resizing for the RenderGraph

Will address the fix for in a seperate PR because it involves solving a ABA problem #514

@JeanPhilippeKernel JeanPhilippeKernel marked this pull request as ready for review April 6, 2026 03:18
@jnyfah
Copy link
Copy Markdown
Collaborator

jnyfah commented Apr 7, 2026

@JeanPhilippeKernel do you want to merge this before fixing the HandleManager / ABA issue??

@JeanPhilippeKernel
Copy link
Copy Markdown
Owner Author

@jnyfah , yes
This PR is already enough and complex ,

Will handle the ABA stuff separately for clarity

@jnyfah jnyfah merged commit 65d4471 into develop Apr 7, 2026
21 checks passed
@jnyfah jnyfah deleted the user/kernel/fix-command-buffer-manager branch April 7, 2026 15:28
@github-project-automation github-project-automation bot moved this from In Progress to Done in ZEngine Board Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-linux Work on Linux system area-macOS Work on macOS system area-rendering area-window Work on Window system critical

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

CommandBufferManager logic is buggy Make the rendering pipeline multi-threaded

3 participants