turnage / valora

painting by functions
https://paytonturnage.gitbook.io/valora/
MIT License
704 stars 30 forks source link

Black screen and lots of GL_INVALID_FRAMEBUFFER_OPERATION errors when I try to run the examples. #54

Open akriegman opened 3 years ago

akriegman commented 3 years ago

I made a minimal Valora project by adding valora = "0.2.12" to the dependencies in a new cargo project, and copying the program from the valora guide into main.rs. When I tried to run this I got an empty black window and a steady stream of GL errors. Here is a sample of the output:

    Finished dev [unoptimized + debuginfo] target(s) in 0.19s
     Running `target/debug/valora_junk`
Debug message with high or medium severity: `GL_INVALID_OPERATION in glTexStorage2DMultisample(samples=16)`.
Please report this error: https://github.com/tomaka/glium/issues
Backtrace:
   1 - 0x5649602e94de
         _ZN9backtrace9backtrace9libunwind5trace17h1dbd7b8e3aae1627E at /home/aaron/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.61/src/backtrace/libunwind.rs:90
         _ZN9backtrace9backtrace20trace_unsynchronized17h59576d5589e33ec8E at /home/aaron/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.61/src/backtrace/mod.rs:66
   2 - 0x5649602e9546
         _ZN9backtrace9backtrace5trace17h05cf7957b24f6d68E at /home/aaron/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.61/src/backtrace/mod.rs:53
   3 - 0x56496030001a
         _ZN5glium7context22default_debug_callback17h9bc84650b2a7cf8cE at /home/aaron/.cargo/registry/src/github.com-1ecc6299db9ec823/glium-0.27.0/src/context/mod.rs:853
   4 - 0x56495fe9dcbb
         _ZN4core3ops8function5FnMut8call_mut17hbf61670a50dc5ec0E at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/core/src/ops/function.rs:150
   5 - 0x5649602e949c
         _ZN89_$LT$alloc..boxed..Box$LT$F$C$A$GT$$u20$as$u20$core..ops..function..FnMut$LT$Args$GT$$GT$8call_mut17h550a97bb5515c31cE at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/alloc/src/boxed.rs:1579
   6 - 0x5649603012a3
         _ZN5glium7context19init_debug_callback16callback_wrapper17h97011b4e0de85900E at /home/aaron/.cargo/registry/src/github.com-1ecc6299db9ec823/glium-0.27.0/src/context/mod.rs:940
   7 - 0x7f0ee65852aa
   8 - 0x7f0ee6643be6
   9 - 0x56495feb2d16
         _ZN5glium2gl2Gl23TexStorage2DMultisample17h54c1d5aca02c8964E at /home/aaron/Source/valora_junk/target/debug/build/glium-4598e96a613b3c8c/out/gl_bindings.rs:8320
  10 - 0x56495fe85571
         _ZN5glium7texture3any11new_texture17h6b011cc45ab25a2cE at /home/aaron/.cargo/registry/src/github.com-1ecc6299db9ec823/glium-0.27.0/src/texture/any.rs:367
  11 - 0x56495fe25aa2
         _ZN5glium7texture21texture2d_multisample20Texture2dMultisample17empty_with_format17h43d9ea0fd85801d7E at /home/aaron/Source/valora_junk/target/debug/build/glium-4598e96a613b3c8c/out/textures.rs:6424
  12 - 0x56495fe46add
         _ZN6valora3gpu3Gpu13build_texture17h9d917e02a2eb7187E at /home/aaron/.cargo/registry/src/github.com-1ecc6299db9ec823/valora-0.2.12/src/gpu.rs:245
  13 - 0x56495fde9fab
         _ZN6valora6run_fn17h2fb69f96cfc58080E at /home/aaron/.cargo/registry/src/github.com-1ecc6299db9ec823/valora-0.2.12/src/lib.rs:237
  14 - 0x56495fe16728
         _ZN11valora_junk4main17h96f7096105a2960eE at /home/aaron/Source/valora_junk/src/main.rs:4
  15 - 0x56495fdd347b
         _ZN4core3ops8function6FnOnce9call_once17hb0768378e7ea2531E at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/core/src/ops/function.rs:227
  16 - 0x56495fdd993e
         _ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h6c8da8f4a57db340E at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/sys_common/backtrace.rs:125
  17 - 0x56495fdeecd1
         _ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h9a7dd8f572c2c4a7E at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/rt.rs:63
  18 - 0x564960710c7a
         _ZN4core3ops8function5impls72_$LT$impl$u20$core..ops..function..FnOnce$LT$A$GT$$u20$for$u20$$RF$F$GT$9call_once17ha9408abe89f69dc4E at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/core/src/ops/function.rs:259
         _ZN3std9panicking3try7do_call17h5b0cc9e9102acb65E at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/panicking.rs:401
         _ZN3std9panicking3try17hddc7f8229138b3baE at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/panicking.rs:365
         _ZN3std5panic12catch_unwind17hfa401ff8bab2986eE at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/panic.rs:434
         _ZN3std2rt19lang_start_internal28_$u7b$$u7b$closure$u7d$$u7d$17h8163422320d11405E at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/rt.rs:45
         _ZN3std9panicking3try7do_call17hc742cc7bb4f0fb20E at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/panicking.rs:401
         _ZN3std9panicking3try17ha37d8d2dd1acf7d3E at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/panicking.rs:365
         _ZN3std5panic12catch_unwind17h8a5381d5ecf437bcE at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/panic.rs:434
         _ZN3std2rt19lang_start_internal17h7e2cee8c90d4a4d3E at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/rt.rs:45
  19 - 0x56495fdeeca0
         _ZN3std2rt10lang_start17hc13da72dd702d09eE at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/rt.rs:62
  20 - 0x56495fe1675c
         main at <unknown>:??
  21 - 0x7f0ee92ab0b3
         __libc_start_main at <unknown>:??
  22 - 0x56495fdabfce
         _start at <unknown>:??
  23 - 0x0

