diff --git a/CHANGELOG.md b/CHANGELOG.md index 793fc9405..e4a2bd1f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -60,6 +60,7 @@ the same every time it is rendered, we now warn if it is missing. #### General - Improve the validation and error reporting of buffer mappings by @nical in [#2848](https://github.com/gfx-rs/wgpu/pull/2848) +- Fixed opening of RenderDoc library by @abuffseagull in [#2930](https://github.com/gfx-rs/wgpu/pull/2930) ### Changes diff --git a/wgpu-hal/src/auxil/renderdoc.rs b/wgpu-hal/src/auxil/renderdoc.rs index cbe3c1908..712eac418 100644 --- a/wgpu-hal/src/auxil/renderdoc.rs +++ b/wgpu-hal/src/auxil/renderdoc.rs @@ -28,6 +28,10 @@ pub enum RenderDoc { }, } +// TODO: replace with libloading API once supported +#[cfg(unix)] +const RTLD_NOLOAD: i32 = 0x4; + impl RenderDoc { pub unsafe fn new() -> Self { type GetApiFn = unsafe extern "C" fn(version: u32, out: *mut *mut ffi::c_void) -> i32; @@ -39,7 +43,20 @@ impl RenderDoc { #[cfg(target_os = "android")] let renderdoc_filename = "libVkLayer_GLES_RenderDoc.so"; - let renderdoc_lib = match libloading::Library::new(renderdoc_filename) { + #[cfg(unix)] + let renderdoc_result: Result = + libloading::os::unix::Library::open( + Some(renderdoc_filename), + libloading::os::unix::RTLD_NOW | RTLD_NOLOAD, + ) + .map(|lib| lib.into()); + + #[cfg(windows)] + let renderdoc_result: Result = + libloading::os::windows::Library::open_already_loaded(renderdoc_filename) + .map(|lib| lib.into()); + + let renderdoc_lib = match renderdoc_result { Ok(lib) => lib, Err(e) => { return RenderDoc::NotAvailable {