Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebGL not supported in internal browser #5678

Closed
dmurdoch opened this issue Oct 31, 2019 · 13 comments
Closed

WebGL not supported in internal browser #5678

dmurdoch opened this issue Oct 31, 2019 · 13 comments

Comments

@dmurdoch
Copy link
Contributor

@dmurdoch dmurdoch commented Oct 31, 2019

System details

RStudio Edition :  Desktop
RStudio Version :  1.2.5001 and 1.3.544 daily build
OS Version      :  Windows 10
R Version       : 3.6.1

Steps to reproduce the problem

Run this code:

library(rgl)
example(plot3d)
rglwidget()

Describe the problem in detail

After running example(plot3d) an rgl window opens showing the sample plot. rglwidget() embeds this in an HTML widget to display in the viewer, but nothing appears there.

If I ask the Viewer's Export menu to save as a web page, then the plot is correctly displayed when I view the page in Firefox or Chrome.

When I go into the Viewer pane and right click to select Inspect Element, then choose Console, I see this message:

Uncaught TypeError: Cannot read property 'getExtension' of null

with a reference to a line of the rgl widget Javascript code where the null appears to have come from this.canvas.getContext("webgl") in the rgl widget Javascript code. That indicates that WebGL is not supported in the internal browser. Previous versions of RStudio supported WebGL without this error.

Describe the behavior you expected

The plot should have been displayed in the Viewer.

Diagnostics-Report

The GPU diagnostics show this (among other things):

Graphics Feature Status

  • WebGL: disabled
  • WebGL2: disabled
@kevinushey
Copy link
Contributor

@kevinushey kevinushey commented Oct 31, 2019

Can you share the rest of the GPU diagnostics report?

My best guess is that RStudio has chosen to use software rendering, and unfortunately WebGL is not available when using software rendering in RStudio v1.2.

@dmurdoch
Copy link
Contributor Author

@dmurdoch dmurdoch commented Nov 1, 2019

Yes, your guess is right (diagnostics below). Is there a way to force it to use hardware rendering?

Diagnostics:

Graphics Feature Status
Canvas: Software only. Hardware acceleration disabled
Flash: Software only. Hardware acceleration disabled
Flash Stage3D: Software only. Hardware acceleration disabled
Flash Stage3D Baseline profile: Software only. Hardware acceleration disabled
Compositing: Software only. Hardware acceleration disabled
Multiple Raster Threads: Disabled
Native GpuMemoryBuffers: Software only. Hardware acceleration disabled
Out-of-process Rasterization: Disabled
Hardware Protected Video Decode: Disabled
Rasterization: Software only. Hardware acceleration disabled
Skia Deferred Display List: Disabled
Skia Renderer: Disabled
Surface Synchronization: Disabled
Video Decode: Software only. Hardware acceleration disabled
Viz Service Display Compositor: Disabled
WebGL: Disabled
WebGL2: Disabled

Problems Detected
GPU process was unable to boot: GPU access is disabled through commandline switch --disable-gpu.
Disabled Features: all
Raster is using a single thread.
Disabled Features: multiple_raster_threads
Native GpuMemoryBuffers have been disabled, either via about:flags or command line.
Disabled Features: native_gpu_memory_buffers
Surface synchronization has been disabled by Finch trial or command line.
Disabled Features: surface_synchronization
Viz service display compositor is not enabled by default.
Disabled Features: viz_display_compositor
Skia renderer is not used by default.
Disabled Features: skia_renderer
Skia deferred display list is not used by default.
Disabled Features: skia_deferred_display_list

