Repository navigation
Run the ASCII art playground in real time with WebGPU - #123
Merged
Merged
Conversation
Fit every cell in a WebGPU compute shader each frame, draw the result in a fragment pass, and add camera and video sources. The CPU fit stays as the fallback where WebGPU isn't available. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Draw the glyph atlas both light-on-dark and dark-on-light and blend by the mark's brightness, since browsers draw the two at different weights. Add Wanderer above the Sea of Fog so the camera and upload tiles get their own row. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep WebGPU for the fit, read the cells back each frame, and draw them with the same 2D canvas code as the CPU path so text renders identically. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Ignore fits started before the picture or settings changed, fall back to the CPU fit when a GPU fit fails or the device is lost (stopping any live source first), check texture limits, and accept videos only once WebGPU is ready. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.
The ASCII art playground now fits the picture with a WebGPU compute shader instead of once per change on the CPU. It's fast enough to redo the whole picture every frame, so it can also take a live camera or a video.
What changed
ascii-lab-gpu.js(new): compute-only WebGPU pipeline with three passes:ascii-lab.js: fitted cells are drawn by the same 2D canvas code for both GPU and CPU, so text looks identical. Browsers without WebGPU (or after a GPU failure or device loss) keep the original CPU fit, for still pictures only.Verification
npm run buildpasses.