mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2024-11-25 16:25:31 +00:00
segfaulting: DebugUtilsMessengerCallbackDataEXT::pMessageIdName may be null in debug callback (#1487)
* vulkano: DebugUtilsMessengerCallbackDataEXT::pMessageIdName may be null in debug callback - https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VkDebugUtilsMessengerCallbackDataEXT.html#VUID-VkDebugUtilsMessengerCallbackDataEXT-pMessageIdName-parameter * make `Message::layer_prefix` an Option
This commit is contained in:
parent
ff1dd87a32
commit
e66e9a1fa2
@ -1,5 +1,6 @@
|
||||
# Unreleased
|
||||
|
||||
- **Breaking** `Message::layer_prefix` turned to Option to prevent segfaults when Vulkan message didn't provide `pMessageIdName` value
|
||||
- **Breaking** On `AutoCommandBufferBuilder`, methods that bind a descriptor set now take a `dynamic_offsets` parameter
|
||||
- **Breaking** On `AutoCommandBufferBuilder` and `SyncCommandBufferBuilder`, the `update_buffer` method now takes `data` by reference
|
||||
- **Breaking** Made `PipelineLayoutDescTweaks` public, for use with compute pipelines
|
||||
|
@ -99,7 +99,10 @@ fn main() {
|
||||
|
||||
println!(
|
||||
"{} {} {}: {}",
|
||||
msg.layer_prefix, ty, severity, msg.description
|
||||
msg.layer_prefix.unwrap_or("unknown"),
|
||||
ty,
|
||||
severity,
|
||||
msg.description
|
||||
);
|
||||
})
|
||||
.ok();
|
||||
|
@ -96,9 +96,12 @@ impl DebugCallback {
|
||||
let user_callback = user_data as *mut Box<dyn Fn()> as *const _;
|
||||
let user_callback: &Box<dyn Fn(&Message)> = &*user_callback;
|
||||
|
||||
let layer_prefix = CStr::from_ptr((*callback_data).pMessageIdName)
|
||||
let layer_prefix = (*callback_data).pMessageIdName.as_ref().map(|msg_id_name| {
|
||||
CStr::from_ptr(msg_id_name)
|
||||
.to_str()
|
||||
.expect("debug callback message not utf-8");
|
||||
.expect("debug callback message not utf-8")
|
||||
});
|
||||
|
||||
let description = CStr::from_ptr((*callback_data).pMessage)
|
||||
.to_str()
|
||||
.expect("debug callback message not utf-8");
|
||||
@ -231,8 +234,8 @@ pub struct Message<'a> {
|
||||
pub severity: MessageSeverity,
|
||||
/// Type of message,
|
||||
pub ty: MessageType,
|
||||
/// Prefix of the layer that reported this message.
|
||||
pub layer_prefix: &'a str,
|
||||
/// Prefix of the layer that reported this message or `None` if unknown.
|
||||
pub layer_prefix: Option<&'a str>,
|
||||
/// Description of the message.
|
||||
pub description: &'a str,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user