Add a render graph framework for the WebGPU renderer#250
Open
MatzeOGH wants to merge 1 commit into
Open
Conversation
MatzeOGH
force-pushed
the
feature/rendergraph-core
branch
from
July 20, 2026 07:11
7e6683a to
5f77127
Compare
Member
|
Failing pipeline are unrelated unit tests. Review will be for Gerald :) |
MatzeOGH
marked this pull request as ready for review
July 21, 2026 09:15
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a render graph to
webgpu/base(webgpu::rg). Each frame you declare theresources and passes you need. The graph compiles them into an execution order, manages
resource lifetimes, and records the passes into your command encoder.
It handles pass ordering and resource lifetime. It is not a GPU-API wrapper! pass bodies
call
wgpu*functions directly.This PR is the library and its tests. Wiring it into
webgpu_app(Window, renderers,overlays, debug panel) is a separate PR #251 stacked on this one.
How it works
You declare resources and get back a
TextureHandleorBufferHandle, cheap value typesthat name a resource for the current frame. Handles are kind-tagged, so passing a buffer to
sampled()is a compile error rather than a runtime assert.Passes are declared with
add_pass(setup, execute). Setup runs immediately and declareswhat the pass reads and writes through a
PassBuilder: attachments, sampled and storagetextures and buffers, copies. Execute runs later inside
execute(), once passes arescheduled and resources are allocated. It gets a
PassContextthat resolves handles tolive
WGPUTextureandWGPUBufferobjects and records the actual draw, dispatch, and copycommands.
Ordering comes from the declared reads and writes. A pass whose output nothing consumes is
culled unless marked
force_keep().Resources can be transient (pooled and aliased onto shared memory when lifetimes don't
overlap), persistent, imported (the swapchain, for example), or history resources that
ping-pong across frames. Render, compute, and transfer passes are supported, along with
subresource and buffer-range targeting and hash-gated rebakes via
initialize().Files
webgpu/base/RenderGraph.{h,cpp},RenderGraph_internal.hunittests/webgpu_engine/test_RenderGraph.cppdocs/rendergraph.mdwebgpu/baseandunittests/webgpu_enginedocs/rendergraph.mdcovers the architecture and has worked examples.