Debug message with high or medium severity: `GL_INVALID_FRAMEBUFFER_OPERATION in glDrawElements(incomplete framebuffer)`.
Please report this error: https://github.com/tomaka/glium/issues
Backtrace:
   1 - 0x5649602e94de
         _ZN9backtrace9backtrace9libunwind5trace17h1dbd7b8e3aae1627E at /home/aaron/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.61/src/backtrace/libunwind.rs:90
         _ZN9backtrace9backtrace20trace_unsynchronized17h59576d5589e33ec8E at /home/aaron/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.61/src/backtrace/mod.rs:66
   2 - 0x5649602e9546
         _ZN9backtrace9backtrace5trace17h05cf7957b24f6d68E at /home/aaron/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.61/src/backtrace/mod.rs:53
   3 - 0x56496030001a
         _ZN5glium7context22default_debug_callback17h9bc84650b2a7cf8cE at /home/aaron/.cargo/registry/src/github.com-1ecc6299db9ec823/glium-0.27.0/src/context/mod.rs:853
   4 - 0x56495fe9dcbb
         _ZN4core3ops8function5FnMut8call_mut17hbf61670a50dc5ec0E at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/core/src/ops/function.rs:150
   5 - 0x5649602e949c
         _ZN89_$LT$alloc..boxed..Box$LT$F$C$A$GT$$u20$as$u20$core..ops..function..FnMut$LT$Args$GT$$GT$8call_mut17h550a97bb5515c31cE at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/alloc/src/boxed.rs:1579
   6 - 0x5649603012a3
         _ZN5glium7context19init_debug_callback16callback_wrapper17h97011b4e0de85900E at /home/aaron/.cargo/registry/src/github.com-1ecc6299db9ec823/glium-0.27.0/src/context/mod.rs:940
   7 - 0x7f0ee65852aa
   8 - 0x7f0ee65835dc
   9 - 0x7f0ee6583803
  10 - 0x7f0ee6580ff3
  11 - 0x56495fdb86d9
         _ZN5glium2gl2Gl12DrawElements17hdcc555e8fe262f62E at /home/aaron/Source/valora_junk/target/debug/build/glium-4598e96a613b3c8c/out/gl_bindings.rs:6360
  12 - 0x56495fdc12c4
         _ZN5glium3ops4draw4draw17h8455b34a4acf42a7E at /home/aaron/.cargo/registry/src/github.com-1ecc6299db9ec823/glium-0.27.0/src/ops/draw.rs:258
  13 - 0x56495fde4986
         _ZN72_$LT$glium..framebuffer..SimpleFrameBuffer$u20$as$u20$glium..Surface$GT$4draw17heabc375bcffb02f5E at /home/aaron/.cargo/registry/src/github.com-1ecc6299db9ec823/glium-0.27.0/src/framebuffer/mod.rs:314
  14 - 0x56495fdc8ea2
         _ZN6valora3gpu3Gpu15draw_to_texture17h8a2c8546dbc15dd6E at /home/aaron/.cargo/registry/src/github.com-1ecc6299db9ec823/valora-0.2.12/src/gpu.rs:350
  15 - 0x56495fdc9c6f
         _ZN6valora3gpu3Gpu6render17h51dffbed2aa96fb6E at /home/aaron/.cargo/registry/src/github.com-1ecc6299db9ec823/valora-0.2.12/src/gpu.rs:337
  16 - 0x56495fdd8446
         _ZN6valora6render23Renderer$LT$F1$C$F2$GT$12render_frame17h20b3ea81ea3cc146E at /home/aaron/.cargo/registry/src/github.com-1ecc6299db9ec823/valora-0.2.12/src/render.rs:150
  17 - 0x56495fdd937f
         _ZN6valora6render23Renderer$LT$F1$C$F2$GT$13render_frames17h2d4afd9bcce46542E at /home/aaron/.cargo/registry/src/github.com-1ecc6299db9ec823/valora-0.2.12/src/render.rs:110
  18 - 0x56495fdeb2f7
         _ZN6valora6run_fn17h2fb69f96cfc58080E at /home/aaron/.cargo/registry/src/github.com-1ecc6299db9ec823/valora-0.2.12/src/lib.rs:286
  19 - 0x56495fe16728
         _ZN11valora_junk4main17h96f7096105a2960eE at /home/aaron/Source/valora_junk/src/main.rs:4
  20 - 0x56495fdd347b
         _ZN4core3ops8function6FnOnce9call_once17hb0768378e7ea2531E at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/core/src/ops/function.rs:227
  21 - 0x56495fdd993e
         _ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h6c8da8f4a57db340E at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/sys_common/backtrace.rs:125
  22 - 0x56495fdeecd1
         _ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h9a7dd8f572c2c4a7E at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/rt.rs:63
  23 - 0x564960710c7a
         _ZN4core3ops8function5impls72_$LT$impl$u20$core..ops..function..FnOnce$LT$A$GT$$u20$for$u20$$RF$F$GT$9call_once17ha9408abe89f69dc4E at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/core/src/ops/function.rs:259
         _ZN3std9panicking3try7do_call17h5b0cc9e9102acb65E at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/panicking.rs:401
         _ZN3std9panicking3try17hddc7f8229138b3baE at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/panicking.rs:365
         _ZN3std5panic12catch_unwind17hfa401ff8bab2986eE at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/panic.rs:434
         _ZN3std2rt19lang_start_internal28_$u7b$$u7b$closure$u7d$$u7d$17h8163422320d11405E at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/rt.rs:45
         _ZN3std9panicking3try7do_call17hc742cc7bb4f0fb20E at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/panicking.rs:401
         _ZN3std9panicking3try17ha37d8d2dd1acf7d3E at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/panicking.rs:365
         _ZN3std5panic12catch_unwind17h8a5381d5ecf437bcE at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/panic.rs:434
         _ZN3std2rt19lang_start_internal17h7e2cee8c90d4a4d3E at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/rt.rs:45
  24 - 0x56495fdeeca0
         _ZN3std2rt10lang_start17hc13da72dd702d09eE at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/rt.rs:62
  25 - 0x56495fe1675c
         main at <unknown>:??
  26 - 0x7f0ee92ab0b3
         __libc_start_main at <unknown>:??
  27 - 0x56495fdabfce
         _start at <unknown>:??
  28 - 0x0

