unlimitedbacon / stl-thumb

Thumbnail generator for STL files
MIT License
1.09k stars 93 forks source link

0.3.1 crashes instead of making a thumbnail #12

Closed Goury closed 2 years ago

Goury commented 5 years ago

Just tried new version, it says:

ERROR - 0:1(10): error: GLSL 1.20 is not supported. Supported versions are: 

thread 'main' panicked at 'Compiling shaders', src/lib.rs:110:13

I'm not sure who's fault this is, but just in case: I'm using Nvidia GTX 960 with 390.116 driver on Xorg 1.19.6 I do have some Intel integrated GPU, but it is diabled.

Goury commented 5 years ago

Tried 0.3.0, same result except src/lib.rs:111:13

0.2.0 works fine, but everything is blue T_T

unlimitedbacon commented 5 years ago

Can you try it with the -vv option and post the output? Also, what distro are you on?

fdarling commented 5 years ago

I too have the same problem on Ubuntu 18.04 with an AMD Radeon RX Vega 64 (open source drivers), here is the verbose output:

$ RUST_BACKTRACE=1 stl-thumb -vv 1_LCD_Base_Left.stl out.png
INFO - STL File: 1_LCD_Base_Left.stl
INFO - Thumbnail File: out.png

INFO - Bounds:
INFO - X: -7, 49.497475
Y: 0, 49.497475
Z: -8, 12

INFO - Center:  Point3 [21.248737, 24.748737, 2.0]
INFO - Triangles processed: 1784

INFO - GL Version:   Version(Gl, 2, 1)
INFO - GL Version:   2.1 Mesa 18.2.8
INFO - GLSL Version: Version(Gl, 1, 2)
INFO - Vendor:       Brian Paul
INFO - Renderer      Mesa OffScreen
INFO - Free GPU Mem: None
INFO - Depth Bits:   None

ERROR - 0:1(10): error: GLSL 1.20 is not supported. Supported versions are: 

thread 'main' panicked at 'Compiling shaders', src/lib.rs:110:13
stack backtrace:
   0: <unknown>
   1: <unknown>
   2: <unknown>
   3: <unknown>
   4: std::panicking::rust_panic_with_hook
   5: <unknown>
   6: stl_thumb::run
   7: <unknown>
   8: <unknown>
   9: <unknown>
  10: __rust_maybe_catch_panic
  11: std::rt::lang_start_internal
  12: <unknown>
  13: __libc_start_main
  14: <unknown>
$

Relevant glxinfo:

$ glxinfo | grep OpenGL | grep -i shading
OpenGL core profile shading language version string: 4.50
OpenGL shading language version string: 4.40
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
$
unlimitedbacon commented 5 years ago

Ok. I can replicate this in my Ubuntu VM. I will investigate.

dominickm commented 5 years ago

Same issue on Ubuntu and also was able to get it compiled and on macOS but it throws this error there as well; I know you don't support macOS but I just wanted to point it out. Here's my Ubuntu (PopOS) out. Also on 2.1 Mesa image

and macOS image

dominickm commented 5 years ago

@unlimitedbacon I have a temp fix that I can confirm works on Ubuntu 18.10. May I create a PR? The line causing the issue is main.rs 16 env::set_var("MESA_GL_VERSION_OVERRIDE", "2.1");

unlimitedbacon commented 5 years ago

This line is there to work around an issue we were having on Arch with newer versions of Mesa (https://github.com/unlimitedbacon/stl-thumb/issues/8), so removing it would be bad. There are two possible solutions I see.

  1. Turn that line on/off when packaging for different distros using conditional compilation.
  2. Have stl-thumb detect the version of Mesa available and act accordingly.

This is still very weird, though. Since you are getting a similar error on macOS, I wonder if there is some other underlying issue. GLSL 1.20 is the most widely supported version there is, that's why I'm using it. I don't understand why some platforms would claim it's not supported.

dominickm commented 5 years ago

It is strange and I don't know enough about Arch to speak intelligently on that. I did however, port the shader / vert to 330 for macOS but only for macOS. It seems to me tehre's something weirder going on the OpenGL side of life here. I can try to investigate more possibly later in the week when I have a chance to get an Arch vm up.

Right now the macOS ports but I am 100% sure it breaks Arch, since it removes that env:set line

dominickm commented 5 years ago

Actually, I am using https://github.com/schultyy/os_type to detect for macOS. It says it can detect Arch as well, I wonder if we can just special case Arch in a similar way I am doing mac?

unlimitedbacon commented 5 years ago

That sounds like a good idea. MacOS support would be very exciting.

I think the problem is not with Arch specifically, but with versions of Mesa >= 18.3.3. It would be interesting to see what happens on Ubuntu with a bleeding edge version of Mesa installed.

I would also be very happy to have someone else look into the OpenGL side of things. This is my first OpenGL project and I'm very confused about this.

unlimitedbacon commented 5 years ago

Good news. It works fine with Ubuntu 19.04, which uses Mesa 19.0.2.