mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-25 16:24:24 +00:00
Fix opening of renderdoc lib (#2930)
* Fix opening renderdoc lib Renderdoc needs to not be opened by us, but instead open the existing copy. Unfortunately this requires OS specific flags for opening, plus `libloading` doesn't have full API coverage currently. * Added changelog entry for #2930 * Hide RTLD_NOLOAD behind a cfg for unix Co-authored-by: ABuffSeagull <reecevanatta@hey.com>
This commit is contained in:
parent
a05c8dc2dc
commit
4cbf8cfcf1
@ -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
|
||||
|
||||
|
@ -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::Library, libloading::Error> =
|
||||
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::Library, libloading::Error> =
|
||||
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 {
|
||||
|
Loading…
Reference in New Issue
Block a user