Repository navigation
feat: ghostty-style custom shaders over the window - #1091
Draft
darkwebber wants to merge 1 commit into
Draft
darkwebber wants to merge 1 commit into
darkwebber wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
Opening as a draft to discuss before anyone reviews it in detail: it's bigger than a usual change and touches GPUI. Ghostty users often have
custom-shaderfiles (cursor trails, glow, CRT); this lets a layout run the same files over the Herdr window, unchanged.What it does
"shaders": [paths](relative to the app's folder, or~/).src/shaders.rssupplies Ghostty's prelude and uniforms (iChannel0,iTime,iResolution,iCurrentCursor/iPreviousCursor/iTimeCursorChange,iCurrentCursorColor,iFocus/iTimeFocus,iPalette, the theme's colors). Shaders reload when their files change, compile errors show in a toast, and frames keep coming while the window has focus (likecustom-shader-animation = true).Window::set_post_process_shaders(&[glsl])takes GLSL 450 fragment shaders, andset_post_process_valuesfills their uniform block by member name. The Metal backend translates them with naga (glsl-in, msl-out), draws the scene to an offscreen frame and runs the passes into the drawable. Other backends report that post-processing isn't supported yet; wgpu could do the same with naga's WGSL output.float[4]packed, so offsets after scalar arrays are corrected (with a test).THIRD-PARTY-NOTICESis regenerated for naga's GLSL parser, anddefaults/AGENTS.mddocumentsshaders.Before growing the core
Open questions
Testing
cargo test --lockedpasses; there are new tests inshaders.rs(the prelude with a typical cursor shader validates in naga, palette) and inpost_process.rs(uniform offsets).cursor_blaze_no_trail,cursor_smear, a ripple on cursor jumps and an ambient bloom/vignette: trails follow the cursor, and the unfocused window dims.🤖 Generated with Claude Code