DynamicTexture: getContext() Chrome warning

Hello,
when using DynamicTexture I always get these messages in Chrome:

Canvas2D: Multiple readback operations using getImageData are faster with the willReadFrequently attribute set to true. …

How can I set this attribute in babylonjs?

Thanks

Hello! Can you share a Playground where this is happening?

The second time getImageData() is called, a message is displayed in the console.

It is kind of normal and expected as you are using lots (2… which is not that many) readback then write on the context so Chrome wants to let you know to use the CPU version instead as CPU/GPU go and back are slow.

You should disregard the message in this particular case if you really need to read/write/read/write that frequently.

Usually there is smthg strange about read/write as frequently as the first read could contain most of the info you need.

Thanks for the feedback. I need multiple read/write calls because I’m creating procedural textures that are copied into themselves.
Still, is there a way to set this “willReadFrequently” attribute in BabylonJS?
Thanks

You could use some code like this to control fully the canvas: https://playground.babylonjs.com/#5ZCGRM#4053

Well, there it is, the solution.

Thanks

1 Like