The output went on like this for a while. I then tried to run the Valora examples and got similar looking output. I also then ran the examples that came with Glium, and those all worked without any problems.

I am using: Ubuntu 20.04 valora = "0.2.12" rustup toolchain:

stable-x86_64-unknown-linux-gnu (default)
rustc 1.55.0 (c8dfcfe04 2021-09-06)

CPU: AMD Ryzen 7 4000 Running $ glxinfo | grep OpenGL gives:

OpenGL vendor string: AMD
OpenGL renderer string: AMD RENOIR (DRM 3.40.0, 5.11.0-34-generic, LLVM 12.0.0)
OpenGL core profile version string: 4.6 (Core Profile) Mesa 21.0.3
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 21.0.3
OpenGL shading language version string: 4.60
OpenGL context flags: (none)
OpenGL profile mask: compatibility profile

Valora seems like a cool project and I would love to get it working! As a side note, does anyone know why my stack traces are so ugly?

akriegman commented 3 years ago

Update: I found the solution. In valora/src/gpu.rs line 251 I changed the number of samples from 16 to 8. According to the OpenGL docs this value can't be over GL_MAX_SAMPLES. I suppose that was 16 on most people's platforms but 8 on mine. We should probably change this line to use the value of GL_MAX_SAMPLES instead of being fixed so that Valora will be cross platform. I'm not sure how to access this value in Rust. I guess it should be available through Glium, but I can't find anything about it in the docs or in the generated gl_bindings.rs file.