Version Information
Data exported 2019-11-01T12:19:32.281Z
Chrome version rstudio/1.2.5001.0
Operating system Windows NT 10.0.17134
Software rendering list URL https://chromium.googlesource.com/chromium/src/+/cdec0adf58c577876de3d8f073dce520f0829431/gpu/config/software_rendering_list.json
Driver bug list URL https://chromium.googlesource.com/chromium/src/+/cdec0adf58c577876de3d8f073dce520f0829431/gpu/config/gpu_driver_bug_list.json
ANGLE commit id unknown hash
2D graphics backend Skia/69 e110fd1ebd2d559838c49a8821ebf18986bd6ec2-
Command Line "C:\Program Files\RStudio\bin\rstudio.exe" --enable-gpu --enable-viewport --disable-renderer-accessibility --browser-subprocess-path="C:\Program Files\RStudio\bin\QtWebEngineProcess.exe" --no-sandbox --enable-threaded-compositing --disable-zero-copy --disable-gpu-memory-buffer-compositor-resources --disable-gpu-memory-buffer-video-frames --disable-es3-gl-context --enable-features=AllowContentInitiatedDataUrlNavigations --disable-features=SurfaceSynchronization --disable-features=SurfaceSynchronization,MojoVideoCapture --disable-features=SurfaceSynchronization,MojoVideoCapture,UseVideoCaptureApiForDevToolsSnapshots --disable-gpu

Driver Information
Initialization time 0
In-process GPU true
Passthrough Command Decoder false
Sandboxed false
GPU0 VENDOR = 0x0000, DEVICE= 0x0000
Optimus false
AMD switchable false
Desktop compositing Aero Glass
Direct Composition false
Supports overlays false
Overlay capabilities
Driver D3D12 feature level Not supported
Driver Vulkan API version Not supported
Driver vendor
Driver version
Driver date
Pixel shader version
Vertex shader version
Max. MSAA samples
Machine model name
Machine model version
GL_VENDOR
GL_RENDERER
GL_VERSION
GL_EXTENSIONS
Disabled Extensions
Disabled WebGL Extensions
Window system binding vendor
Window system binding version
Window system binding extensions
Direct rendering Yes
Reset notification strategy 0x0000
GPU process crash count 0

Compositor Information
Tile Update Mode One-copy
Partial Raster Enabled

GpuMemoryBuffers Status
ATC Software only
ATCIA Software only
DXT1 Software only
DXT5 Software only
ETC1 Software only
R_8 Software only
R_16 Software only
RG_88 Software only
BGR_565 Software only
RGBA_4444 Software only
RGBX_8888 GPU_READ, SCANOUT
RGBA_8888 GPU_READ, SCANOUT
BGRX_8888 Software only
BGRX_1010102 Software only
RGBX_1010102 Software only
BGRA_8888 Software only
RGBA_F16 Software only
YVU_420 Software only
YUV_420_BIPLANAR Software only
UYVY_422 Software only

Display(s) Information
Info Display[2528732444] bounds=[0,0 1391x786], workarea=[0,0 1391x746], scale=1, external.
Color space information {primaries:BT709, transfer:IEC61966_2_1, matrix:RGB, range:FULL}
Bits per color component 8
Bits per pixel 24

Video Acceleration Information

Diagnostics
... loading ...

@dmurdoch
Copy link
Contributor Author

@dmurdoch dmurdoch commented Nov 1, 2019

See also these comments on the community page. Not sure this is the same issue, but it looks at least similar:

https://community.rstudio.com/t/rgl-scene-not-showing-in-knitted-html-document-under-rstudio-1-2-5001/43582

@kevinushey
Copy link
Contributor

@kevinushey kevinushey commented Nov 1, 2019

You can force the use of OpenGL in Tools -> Global Options... -> General -> Advanced; e.g. see:

Screen Shot 2019-11-01 at 8 58 35 AM

In particular, setting Rendering engine: Desktop OpenGL should force RStudio to (try to) use the GPU.

Note that we explicitly disable the GPU for certain graphics cards; e.g.

// prefer software rendering for certain graphics cards
std::vector<std::string> blacklist = {
"Intel(R) HD Graphics 520",
"Intel(R) HD Graphics 530",
"Intel(R) HD Graphics 620",
"Intel(R) HD Graphics 630",
};

