|
9 | 9 | type HfHueCurvePoint, |
10 | 10 | } from "@hyperframes/core/color-grading"; |
11 | 11 | import { findSystemBrowser } from "../browser/manager.js"; |
| 12 | +import { seekInPage } from "./captureCompositionFrame.js"; |
12 | 13 |
|
13 | 14 | interface GradingTestApi { |
14 | 15 | setGrading(target: string, grading: HfColorGrading): boolean; |
@@ -195,6 +196,33 @@ describe.skipIf(!runsChromium)("color grading curves in Chromium", () => { |
195 | 196 | expect(actual).toEqual([128, 0, 0, 255]); |
196 | 197 | expect(browserErrors).toEqual([]); |
197 | 198 | }); |
| 199 | + |
| 200 | + // fails without the fix: every no-draw seek re-uploaded the image, a GPU copy each until check's batch ended. |
| 201 | + it("uploads no source frame during check's no-draw seeks, and one on the next drawn seek", async () => { |
| 202 | + const uploads = await page.evaluate(`(() => { |
| 203 | + const proto = WebGLRenderingContext.prototype; |
| 204 | + const upload = proto.texImage2D; |
| 205 | + let count = 0; |
| 206 | + proto.texImage2D = function (...args) { |
| 207 | + if (args.length === 6) count += 1; |
| 208 | + return Reflect.apply(upload, this, args); |
| 209 | + }; |
| 210 | + window.__timelines = { main: { pause() {}, seek() { window.__gradingTestRuntime.redraw(); } } }; |
| 211 | + const seek = ${seekInPage}; |
| 212 | + try { |
| 213 | + for (let time = 1; time <= 8; time++) seek(time, true, false, true); |
| 214 | + const gated = count; |
| 215 | + count = 0; |
| 216 | + seek(9, true, false, false); |
| 217 | + return [gated, count]; |
| 218 | + } finally { |
| 219 | + proto.texImage2D = upload; |
| 220 | + delete window.__timelines; |
| 221 | + } |
| 222 | + })()`); |
| 223 | + expect(uploads).toEqual([0, 1]); |
| 224 | + expect(browserErrors).toEqual([]); |
| 225 | + }); |
198 | 226 | }); |
199 | 227 |
|
200 | 228 | describe.skipIf(!runsChromium)("a grade group in Chromium", () => { |
|
0 commit comments