mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 19:30:11 +01:00
nak: Only convert the written portion of the buffer in NirInstrPrinter
Fixes: 02774be708 ("nak/sm50: add a memstream abstraction")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29591>
This commit is contained in:
parent
70b381e928
commit
944365802f
1 changed files with 5 additions and 2 deletions
|
|
@ -32,8 +32,11 @@ impl NirInstrPrinter {
|
|||
unsafe {
|
||||
let stream = self.stream.as_mut().get_unchecked_mut();
|
||||
nak_nir_asprint_instr(stream, instr);
|
||||
let c_str = std::ffi::CStr::from_ptr(stream.buffer);
|
||||
let string = c_str.to_string_lossy().into_owned();
|
||||
let bytes = std::slice::from_raw_parts(
|
||||
stream.buffer as *const u8,
|
||||
stream.written,
|
||||
);
|
||||
let string = String::from_utf8_lossy(bytes).into_owned();
|
||||
nak_clear_memstream(stream);
|
||||
string
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue