Skip to content

feat: integration of finished branches (shader effects, export test fix) - #1209

Closed
EtienneLescot wants to merge 5 commits into
mainfrom
integration/next
Closed

EtienneLescot wants to merge 5 commits into
mainfrom
integration/next

Conversation

@EtienneLescot

@EtienneLescot EtienneLescot commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

The integration branch for finished work: current main, with each finished branch replayed on top in order. It is where the pieces are tested together, and it gives CI to the stacked PRs, which have none while they target another branch.

What it holds

Order PR Branch
1 #1199 shader effects: spec, contract v1, Windows pass feat/shader-effects-contract
2 #1202 shader effects: document model and agent tools feat/shader-effects-document
3 #1207 shader effects: Linux pass feat/shader-effects-linux
4 #1208 flaky exportVideo test fix test/flaky-export-concurrency

How it is kept

  • Rebuilt on main by cherry-picking each branch's commits, so the history stays linear (the repo merges by rebase only).
  • A branch that changes after its review is replayed again; a new finished branch is appended.
  • Each commit is the same change as in its own PR.

Merging. Merging this PR lands every row at once. Each PR in the table then has its commits in main already and should be closed rather than merged. To land them one by one instead, merge the rows in order and rebase this branch after each.

Related issue

None.

Type of change

  • Feature
  • Documentation
  • Refactor / maintenance

Release impact

  • No release note needed: the shader effects have no UI yet

Desktop impact

  • Windows
  • Linux
  • macOS: shader effects compile but do not draw yet

Testing

On this branch, locally:

  • npx tsc --noEmit, npx tsc -p tsconfig.test.json --noEmit, npm run lint (warnings only).
  • npm run test before row 4: everything green but the flaky test that row 4 fixes (it passes alone). The fix itself was run against the full suite on its own branch.
  • Windows: cargo test -p openscreen-compositor -p compositor-view-napi --lib, 445 + 1 passed.
  • Linux, on lavapipe under WSL: cargo test -p openscreen-compositor --lib --tests, 481 passed plus the integration tests.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added agent-assisted shader effects for video timelines, with adjustable parameters and image, text, or combined rendering targets.
    • Effects can respond to frame content, timing, cursor position, and recent clicks. Supported Windows and Linux renderers compile effects in the background during preview and wait for them during export.
    • Added shader validation with error feedback and estimated performance tiers, plus agent tools to create, edit, and inspect effects.
    • Project summaries now report shader-effect region counts.
  • Documentation
    • Added shader-effect authoring guidance, examples, and performance information.

The full design after the Windows spike: the document model (definitions
and clip-anchored regions), the WGSL contract v1 (named params, region
progress, last clicks, footage and camera rects, deterministic hash),
indicative cost tiers instead of budgets, the three targets (image, text,
both), the DSL tools and what agents read back, rendering per platform,
the UI, SSOT and safety, tests and the PR breakdown.
Agent-written WGSL effects (docs/shader-effects.md), the compositor half:
the contract, its validation and the D3D11 pass. The document model and
the agent tools come next.

- shader_fx.rs: contract v1. The agent's code, then a generated FxParams
  struct (named, typed parameters at b3), then the prelude: frame(), ctx
  (resolution, aspect, programme time, region progress, pointer, the last
  four clicks, footage and camera rects in output uv), fx_px, fx_hash.
- Validation walks naga's IR: every loop is a `for` with literal bounds,
  at most 4096 iterations per pixel, refused otherwise with its line. The
  same walk estimates the cost in frame() reads per pixel, as an
  indicative tier; nothing is refused on cost.
- Windows: effects compile off the render thread (naga 24 -> HLSL SM 5.0
  -> FXC), cached by contract, code and parameter layout, 64 kept. Three
  targets: image (before annotations and captions), text (on a
  transparent text layer drawn over the image), both (last); lanes order
  them. The export waits for a compile, the live view skips and then
  recomposes.
- plan_cursor hands effects the pointer and the recent clicks; the napi
  addon gains checkShaderEffect (error, tier, reads, iterations).

Calibrated on an RTX 4070 Ti: about 4 us per frame() read at 1080p and
17 us at 4K; a light effect costs at most 0.06 ms per 1080p frame.
Metal and wgpu parse the effects but do not draw them yet.
Agent-written shader effects (docs/shader-effects.md), the document half:
where an effect lives, how agents write and re-read it, and what the
compositor receives. Stacked on the contract v1 PR.

- Schema: `shaderEffects` (definitions: WGSL code, name, description,
  contract, declared params, cached cost) and `shaderEffectRanges`
  (clip-anchored regions with their values, target and lane). Optional,
  like `vocabulary`: a document without effects carries neither key.
- `RegionKind` gains "shaderEffect" through the whole modifier pipeline,
  so an effect moves, trims and goes with its clip. A definition goes
  with its last region.
