gpuweb / cts

WebGPU Conformance Test Suite
https://gpuweb.github.io/cts/
BSD 3-Clause "New" or "Revised" License
128 stars 79 forks source link

wpt: rendering to hidden canvas #2326

Open austinEng opened 1 year ago

austinEng commented 1 year ago

Various ways a canvas might be hidden

greggman commented 1 year ago

How would a reftest test any of these? If I understand correctly, a ref test is a test where you make 2 HTML pages and compare screenshots. How do you compare blank pages in any useful way? What should these tests do?

austinEng commented 1 year ago

Whoops. I suppose they ought to be op tests then?

Additional things that also come to mind:

greggman commented 1 year ago

canvas texture expiry still occurs

I'm not sure how I can test this. The spec seems to make it ambiguous when a texture will expire. It says

Queue a global task on the automatic expiry task source

It then goes on to say when that task executes could be

  1. Immediately after running any task.
  2. Immediately after running animation frame callbacks.
  3. Immediately before rendering. (which might be never for an un-rendered canvas, un-rendered because it's not visible, offscreen, not in DOM)

Or, maybe 'before rendering' means before rendering the page, not the canvas, in which case I can force a page render in various way. @kainino0x ?, @toji ?

I actually wrote a test, and just waited for timeout (which fits 1 above) and the test passed. I could change it to rAF (that would fit 1 and 2). But for 3?

As for these

AFAICT all I can do here is

Those are already done in src/webgpu/web_platform/canvas/readbackFromWebGPUCanvas.spec.ts though that canvas is always a webgpu canvas that is not in the DOM. I can add "in dom but display: none" and "in dom but positioned offscreen" if you think that's important.

kainino0x commented 1 year ago

I wrote up some stuff about testing this for @shrekshao on https://bugs.chromium.org/p/chromium/issues/detail?id=1404421#c6

kainino0x commented 1 year ago

cc #2385

kainino0x commented 1 year ago

I did a little reading to remember what the heck state we left canvas texture expiry in, and I think I said the wrong thing earlier iiuc officially it's allowed for a canvas texture to not expire if the canvas isn't getting displayed

Also I reopened https://github.com/gpuweb/gpuweb/issues/3295#issuecomment-1461104644 because we need to write stuff about OffscreenCanvas in the spec.