hongy19’s blog

WSL with gpu accelerator and webgpu


GPU accelerator on WSL need WDDM 2.9 (link). Windows 10 support WDDM from 20H2 (link) but Intel driver only support WDDM > 2.9 from Windows 11 (link). You could use “dxdiag” to check WDDM version on your windows.

My laptop is Intel GPU + Windows 10. Intel driver doesn’t support WDDM v2.9 or later on Windows 10 but it is OK on Windows 11. It means WSL couldn’t support GPU accelerator on Windows 10.

…
Read more ⟶

GCC


some tips when i trying compile opengl programs in conda* g++ -I/home/hongy19/miniconda3/envs/opengl/include/ : include *.h

  • g++ -L/home/hongy19/miniconda3/envs/opengl/lib   :add folder of *.so for link(ld)
  • g++ -lglfw: use libglfw.so for link(ld)
  • LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/hongy19/miniconda3/envs/opengl/lib ./a.out: add library search path for dynamic *.so
  • static compile
  • -static compile for static link need *.a and *.o library and *.so doesn’t work for static compile, see link.  The error of following code is due to missing of *.a or *.o even *.so existed.

(opengl) hongy19@WSL opengl$ gcc glfw-1.cpp -static -lglfw -lGL
/usr/sbin/ld: cannot find -lglfw: No such file or directory
/usr/sbin/ld: cannot find -lGL: No such file or directory
collect2: error: ld returned 1 exit status

…
Read more ⟶

X11 and wayland


 

see Environment variables for Wayland hackers and Wayland-specific environment variables for detail and what is setting in wsl2.

  • WAYLAND_DISPLAY
  • wayland unix socket
  • WAYLAND_DISPLAY=wayland-0
  • XDG_RUNTIME_DIR
  • directory of wayland unix socket
  • XDG_RUNTIME_DIR=/mnt/wslg/runtime-dir/ or XDG_RUNTIME_DIR=/run/user/1000/
  • DISPLAY
  • X11 unix socket
  • DISPLAY=:0 and /tmp/.X11-unix/X0
  • GDK_BACKEND

gtk3/gtk3 in conda has disabled wayland support, see link.  * with pygobject, GDK_BACKEND=wayland doesn’t work but chrome/weston-terminal is OK and pygobject is OK with GDK_BACKEND=wayland, x11 or GDK_BACKEND=x11.

…
Read more ⟶