0

I am developing a chrome extension that could inform the user of the WebGL usage in the current tab. This helps me to estimate the usage of WebGL on modern websites nowadays.

(I think a trivial approach to this question is to check whether a <canvas> tag is used. But things are getting complicated regarding machine learning (ML) scenarios. Web ML frameworks utilize WebGL with a custom GLSL to accelerate computing. Maybe some static/dynamic analysis of the JavaScript file is needed?)

Adam Han
  • 33
  • 4
  • Maybe this question [proper-way-to-detect-webgl-suppor](https://stackoverflow.com/questions/11871077/proper-way-to-detect-webgl-support) will help you. – bbbbbbbboat Oct 21 '22 at 06:20
  • Thanks for your comment! @bbbbbbbboat Sorry for my poor English misleading you. What this extension wants to know is whether the current tab is **using** a WebGL context for rendering rather than could support WebGL context. ;) – Adam Han Oct 21 '22 at 06:34
  • Sorry I misunderstand your question! I think the approach you mentioned is quite hard and may not work, because using WebGL even doesn't require a real canvas on dom. Or maybe there is some state variable in WebGL context to describe the current working state? I don't know for sure, and hope may help you a little. – bbbbbbbboat Oct 21 '22 at 06:45
  • Appreciate your help @bbbbbbbboat! I found a [website](https://webglfundamentals.org/webgl/lessons/resources/webgl-state-diagram.html) that visually presents the global states of WebGL. Maybe a monitor of the global state or some software analysis techniques is needed! Thanks! – Adam Han Oct 21 '22 at 07:01

0 Answers0