- Tools: addEffect (writes and poses, or reuses by effectId), setEffect,
  setEffectDefinition, getEffect; removeModifier removes a region. The
  compositor checks the code first (checkShaderEffect, wired for the MCP
  server and the in-app agent); a compile error comes back at the
  agent's line. Results give the cost tier and a recommendation when a
  tier runs long, never a refusal. One lane holds no overlap.
- getCurrentDocument lists effects and definitions without their code.
- The scene gets each fragment with its definition, normalised values
  and the whole pill's span on the programme clock, so `ctx.region`
  runs across a cut.
- MCP: the resource openscreen://effects/contract holds the full
  contract and two examples; a test keeps it in step with the prelude
  and a Rust test compiles its examples.
- `openscreen info` counts effects; a workbench scenario (ripple on
  click) and document invariants for effects; the demo skill and the
  architecture docs say how it works.
The wgpu compositor now draws agent-written effects, as the Windows one does:
same targets (image, text layer, both), same lanes, same blocking rule
(the export waits for the pipeline, the live view skips it until it lands).

- The WGSL goes to wgpu as it is. A background thread builds the module and
  the pipeline against an explicit layout of the prelude's four bindings.
- wgpu panics on a validation error: `analyze` now also refuses any binding
  the prelude does not declare, so nothing invalid reaches it.
- `check_for_agent` translates the effect to SPIR-V on Linux.
- live.rs turns the preview's non-blocking mode on for Linux too.

Tested on lavapipe under WSL: the six GPU tests of the Windows pass, ported,
and the full compositor suite. Tier calibration on lavapipe goes to
rendering-performance.md and the spec (C.7, H.2).
Two exportVideo tests slept 20 ms and assumed the first export was running by then. Under the full suite's load it was not, and the second call was not refused. The fake runner now resolves a promise when a held export starts, which is after the server marked it running and read the project.
@coderabbitai

coderabbitai Bot commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 955b2af2-bd49-4e68-8db4-58d68335089a
📥 Commits

Reviewing files that changed from the base of the PR and between c541fff and 9f445cd.

⛔ Files ignored due to path filters: 1
  • crates/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing: 47
  • crates/Cargo.toml
  • crates/compositor-view-napi/src/lib.rs
  • crates/compositor/Cargo.toml
  • crates/compositor/src/compositor_linux.rs
  • crates/compositor/src/compositor_windows.rs
  • crates/compositor/src/frame_geometry.rs
  • crates/compositor/src/lib.rs
  • crates/compositor/src/live.rs
  • crates/compositor/src/scene.rs
  • crates/compositor/src/shader_fx.rs
  • docs/shader-effects.md
  • electron/ai-edition/agent-tools.test.ts
  • electron/ai-edition/agent-tools.ts
  • electron/ai-edition/chat-service.ts
  • electron/ai-edition/deep-agent/service.test.ts
  • electron/ai-edition/deep-agent/service.ts
  • electron/cli/projectCommands.test.ts
  • electron/cli/projectCommands.ts
  • electron/ipc/handlers.ts
  • electron/mcp/effects-contract.test.ts
  • electron/mcp/effects-contract.ts
  • electron/mcp/media-tools.test.ts
  • electron/mcp/openscreen-mcp-server.ts
  • electron/native-bridge/services/compositorViewService.ts
  • electron/native/compositor-view/addon.d.ts
  • skills/openscreen-demo/SKILL.md
  • src/components/ai-edition/NewEditorShell.tsx
  • src/lib/ai-edition/document/timeline.test.ts
  • src/lib/ai-edition/document/timeline.ts
  • src/lib/ai-edition/schema/index.test.ts
  • src/lib/ai-edition/schema/index.ts
  • src/lib/ai-edition/shaderEffects.ts
  • src/lib/ai-edition/store/useTimeline.test.ts
  • src/native/sceneDescription.test.ts
  • src/native/sceneDescription.ts
  • technical-documentation/architecture/ai-agent.md
  • technical-documentation/architecture/decisions.md
  • technical-documentation/architecture/document-model.md
  • technical-documentation/architecture/editor-shell.md
  • technical-documentation/architecture/mcp-server.md
  • technical-documentation/architecture/native-compositor.md
  • technical-documentation/architecture/timeline-model.md
  • technical-documentation/engineering/rendering-performance.md
  • workbench/lib/editorial.ts
  • workbench/lib/oracles.ts
  • workbench/scenarios/effect-ripple-on-click.scn.ts
  • workbench/scenarios/registry.ts
 ______________________________________________________________
< I had to scroll so far I hit the heat death of the universe. >
 --------------------------------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@EtienneLescot

Copy link
Copy Markdown
Collaborator Author

Superseded by #1210: the branch was renamed to integration/shader-effects and scoped to the shader effects feature (the test fix stays in #1208).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant