Merged
Conversation
|
pkg.pr.new packages benchmark commit |
📊 Bundle Size Comparison
👀 Notable resultsStatic test results:No major changes. Dynamic test results:No major changes. 📋 All resultsClick to reveal the results table (331 entries).
If you wish to run a comparison for other, slower bundlers, run the 'Tree-shake test' from the GitHub Actions menu. |
There was a problem hiding this comment.
Pull request overview
Adds a root.configureContext helper to reduce repeated WebGPU canvas setup boilerplate across TypeGPU examples and documentation.
Changes:
- Introduces
ConfigureContextOptionsand addsTgpuRoot.configureContext(...)to the public root API. - Implements
configureContextinTgpuRootImpland configures the canvas with TypeGPU defaults. - Updates docs/tutorials/examples to use
root.configureContext(...)instead of manually callinggetContext('webgpu')+configure(...).
Reviewed changes
Copilot reviewed 63 out of 63 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/typegpu/src/core/root/rootTypes.ts | Adds the ConfigureContextOptions type and the configureContext method to the TgpuRoot interface. |
| packages/typegpu/src/core/root/init.ts | Implements TgpuRootImpl.configureContext and configures the canvas context with defaults. |
| apps/typegpu-docs/src/examples/tests/uniformity/index.ts | Replaces manual canvas context configuration with root.configureContext. |
| apps/typegpu-docs/src/examples/tests/texture-test/index.ts | Replaces manual canvas context configuration with root.configureContext. |
| apps/typegpu-docs/src/examples/tests/log-test/index.ts | Replaces manual canvas context configuration with root.configureContext (including inside controls). |
| apps/typegpu-docs/src/examples/simulation/wind-map/index.ts | Replaces manual canvas context configuration with root.configureContext. |
| apps/typegpu-docs/src/examples/simulation/stable-fluid/index.ts | Replaces manual canvas context configuration with root.configureContext. |
| apps/typegpu-docs/src/examples/simulation/slime-mold/index.ts | Replaces manual canvas context configuration with root.configureContext. |
| apps/typegpu-docs/src/examples/simulation/slime-mold-3d/index.ts | Replaces manual canvas context configuration with root.configureContext. |
| apps/typegpu-docs/src/examples/simulation/gravity/index.ts | Uses root.configureContext and reorders init/context setup accordingly. |
| apps/typegpu-docs/src/examples/simulation/game-of-life/index.ts | Uses root.configureContext and reorders init/context setup accordingly. |
| apps/typegpu-docs/src/examples/simulation/fluid-with-atomics/index.ts | Replaces manual canvas context configuration with root.configureContext. |
| apps/typegpu-docs/src/examples/simulation/fluid-double-buffering/index.ts | Replaces manual canvas context configuration with root.configureContext. |
| apps/typegpu-docs/src/examples/simulation/confetti/index.ts | Replaces manual canvas context configuration with root.configureContext. |
| apps/typegpu-docs/src/examples/simulation/boids/index.ts | Replaces manual canvas context configuration with root.configureContext. |
| apps/typegpu-docs/src/examples/simple/vaporrave/index.ts | Uses root.configureContext and reorders init/context setup accordingly. |
| apps/typegpu-docs/src/examples/simple/triangle/index.ts | Replaces manual canvas context configuration with root.configureContext. |
| apps/typegpu-docs/src/examples/simple/stencil/index.ts | Replaces manual canvas context configuration with root.configureContext. |
| apps/typegpu-docs/src/examples/simple/square/index.ts | Uses root.configureContext and reorders init/context setup accordingly. |
| apps/typegpu-docs/src/examples/simple/oklab/index.ts | Uses root.configureContext and reorders init/context setup accordingly. |
| apps/typegpu-docs/src/examples/simple/liquid-glass/index.ts | Replaces manual canvas context configuration with root.configureContext. |
| apps/typegpu-docs/src/examples/simple/gradient-tiles/index.ts | Replaces manual canvas context configuration with root.configureContext. |
| apps/typegpu-docs/src/examples/rendering/xor-dev-runner/index.ts | Replaces manual canvas context configuration with root.configureContext. |
| apps/typegpu-docs/src/examples/rendering/xor-dev-centrifuge-2/index.ts | Replaces manual canvas context configuration with root.configureContext. |
| apps/typegpu-docs/src/examples/rendering/two-boxes/index.ts | Replaces manual canvas context configuration with root.configureContext. |
| apps/typegpu-docs/src/examples/rendering/simple-shadow/index.ts | Replaces manual canvas context configuration with root.configureContext. |
| apps/typegpu-docs/src/examples/rendering/ray-marching/index.ts | Uses root.configureContext and reorders init/context setup accordingly. |
| apps/typegpu-docs/src/examples/rendering/point-light-shadow/index.ts | Replaces manual canvas context configuration with root.configureContext. |
| apps/typegpu-docs/src/examples/rendering/phong-reflection/index.ts | Uses root.configureContext and reorders init/context setup accordingly. |
| apps/typegpu-docs/src/examples/rendering/perlin-noise/index.ts | Replaces manual canvas context configuration with root.configureContext. |
| apps/typegpu-docs/src/examples/rendering/jelly-switch/index.ts | Uses root.configureContext and reorders init/context setup accordingly. |
| apps/typegpu-docs/src/examples/rendering/jelly-slider/index.ts | Uses root.configureContext and reorders init/context setup accordingly. |
| apps/typegpu-docs/src/examples/rendering/function-visualizer/index.ts | Replaces manual canvas context configuration with root.configureContext. |
| apps/typegpu-docs/src/examples/rendering/disco/index.ts | Uses root.configureContext and reorders init/context setup accordingly. |
| apps/typegpu-docs/src/examples/rendering/cubemap-reflection/index.ts | Replaces manual canvas context configuration with root.configureContext. |
| apps/typegpu-docs/src/examples/rendering/clouds/index.ts | Uses root.configureContext and reorders init/context setup accordingly. |
| apps/typegpu-docs/src/examples/rendering/caustics/index.ts | Replaces manual canvas context configuration with root.configureContext. |
| apps/typegpu-docs/src/examples/rendering/box-raytracing/index.ts | Uses root.configureContext and reorders init/context setup accordingly. |
| apps/typegpu-docs/src/examples/rendering/3d-fish/index.ts | Uses root.configureContext and reorders init/context setup accordingly. |
| apps/typegpu-docs/src/examples/image-processing/image-tuning/index.ts | Replaces manual canvas context configuration with root.configureContext. |
| apps/typegpu-docs/src/examples/image-processing/chroma-keying/index.ts | Replaces manual canvas context configuration with root.configureContext. |
| apps/typegpu-docs/src/examples/image-processing/camera-thresholding/index.ts | Replaces manual canvas context configuration with root.configureContext. |
| apps/typegpu-docs/src/examples/image-processing/blur/index.ts | Replaces manual canvas context configuration with root.configureContext. |
| apps/typegpu-docs/src/examples/image-processing/background-segmentation/index.ts | Replaces manual canvas context configuration with root.configureContext. |
| apps/typegpu-docs/src/examples/image-processing/ascii-filter/index.ts | Replaces manual canvas context configuration with root.configureContext. |
| apps/typegpu-docs/src/examples/algorithms/jump-flood-voronoi/index.ts | Replaces manual canvas context configuration with root.configureContext. |
| apps/typegpu-docs/src/examples/algorithms/jump-flood-distance/index.ts | Replaces manual canvas context configuration with root.configureContext. |
| apps/typegpu-docs/src/content/docs/tutorials/triangle-to-boids/code/step9-webgpu.ts | Updates tutorial code to use root.configureContext. |
| apps/typegpu-docs/src/content/docs/tutorials/triangle-to-boids/code/step9-typegpu.ts | Updates tutorial code to use root.configureContext. |
| apps/typegpu-docs/src/content/docs/tutorials/triangle-to-boids/code/step8-typegpu.ts | Updates tutorial code to use root.configureContext. |
| apps/typegpu-docs/src/content/docs/tutorials/triangle-to-boids/code/step7-typegpu.ts | Updates tutorial code to use root.configureContext. |
| apps/typegpu-docs/src/content/docs/tutorials/triangle-to-boids/code/step6-typegpu.ts | Updates tutorial code to use root.configureContext. |
| apps/typegpu-docs/src/content/docs/tutorials/triangle-to-boids/code/step5-webgpu.ts | Updates tutorial code to use root.configureContext. |
| apps/typegpu-docs/src/content/docs/tutorials/triangle-to-boids/code/step5-typegpu.ts | Updates tutorial code to use root.configureContext. |
| apps/typegpu-docs/src/content/docs/tutorials/triangle-to-boids/code/step4-webgpu.ts | Updates tutorial code to use root.configureContext. |
| apps/typegpu-docs/src/content/docs/tutorials/triangle-to-boids/code/step4-typegpu.ts | Updates tutorial code to use root.configureContext. |
| apps/typegpu-docs/src/content/docs/tutorials/triangle-to-boids/code/step3-typegpu.ts | Updates tutorial code to use root.configureContext. |
| apps/typegpu-docs/src/content/docs/tutorials/triangle-to-boids/code/step2-webgpu.ts | Updates tutorial code to use root.configureContext. |
| apps/typegpu-docs/src/content/docs/tutorials/triangle-to-boids/code/step2-typegpu.ts | Updates tutorial code to use root.configureContext. |
| apps/typegpu-docs/src/content/docs/tutorials/triangle-to-boids/code/step1side-typegpu.ts | Updates tutorial code to use root.configureContext. |
| apps/typegpu-docs/src/content/docs/tutorials/triangle-to-boids/code/step1-webgpu.ts | Updates tutorial code to use root.configureContext. |
| apps/typegpu-docs/src/content/docs/tutorials/triangle-to-boids/code/step1-typegpu.ts | Updates tutorial code to use root.configureContext. |
| apps/typegpu-docs/src/content/docs/fundamentals/roots.mdx | Documents root.configureContext and updates root/context setup guidance. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
iwoplaza
reviewed
Jan 28, 2026
iwoplaza
reviewed
Jan 28, 2026
iwoplaza
approved these changes
Jan 28, 2026
Collaborator
iwoplaza
left a comment
There was a problem hiding this comment.
Awesome!
(just a few nits)
Co-authored-by: Iwo Plaza <iwoplaza@gmail.com>
cieplypolar
approved these changes
Jan 29, 2026
reczkok
approved these changes
Jan 29, 2026
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.
See #2031 for reference.
This PR only contains the
root.configureContext, we'll do render pipeline defaults in another PR.