We were forced to do this because we were seeing lots of RStudio crashes caused by (older, buggier?) Intel drives for these graphics cards. See:

https://www.google.com/search?q=ig9icd64.dll+crash&oq=ig9icd64.dll+&aqs=chrome.0.0j69i57j0l3j69i61.2431j0j4&sourceid=chrome&ie=UTF-8

for a broad overview of other applications affected by this (presuming that you do indeed have one of the affected graphics cards).

@dmurdoch
Copy link
Contributor Author

@dmurdoch dmurdoch commented Nov 1, 2019

I don't have one of those listed cards. I'm running Windows in VirtualBox, so Windows thinks I have a "VirtualBox Graphics Adapter", while in reality in MacOS I have "Intel HD Graphics 6000".

More seriously, when I made the change to force Desktop OpenGL, RStudio would immediately shut down after I started it. This made it hard to undo that change! I didn't mind blowing away my whole RStudio and RStudio-Desktop directories from /Appdata/Local and /Appdata/Roaming, and that reset it. (For next time or other users: it appears only Appdata/Roaming/RStudio was necessary.)

I then tried unchecking "Use GPU Blacklist", but that still had RStudio choosing software rendering, as did unchecking both recommended options.

@kevinushey
Copy link
Contributor

@kevinushey kevinushey commented Nov 1, 2019

Sorry about that. We do document how to get out of this state here:

https://support.rstudio.com/hc/en-us/articles/360017886674-Troubleshooting-RStudio-Rendering-Errors

but obviously that article is not particularly discoverable.

I'm running Windows in VirtualBox, so Windows thinks I have a "VirtualBox Graphics Adapter", while in reality in MacOS I have "Intel HD Graphics 6000".

This may ultimately be the problem. I recall having to switch from Virtualbox to Parallels to get better GPU support in my virtual machines a while back. I know Virtualbox requires you to explicitly turn on 2D / 3D acceleration; if you haven't done this already, you might try this to see if it makes a difference.

@dmurdoch
Copy link
Contributor Author

@dmurdoch dmurdoch commented Nov 1, 2019

I've tried a few things in VirtualBox settings with no luck. Not sure if this is relevant, but running Google Chrome in VirtualBox does support WebGL, and the Advanced System settings say that it is using hardware acceleration if available. (I don't know how to ask for the equivalent of "GPU diagnostics" to find out if it thinks hardware acceleration is available and is actually using it.)

@kevinushey
Copy link
Contributor

@kevinushey kevinushey commented Nov 1, 2019

RStudio does indeed use Chromium under the hood, but through Qt + QtWebEngine, which (as we've discovered) does introduce some other failure modes. We've done our best to untangle most of these, but unfortunately some issues still remain.

@gtritchie
Copy link
Member

@gtritchie gtritchie commented Nov 1, 2019

(I don't know how to ask for the equivalent of "GPU diagnostics" to find out if it thinks hardware acceleration is available and is actually using it.)

In Chrome, go to page chrome://gpu/

@dmurdoch
Copy link
Contributor Author

@dmurdoch dmurdoch commented Nov 1, 2019

Thanks @gtritchie. Chrome is using hardware acceleration in general, and hardware accelerated WebGL.

@mirh
Copy link

@mirh mirh commented Dec 18, 2020

Qt WebEngine is indeed based on chromium, but one important difference is that only with 5.13 they enabled ANGLE.
See also #3573

@gtritchie
Copy link
Member

@gtritchie gtritchie commented Jan 26, 2022

Retest with Electron build.

@ronblum
Copy link
Contributor

@ronblum ronblum commented Jul 14, 2022

Update: As we port RStudio Desktop from the Qt to Electron framework, we're hoping that the switchover resolves the issue. I believe this is working in the Electron version, based on some testing I just did. However, if you're willing to try it out, that would be very helpful.

To try out Electron:

Please note that these are meant for testing and development purposes, not production.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants