YaLTeR/hl-capture

Crash when OpenCL is out of resources

YaLTeR opened this issue · 0 comments

OpenCL can report out of resources on buffer creation, and in particular on .gl_acquire() of the OpenGL texture. Currently this results in a panic; it should fall back to normal capturing.

Example backtrace:

thread '<unnamed>' panicked at 'ocl::Image::from_gl_texture(): 

################################ OPENCL ERROR ############################### 

Error executing function: clCreateFromGLTexture  

Status error code: CL_OUT_OF_RESOURCES (-5)  

Please visit the following url for more information: 

https://www.khronos.org/registry/cl/sdk/1.2/docs/man/xhtml/clCreateFromGLTexture.html#errors  

############################################################################# 
', libcore/result.rs:945:5
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::panicking::default_hook::{{closure}}
             at libstd/sys_common/backtrace.rs:71
   2: std::panicking::rust_panic_with_hook
             at libstd/panicking.rs:227
             at libstd/panicking.rs:511
   3: std::panicking::continue_panic_fmt
             at libstd/panicking.rs:426
   4: rust_begin_unwind
             at libstd/panicking.rs:337
   5: core::panicking::panic_fmt
             at libcore/panicking.rs:92
   6: core::result::unwrap_failed
             at /checkout/src/libcore/macros.rs:26
   7: hl_capture::hooks::hw::capture_frame
             at /checkout/src/libcore/result.rs:809
             at src/hooks/hw.rs:118
             at src/hooks/hw.rs:810
   8: _Z18Sys_VID_FlipScreenv
             at /checkout/src/libcore/ops/function.rs:223
   9: GL_EndRendering
             at ../engine/GL_VIDNT.C:640
  10: SCR_UpdateScreen.part.0
             at ../engine/gl_screen.c:857
  11: _Host_Frame
             at ../engine/host.c:1237
             at ../engine/host.c:1476
  12: Host_Frame
             at ../engine/host.c:1522
  13: _ZN7CEngine5FrameEv
             at ../engine/sys_engine.cpp:245
  14: _Z15RunListenServerPvPcS0_S0_PFP14IBaseInterfacePKcPiES7_
             at ../engine/sys_dll2.cpp:946
  15: _Z15RunListenServerPvPcS0_S0_PFP14IBaseInterfacePKcPiES7_
             at src/hooks/hw.rs:227
  16: main
             at ../launcher/launcher.cpp:439
  17: __libc_start_main
  18: <unknown>