@@ -277,6 +277,18 @@ export default defineCommand({
277277 "memory thrash on constrained machines. Default: auto-detected from " +
278278 "total RAM (<= 8 GB). Env: PRODUCER_LOW_MEMORY_MODE." ,
279279 } ,
280+ "experimental-fast-capture" : {
281+ type : "boolean" ,
282+ description :
283+ "EXPERIMENTAL. Capture frames via Chrome's drawElementImage API " +
284+ "instead of Page.captureScreenshot — reads DOM paint records directly, " +
285+ "~46% faster on GPU. Transparent (PNG) renders on SwiftShader (Docker) " +
286+ "auto-fall back to screenshot capture. Incompatible with page-side " +
287+ "shader compositing. Default: false. Env: PRODUCER_EXPERIMENTAL_FAST_CAPTURE." ,
288+ // No `default` — an omitted flag must stay `undefined` so the `!= null`
289+ // guard below leaves PRODUCER_EXPERIMENTAL_FAST_CAPTURE untouched and the
290+ // env fallback survives (matches the --low-memory-mode idiom).
291+ } ,
280292 } ,
281293 // `run` is the citty handler for `hyperframes render` — sequential flag
282294 // validation + render dispatch. Inherited CRITICAL on main (CRAP 1290);
@@ -393,6 +405,13 @@ export default defineCommand({
393405 process . env . PRODUCER_LOW_MEMORY_MODE = args [ "low-memory-mode" ] ? "true" : "false" ;
394406 }
395407
408+ // ── Override: experimental fast capture (drawElementImage) ───────────
409+ if ( args [ "experimental-fast-capture" ] != null ) {
410+ process . env . PRODUCER_EXPERIMENTAL_FAST_CAPTURE = args [ "experimental-fast-capture" ]
411+ ? "true"
412+ : "false" ;
413+ }
414+
396415 // ── Validate max-concurrent-renders ─────────────────────────────────
397416 if ( args [ "max-concurrent-renders" ] != null ) {
398417 const parsed = parseInt ( args [ "max-concurrent-renders" ] , 10 ) ;
@@ -590,6 +609,7 @@ export default defineCommand({
590609 entryFile,
591610 outputResolution,
592611 pageSideCompositing : args [ "page-side-compositing" ] !== false ,
612+ experimentalFastCapture : args [ "experimental-fast-capture" ] === true ,
593613 pageNavigationTimeoutMs,
594614 protocolTimeout,
595615 playerReadyTimeout,
@@ -643,6 +663,8 @@ interface RenderOptions {
643663 /** Output resolution preset; see `resolveDeviceScaleFactor` for constraints. */
644664 outputResolution ?: CanvasResolution ;
645665 pageSideCompositing ?: boolean ;
666+ /** EXPERIMENTAL. drawElementImage frame capture (--experimental-fast-capture). */
667+ experimentalFastCapture ?: boolean ;
646668 /**
647669 * Puppeteer `page.goto()` timeout for the entry HTML, in milliseconds.
648670 * When omitted, the engine default (60s) applies. Surfaced as
@@ -877,6 +899,7 @@ async function renderDocker(
877899 entryFile : options . entryFile ,
878900 outputResolution : options . outputResolution ,
879901 pageSideCompositing : options . pageSideCompositing ,
902+ experimentalFastCapture : options . experimentalFastCapture ,
880903 pageNavigationTimeoutMs : options . pageNavigationTimeoutMs ,
881904 } ,
882905 } ) ;
0 commit comments