mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-25 08:13:27 +00:00
hal/dx12: don't assume D3DCompile error is some
This commit is contained in:
parent
42194168e0
commit
5fd4fffdde
@ -244,16 +244,19 @@ impl super::Device {
|
||||
let (result, log_level) = match hr.into_result() {
|
||||
Ok(()) => (Ok(shader_data), log::Level::Info),
|
||||
Err(e) => {
|
||||
let message = unsafe {
|
||||
let slice = slice::from_raw_parts(
|
||||
error.GetBufferPointer() as *const u8,
|
||||
error.GetBufferSize(),
|
||||
);
|
||||
String::from_utf8_lossy(slice)
|
||||
};
|
||||
let full_msg = format!("D3DCompile error ({}): {}", e, message);
|
||||
unsafe {
|
||||
error.destroy();
|
||||
let mut full_msg = format!("D3DCompile error ({})", e);
|
||||
if !error.is_null() {
|
||||
use std::fmt::Write as _;
|
||||
let message = unsafe {
|
||||
slice::from_raw_parts(
|
||||
error.GetBufferPointer() as *const u8,
|
||||
error.GetBufferSize(),
|
||||
)
|
||||
};
|
||||
write!(full_msg, ": {}", String::from_utf8_lossy(message));
|
||||
unsafe {
|
||||
error.destroy();
|
||||
}
|
||||
}
|
||||
(
|
||||
Err(crate::PipelineError::Linkage(stage_bit, full_msg)),
|
||||
|
Loading…
Reference in New Issue
Block a user