extensions/amd: Remove unnecessary CString allocations in fn load
Following the changes in a053c6a
("Remove unnecessary CString allocation
when loading functions (#379)") this addresses the remainder of string
allocations in manual extension loading code.
This commit is contained in:
parent
ab36e84bac
commit
57303f52dc
1 changed files with 35 additions and 33 deletions
|
@ -409,9 +409,9 @@ impl AmdGpaInterfaceFn {
|
|||
stringify!(create_gpa_session_amd)
|
||||
))
|
||||
}
|
||||
let raw_name = stringify!(vkCreateGpaSessionAMD);
|
||||
let cname = ::std::ffi::CString::new(raw_name).unwrap();
|
||||
let val = _f(&cname);
|
||||
let cname =
|
||||
::std::ffi::CStr::from_bytes_with_nul_unchecked(b"vkCreateGpaSessionAMD\0");
|
||||
let val = _f(cname);
|
||||
if val.is_null() {
|
||||
create_gpa_session_amd
|
||||
} else {
|
||||
|
@ -429,9 +429,9 @@ impl AmdGpaInterfaceFn {
|
|||
stringify!(destroy_gpa_session_amd)
|
||||
))
|
||||
}
|
||||
let raw_name = stringify!(vkDestroyGpaSessionAMD);
|
||||
let cname = ::std::ffi::CString::new(raw_name).unwrap();
|
||||
let val = _f(&cname);
|
||||
let cname =
|
||||
::std::ffi::CStr::from_bytes_with_nul_unchecked(b"vkDestroyGpaSessionAMD\0");
|
||||
let val = _f(cname);
|
||||
if val.is_null() {
|
||||
destroy_gpa_session_amd
|
||||
} else {
|
||||
|
@ -448,9 +448,10 @@ impl AmdGpaInterfaceFn {
|
|||
stringify!(set_gpa_device_clock_mode_amd)
|
||||
))
|
||||
}
|
||||
let raw_name = stringify!(vkSetGpaDeviceClockModeAMD);
|
||||
let cname = ::std::ffi::CString::new(raw_name).unwrap();
|
||||
let val = _f(&cname);
|
||||
let cname = ::std::ffi::CStr::from_bytes_with_nul_unchecked(
|
||||
b"vkSetGpaDeviceClockModeAMD\0",
|
||||
);
|
||||
let val = _f(cname);
|
||||
if val.is_null() {
|
||||
set_gpa_device_clock_mode_amd
|
||||
} else {
|
||||
|
@ -467,9 +468,9 @@ impl AmdGpaInterfaceFn {
|
|||
stringify!(cmd_begin_gpa_session_amd)
|
||||
))
|
||||
}
|
||||
let raw_name = stringify!(vkCmdBeginGpaSessionAMD);
|
||||
let cname = ::std::ffi::CString::new(raw_name).unwrap();
|
||||
let val = _f(&cname);
|
||||
let cname =
|
||||
::std::ffi::CStr::from_bytes_with_nul_unchecked(b"vkCmdBeginGpaSessionAMD\0");
|
||||
let val = _f(cname);
|
||||
if val.is_null() {
|
||||
cmd_begin_gpa_session_amd
|
||||
} else {
|
||||
|
@ -486,9 +487,9 @@ impl AmdGpaInterfaceFn {
|
|||
stringify!(cmd_end_gpa_session_amd)
|
||||
))
|
||||
}
|
||||
let raw_name = stringify!(vkCmdEndGpaSessionAMD);
|
||||
let cname = ::std::ffi::CString::new(raw_name).unwrap();
|
||||
let val = _f(&cname);
|
||||
let cname =
|
||||
::std::ffi::CStr::from_bytes_with_nul_unchecked(b"vkCmdEndGpaSessionAMD\0");
|
||||
let val = _f(cname);
|
||||
if val.is_null() {
|
||||
cmd_end_gpa_session_amd
|
||||
} else {
|
||||
|
@ -507,9 +508,9 @@ impl AmdGpaInterfaceFn {
|
|||
stringify!(cmd_begin_gpa_sample_amd)
|
||||
))
|
||||
}
|
||||
let raw_name = stringify!(vkCmdBeginGpaSampleAMD);
|
||||
let cname = ::std::ffi::CString::new(raw_name).unwrap();
|
||||
let val = _f(&cname);
|
||||
let cname =
|
||||
::std::ffi::CStr::from_bytes_with_nul_unchecked(b"vkCmdBeginGpaSampleAMD\0");
|
||||
let val = _f(cname);
|
||||
if val.is_null() {
|
||||
cmd_begin_gpa_sample_amd
|
||||
} else {
|
||||
|
@ -527,9 +528,9 @@ impl AmdGpaInterfaceFn {
|
|||
stringify!(cmd_end_gpa_sample_amd)
|
||||
))
|
||||
}
|
||||
let raw_name = stringify!(vkCmdEndGpaSampleAMD);
|
||||
let cname = ::std::ffi::CString::new(raw_name).unwrap();
|
||||
let val = _f(&cname);
|
||||
let cname =
|
||||
::std::ffi::CStr::from_bytes_with_nul_unchecked(b"vkCmdEndGpaSampleAMD\0");
|
||||
let val = _f(cname);
|
||||
if val.is_null() {
|
||||
cmd_end_gpa_sample_amd
|
||||
} else {
|
||||
|
@ -546,9 +547,9 @@ impl AmdGpaInterfaceFn {
|
|||
stringify!(get_gpa_session_status_amd)
|
||||
))
|
||||
}
|
||||
let raw_name = stringify!(vkGetGpaSessionStatusAMD);
|
||||
let cname = ::std::ffi::CString::new(raw_name).unwrap();
|
||||
let val = _f(&cname);
|
||||
let cname =
|
||||
::std::ffi::CStr::from_bytes_with_nul_unchecked(b"vkGetGpaSessionStatusAMD\0");
|
||||
let val = _f(cname);
|
||||
if val.is_null() {
|
||||
get_gpa_session_status_amd
|
||||
} else {
|
||||
|
@ -568,9 +569,9 @@ impl AmdGpaInterfaceFn {
|
|||
stringify!(get_gpa_session_results_amd)
|
||||
))
|
||||
}
|
||||
let raw_name = stringify!(vkGetGpaSessionResultsAMD);
|
||||
let cname = ::std::ffi::CString::new(raw_name).unwrap();
|
||||
let val = _f(&cname);
|
||||
let cname =
|
||||
::std::ffi::CStr::from_bytes_with_nul_unchecked(b"vkGetGpaSessionResultsAMD\0");
|
||||
let val = _f(cname);
|
||||
if val.is_null() {
|
||||
get_gpa_session_results_amd
|
||||
} else {
|
||||
|
@ -587,9 +588,9 @@ impl AmdGpaInterfaceFn {
|
|||
stringify!(reset_gpa_session_amd)
|
||||
))
|
||||
}
|
||||
let raw_name = stringify!(vkCmdEndGpaSampleAMD);
|
||||
let cname = ::std::ffi::CString::new(raw_name).unwrap();
|
||||
let val = _f(&cname);
|
||||
let cname =
|
||||
::std::ffi::CStr::from_bytes_with_nul_unchecked(b"vkCmdEndGpaSampleAMD\0");
|
||||
let val = _f(cname);
|
||||
if val.is_null() {
|
||||
reset_gpa_session_amd
|
||||
} else {
|
||||
|
@ -606,9 +607,10 @@ impl AmdGpaInterfaceFn {
|
|||
stringify!(cmd_copy_gpa_session_results_amd)
|
||||
))
|
||||
}
|
||||
let raw_name = stringify!(vkCmdCopyGpaSessionResultsAMD);
|
||||
let cname = ::std::ffi::CString::new(raw_name).unwrap();
|
||||
let val = _f(&cname);
|
||||
let cname = ::std::ffi::CStr::from_bytes_with_nul_unchecked(
|
||||
b"vkCmdCopyGpaSessionResultsAMD\0",
|
||||
);
|
||||
let val = _f(cname);
|
||||
if val.is_null() {
|
||||
cmd_copy_gpa_session_results_amd
|
||||
} else {
|
||||
|
|
Loading…
Add table
Reference in a new issue