Remote visualizer window is all black (and errors in console)
Closed, ResolvedPublic

Description

After commit 473b92c29718def86d5140b5fb37fac7f93e3489 the remote visualiser window is now all black and the console displays the below error (also see attached screenshot):

ERROR: ImGui_ImplOpenGL3_CreateDeviceObjects: failed to compile vertex shader!
ERROR: ImGui_ImplOpenGL3_CreateDeviceObjects: failed to compile fragment shader!
ERROR: ImGui_ImplOpenGL3_CreateDeviceObjects: failed to link shader program! (with GLSL '#version 130
')

Undoing the change of the said commit restores the visualizer and gets rid of errors.

System details:
Ubuntu 19.10
g++ (Ubuntu 9.2.1-9ubuntu2) 9.2.1 20191008
libsdl2-2.0-0:amd64 2.0.10+dfsg1-1ubuntu1 amd64
libsdl2-dev 2.0.10+dfsg1-1ubuntu1 amd64
libsdl2-image-2.0-0:amd64 2.0.5+dfsg1-1 amd64
libsdl2-image-dev:amd64 2.0.5+dfsg1-1 amd64

The commit was meant to actually fix the visualiser on older hardware, so reverting it might not be the most desired solution.

Possible solutions:

  • add a startup parameter
  • add automatic fallbacks

Interesting, cannot observe such behaviour on my machine. It has 2 GPUs, Intel and nVidia. Both work, for nVidia i start the app with 'prime-run'.

Can you post the output from 'glxinfo | grep OpenGL', please?

panintended what is your hardware setup (GPU) exactly?

panintended added a comment.EditedApr 20 2020, 1:12 PM

Hmmm, it's looking more and more like a setup-specific issue.

I'm using a VM (running on QEMU/KVM) that I set up specifically for AXIOM-related stuff. I'm using the Video QXL adapter.

$ glxinfo | grep OpenGL
OpenGL vendor string: VMware, Inc.
OpenGL renderer string: llvmpipe (LLVM 9.0, 256 bits)
OpenGL core profile version string: 3.3 (Core Profile) Mesa 19.2.8
OpenGL core profile shading language version string: 3.30
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 3.1 Mesa 19.2.8
OpenGL shading language version string: 1.40
OpenGL context flags: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.0 Mesa 19.2.8
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.00
OpenGL ES profile extensions:
$ lspci -k | grep -EA3 'VGA|3D|Display'
00:01.0 VGA compatible controller: Red Hat, Inc. QXL paravirtual graphic card (rev 04)
	Subsystem: Red Hat, Inc. QEMU Virtual Machine
	Kernel driver in use: qxl
	Kernel modules: qxl

Then I tried the visualizer on my host machine and I actually get the same issue.

Host machine output:

$  glxinfo | grep OpenGL
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) Ivybridge Mobile 
OpenGL core profile version string: 4.2 (Core Profile) Mesa 19.2.8
OpenGL core profile shading language version string: 4.20
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 3.0 Mesa 19.2.8
OpenGL shading language version string: 1.30
OpenGL context flags: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.0 Mesa 19.2.8
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.00
OpenGL ES profile extensions:
$  lspci -k | grep -EA3 'VGA|3D|Display'
00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09)
	Subsystem: Lenovo Device 21fa
	Kernel driver in use: i915
	Kernel modules: i915

Could it be that my host hardware is at fault here and the issue is carried over to the VM because of hardware passthrough?

Hardware looks fine, my output for Intel:

andi@apertus-dev  ~: glxinfo | grep OpenGL 
OpenGL vendor string: Intel
OpenGL renderer string: Mesa Intel(R) HD Graphics 630 (KBL GT2)
OpenGL core profile version string: 4.6 (Core Profile) Mesa 20.0.4
OpenGL core profile shading language version string: 4.60
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 4.6 (Compatibility Profile) Mesa 20.0.4
OpenGL shading language version string: 4.60
OpenGL context flags: (none)
OpenGL profile mask: compatibility profile
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.2 Mesa 20.0.4
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
OpenGL ES profile extensions:

But it's strange that core works better for you. Maybe needs investigation or a flag for compatibility, as the version before fix also worked fine for one of our students.

Automatic fallback through two phase init is probably fit for most machines:

  • Init core OpenGL profile
  • Init ImGUI
  • If last step fails, init compatibility OpenGL profile
  • Init ImGUI

It appears that the issue doesn't lie in the choice of OpenGL core profile, but rather on the OpenGL attributes being set after the SDL_Window object is created (see also: https://wiki.libsdl.org/SDL_GL_SetAttribute#Remarks).

Furthermore, as noted in here, setting SDL_GL_CONTEXT_PROFILE_MASK to 0 leaves the choice of profile up to SDL, which is something worth considering. Any input on this?

On my machine, after moving the SDL_GL_SetAttribute() lines to before the window object is created, all three profile settings work: 0, SDL_GL_CONTEXT_PROFILE_CORE and SDL_GL_CONTEXT_PROFILE_COMPATIBILITY.

Can you give this a shot? Based on this perhaps the choice can be reverted to SDL_GL_CONTEXT_PROFILE_CORE or even to 0

Great analysis, thanks. Would check it with the Ubuntu VM. Do you have a fork with a fix for testing?

Tried and getting OpenGL 2.1 in the terminal output. @panintended Can you check it? No profile worked for me yet, but the order is certainly important.

@BAndiT1983 sure.

  1. I've pushed these changes in my fork so that we're definitely talking about the same code. Let me know if it still doesn't work for you. If you have any stdout/stderr output, please paste it here.
  1. Another way to test a similar setup would be to run this example and see if it works for you (for me it does): AXIOM_Remote_Firmware_Visualizer/3rdParty/imgui/examples/example_sdl_opengl3/main.cpp
  1. Regarding the OpenGL version, is it a requirement to have a version other than 2.1? I'm asking this as the documentation for SDL_GL_SetAttribute() says: "You should use SDL_GL_GetAttribute() to check the values after creating the OpenGL context, since the values obtained can differ from the requested ones.".
sebastian added a comment.EditedMay 2 2020, 2:18 PM

I am back to the black screen now.

glxinfo | grep OpenGL
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) Sandybridge Mobile 
OpenGL core profile version string: 3.3 (Core Profile) Mesa 19.2.8
OpenGL core profile shading language version string: 3.30
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 3.0 Mesa 19.2.8
OpenGL shading language version string: 1.30
OpenGL context flags: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.0 Mesa 19.2.8
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.00
OpenGL ES profile extensions:

Virtualbox VM:

glxinfo | grep OpenGL
OpenGL vendor string: VMware, Inc.
OpenGL renderer string: llvmpipe (LLVM 6.0, 256 bits)
OpenGL core profile version string: 3.3 (Core Profile) Mesa 18.0.5
OpenGL core profile shading language version string: 3.30
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 3.0 Mesa 18.0.5
OpenGL shading language version string: 1.30
OpenGL context flags: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.0 Mesa 18.0.5
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.00
OpenGL ES profile extensions:

Screenshot:

./example_sdl_opengl3

sebastian closed this task as Resolved.May 2 2020, 6:07 PM