mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-11 14:50:02 +00:00
fix(shader-transitions,producer): harden CSS-only transition lifecycle and unblock CI
Three follow-on fixes after the optional-shader change rebased onto current main (PR #832 introduced page-side compositing and the producer's hf#732 layered pipeline since this PR was opened). shader-transitions/hyper-shader.ts - Treat `cache.prog === null` as the canonical immutable marker for CSS-only transitions via a new `isCssOnlyTransition()` helper. - `disposeCachedTransition()` now restores the always-ready CSS fallback state for prog=null caches instead of zeroing `fallback`/`ready` — the previous behaviour, combined with `markScenesDirty()` re-running the prewarm/capture pipeline, could put a CSS-only cache through the WebGL path and reach `renderShader(state.prog!)` with a null prog (Copilot review on lines 1168 + 1319). - `markScenesDirty()` skips CSS-only caches; they have no shader to recompile and no texture pyramid to recapture. - `ensureTransitionCachesReady()` filters CSS-only caches out of the prewarm work list. - `tickShader()` now routes on `cache.fallback || cache.prog === null` and threads a narrowed non-null `prog` local into `renderShader()`, removing the unsound `state.prog!` non-null assertion. - `initEngineMode()` filters CSS-only transitions before passing them to `installPageSideCompositor()`, which expects `shader: ShaderName` (required). Page-side compositing is shader-only; CSS crossfades stay on the GSAP opacity timeline. producer/render/stages/captureHdrHybridLoop.ts producer/render/stages/captureHdrSequentialLoop.ts - Guard `activeTransition.shader` against undefined: when omitted, route the Node-side blend through `crossfade` (the engine's canonical opacity blend, equivalent to `applyFallbackTransition()` on the page). - The hybrid path also bypasses the worker pool when `shaderName` is absent and runs `crossfade` inline. This addresses the Copilot review comments and unblocks the 5 failing CI jobs (Build, Typecheck, CLI smoke, Windows tests, Windows render) which all rooted in 4 TS errors at these exact sites. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -260,11 +260,17 @@ export async function runHybridLayeredFrameLoop(input: HybridLoopInput): Promise
|
||||
// awaits it. The encoder reorder buffer fences ordering so out-
|
||||
// of-order blend completion is fine.
|
||||
const frameIdx = i;
|
||||
// When the @hyperframes/shader-transitions composition omits the
|
||||
// shader on a transition entry, it requests a CSS crossfade. The
|
||||
// engine-side path uses applyFallbackTransition() on the page; the
|
||||
// producer's Node-side layered pipeline runs the equivalent here
|
||||
// by routing the blend through `crossfade`.
|
||||
const shaderName = activeTransition.shader;
|
||||
const dispatch: Promise<void> = (async () => {
|
||||
if (poolRef) {
|
||||
if (poolRef && shaderName) {
|
||||
const blendStart = Date.now();
|
||||
const result = await poolRef.run({
|
||||
shader: activeTransition.shader,
|
||||
shader: shaderName,
|
||||
bufferA: buffers.bufferA,
|
||||
bufferB: buffers.bufferB,
|
||||
output: buffers.output,
|
||||
@@ -277,7 +283,9 @@ export async function runHybridLayeredFrameLoop(input: HybridLoopInput): Promise
|
||||
buffers.output = result.output;
|
||||
addHdrTiming(hdrPerf, "transitionCompositeMs", blendStart);
|
||||
} else {
|
||||
const transitionFn: TransitionFn = TRANSITIONS[activeTransition.shader] ?? crossfade;
|
||||
const transitionFn: TransitionFn = shaderName
|
||||
? (TRANSITIONS[shaderName] ?? crossfade)
|
||||
: crossfade;
|
||||
const blendStart = Date.now();
|
||||
transitionFn(
|
||||
buffers.bufferA,
|
||||
|
||||
@@ -172,7 +172,13 @@ export async function runSequentialLayeredFrameLoop(input: SequentialLoopInput):
|
||||
});
|
||||
}
|
||||
|
||||
const transitionFn: TransitionFn = TRANSITIONS[activeTransition.shader] ?? crossfade;
|
||||
// CSS-crossfade transitions (shader omitted in the composition) take
|
||||
// the same Node-side blend path — `crossfade` is the engine's
|
||||
// canonical opacity blend, equivalent to applyFallbackTransition().
|
||||
const shaderName = activeTransition.shader;
|
||||
const transitionFn: TransitionFn = shaderName
|
||||
? (TRANSITIONS[shaderName] ?? crossfade)
|
||||
: crossfade;
|
||||
transitionFn(
|
||||
transitionBuffers.bufferA,
|
||||
transitionBuffers.bufferB,
|
||||
|
||||
Reference in New Issue
Block a user