docs: add desktop raw backend WebGPU rendering example#3396
Merged
Conversation
Adds a WebGPU rendering guide for the desktop raw backend, addressing denoland/deno#35579 (request for a simple raw backend example). The new runtime/desktop/webgpu.md walks through wrapping a native window as an UnsafeWindowSurface and drawing to it with WebGPU: a minimal solid-color clear, a hello-triangle render pipeline, and an animated render loop driven by a uniform buffer. It also documents the raw backend gotchas: request the adapter before getNativeWindow(), size and resize the surface, present() every frame, and close() being downgraded to hide() once a surface is taken. Wires the page into the desktop sidebar and index, and cross-links it from the Backends and Windows pages. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
90d9c3d to
df7948e
Compare
bartlomieju
approved these changes
Jul 8, 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.
Closes denoland/deno#35579.
That issue asks for a simple
deno desktopraw backend example. This adds a dedicated WebGPU rendering page to the desktop docs.What's here
New
runtime/desktop/webgpu.mdwalks through drawing to a native window with WebGPU on the raw backend:desktop.backend: "raw"+unstable: ["webgpu"].present()).@builtin(vertex_index)).setTimeout(raw has norequestAnimationFrame), with resize-reconfigure and aclose→Deno.exitguard.getNativeWindow()(it throws otherwise), size/resize the surface,present()every frame, fresh texture per frame, andclose()being downgraded tohide()once a surface is taken.The examples are written fresh rather than reusing the snippet from the issue.
Wiring
runtime/_data.ts) and the section list inruntime/desktop/index.md.backends.mdand the "Native window handle" section ofwindows.md.Testing
api_links_test.ts,sidebar_test.ts, andfrontmatter_test.tsall pass.🤖 Generated with Claude Code