Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enable WebGL in Android WebView

How to enable WebGL in WebView widget for Android 5.1.1 emulator? I checked WebGL status through Webglreport and the result was "This browser supports WebGL, but it is disabled or unavailable. Sometimes this is the result of older video drivers being rejected by the browser. Try updating your video drivers if possible".

I also tried to use Crosswalk webview on Android 4.4.4 emulator and there were same problems, but I fixed it by adding xwalk-command-line xwalk --ignore-gpu-blacklist. Is it possible to make something similar for standard WebView widget?

like image 962
IronPhoenix Avatar asked Sep 26 '22 10:09

IronPhoenix


1 Answers

UPDATE: The WebView team says WebView does not allow gpu blacklist override, now or in future plans, due to security/stability risks: more details.

//

Chrome for Android 47 and Chromium/WebView 47 use different gpu blacklists and/or bug workarounds. What is allowed to successfully render in one may not be allowed to successfully render in the other even on the same hardware. Both browsers are scheduled to release updates to the Play Store every 6 weeks.

For example: I have a Nexus 10, Mali T-604 tablet (Lollipop 5.1.1. Also, Android Studio 1.5.1 with SDK 6.0 Marshmallow API 23 or 22).

In Chrome for Android --

  • chrome://flags, #ignore-gpu-blacklist NOT enabled, and all reset defaults
  • chrome://gpu, "graphics feature status-WebGL: Hardware accelerated" and Reset notification strategy 0x0000 surprisingly (see this last Crosswalk related) answer
  • webglreport, "This browser supports WebGL 1"
  • get.webgl.org, cube spins

In WebView --

  • webglreport, "This browser supports WebGL 1, but it is disabled or unavailable. Sometimes this is the result of older video drivers being rejected by the browser. Try updating your video drivers if possible."
  • get.webgl.org, "Hmm. While your browser seems to support WebGL, it is disabled or unavailable. If possible, please ensure that you are running the latest drivers for your video card."

chromium blacklist (link from Khronos WebGL blacklist wiki): "GPU rasterization and canvas is blacklisted on Nexus 10".

chromium bug list (link from Khronos WebGL blacklist wiki): "The Mali-Txxx driver does not guarantee flush ordering" and "The Mali-Txxx driver hangs when reading from currently displayed buffer".

The Pixel C tablet has a Nvidia Tegra X1 which does not appear on the chromium lists, and I've confirmed that it does support WebGL in WebView.

like image 143
BeatriceThalo Avatar answered Sep 28 '22 05:09

BeatriceThalo