Spector.js icon indicating copy to clipboard operation
Spector.js copied to clipboard

Browser extension not detecting offscreen canvas passed to webworker?

Open kevzettler opened this issue 5 years ago • 14 comments

The browser extension doesn't seem to be detecting my a canvas that I have passed to a webworker

const offscreen = canvas.transferControlToOffscreen();
const worker = new Worker();
worker.postMessage(
  {
    type: "main/canvas-init",
    payload: {
      canvas:  offscreen,
      width: window.innerWidth,
      height: window.innerHeight,
      player: fetchLocalStoragePlayerData(),
    }
  },
  [offscreen]
);

Is this supported? Should I manually use the spector.js lib instead?

kevzettler avatar Apr 02 '20 21:04 kevzettler

Yup unfortunately it is not supported and even the lib would not be working due to the way we capture texture.

As this is getting more and more common, I really need to work on it but I won t have time before a month I guess.

sebavan avatar Apr 02 '20 21:04 sebavan

Thanks @sebavan Any notes on the work needed? Maybe I or other community could hack on it.

kevzettler avatar Apr 02 '20 21:04 kevzettler

Feel free that would be perfect, I would say at first we would need to detect the offscreen and be able to record the calls to them by simply disabling the texture captures (who relies on canvas2D internally).

This would be a great start :-)

sebavan avatar Apr 02 '20 21:04 sebavan

is there any progress of this ticket?

XiaoDiDiDa avatar Jul 13 '22 02:07 XiaoDiDiDa

Not at the moment, would would like to give it a try ?

sebavan avatar Jul 18 '22 12:07 sebavan

It has been three years and I really hope to see this feature implemented

Jeggery avatar Jan 03 '24 17:01 Jeggery

I wish I had more time, but I will not be able to work on it unfortunately. As it is open source, do you want to give it a try ?

sebavan avatar Jan 03 '24 17:01 sebavan

I wish I had more time, but I will not be able to work on it unfortunately. As it is open source, do you want to give it a try ?

This is a lot of difficulty for me, and I still need to delve deeper into the Spector source code and webgl principles

Jeggery avatar Jan 04 '24 02:01 Jeggery

@sebavan I created a PR which might support this feature. https://github.com/BabylonJS/Spector.js/pull/298

@Jeggery Maybe you can have a try.

BTW, the extension is based on Chrome extension manifest versoin 2 which is deprecated and can't be update anymore without upgrading to version 3

junyuecao avatar Jan 11 '24 06:01 junyuecao

Hey @junyuecao. I wanted to test your PR, but I haven't been able to compile your fork locally. I ran npm install and npm run build and I'm getting a lot of typescript errors.

pmhpereira avatar Feb 06 '24 14:02 pmhpereira

@pmhpereira Could you try with npm run start? It works on my Ubuntu 20.04

image

junyuecao avatar Feb 29 '24 06:02 junyuecao

I completely missed all of this !!! I am so sorry @junyuecao I will have a deep look ASAP but it sounds really good !!!

sebavan avatar Feb 29 '24 17:02 sebavan

@sebavan I think the problem is that Google have deprecated the Chrome extesion manifest V2 so the extension can not be updated without updating to V3. I am not that familliar with Chrome extension so I didn't migrate to V3.

junyuecao avatar Mar 01 '24 07:03 junyuecao