mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-29 17:44:09 +01:00
Change naga::back::spv::DebugInfo::file_name to a &Path.
This makes it a bit easier to use in the CLI and snapshot tests.
This commit is contained in:
1 parent
7060246357
commit
0c69735f59
4 files changed
+7
-11
No files matched your search
+1
-7
@@ -374,13 +374,7 @@ fn run() -> Result<(), Box<dyn std::error::Error>> {
|
||||
.set(naga::back::spv::WriterFlags::DEBUG, true);
|
||||
params.spv_out.debug_info = Some(naga::back::spv::DebugInfo {
|
||||
source_code: input_text,
|
||||
file_name: input_path
|
||||
.file_name()
|
||||
.and_then(std::ffi::OsStr::to_str)
|
||||
.ok_or(CliError(
|
||||
"input path for couldn't be converted to string \
|
||||
for `--generate-debug-symbols",
|
||||
))?,
|
||||
file_name: input_path,
|
||||
})
|
||||
} else {
|
||||
eprintln!(
|
||||
|
||||
+1
-1
@@ -85,7 +85,7 @@ impl IdGenerator {
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct DebugInfo<'a> {
|
||||
pub source_code: &'a str,
|
||||
pub file_name: &'a str,
|
||||
pub file_name: &'a std::path::Path,
|
||||
}
|
||||
|
||||
/// A SPIR-V block to which we are still adding instructions.
|
||||
|
||||
@@ -1840,8 +1840,10 @@ impl Writer {
|
||||
if self.flags.contains(WriterFlags::DEBUG) {
|
||||
if let Some(debug_info) = debug_info.as_ref() {
|
||||
let source_file_id = self.id_gen.next();
|
||||
self.debugs
|
||||
.push(Instruction::string(debug_info.file_name, source_file_id));
|
||||
self.debugs.push(Instruction::string(
|
||||
&debug_info.file_name.display().to_string(),
|
||||
source_file_id,
|
||||
));
|
||||
|
||||
debug_info_inner = Some(DebugInfoInner {
|
||||
source_code: debug_info.source_code,
|
||||
|
||||
+1
-1
@@ -159,7 +159,7 @@ fn check_targets(
|
||||
let debug_info = if cfg!(feature = "span") {
|
||||
source_code.map(|code| naga::back::spv::DebugInfo {
|
||||
source_code: code,
|
||||
file_name: name,
|
||||
file_name: name.as_ref(),
|
||||
})
|
||||
} else {
|
||||
None
|
||||
|
||||
Reference in new issue
Block a user