| ... | ... | @@ -415,6 +415,18 @@ pub fn flush(self: *Module, file: std.fs.File) !void { |
| 415 | 415 | 0, // Schema (currently reserved for future use) |
| 416 | 416 | }; |
| 417 | 417 | |
| 418 | var source = Section{}; |
| 419 | defer source.deinit(self.gpa); |
| 420 | try self.sections.debug_strings.emit(self.gpa, .OpSource, .{ |
| 421 | .source_language = .Unknown, |
| 422 | .version = 0, |
| 423 | // We cannot emit these because the Khronos translator does not parse this instruction |
| 424 | // correctly. |
| 425 | // See https://github.com/KhronosGroup/SPIRV-LLVM-Translator/issues/2188 |
| 426 | .file = null, |
| 427 | .source = null, |
| 428 | }); |
| 429 | |
| 418 | 430 | // Note: needs to be kept in order according to section 2.3! |
| 419 | 431 | const buffers = &[_][]const Word{ |
| 420 | 432 | &header, |
| ... | ... | @@ -422,6 +434,7 @@ pub fn flush(self: *Module, file: std.fs.File) !void { |
| 422 | 434 | self.sections.extensions.toWords(), |
| 423 | 435 | entry_points.toWords(), |
| 424 | 436 | self.sections.execution_modes.toWords(), |
| 437 | source.toWords(), |
| 425 | 438 | self.sections.debug_strings.toWords(), |
| 426 | 439 | self.sections.debug_names.toWords(), |
| 427 | 440 | self.sections.annotations.toWords(), |
| ... | ... | @@ -467,13 +480,6 @@ pub fn resolveSourceFileName(self: *Module, path: []const u8) !IdRef { |
| 467 | 480 | .id_result = file_result_id, |
| 468 | 481 | .string = path, |
| 469 | 482 | }); |
| 470 | | |
| 471 | | try self.sections.debug_strings.emit(self.gpa, .OpSource, .{ |
| 472 | | .source_language = .Unknown, // TODO: Register Zig source language. |
| 473 | | .version = 0, // TODO: Zig version as u32? |
| 474 | | .file = file_result_id, |
| 475 | | .source = null, // TODO: Store actual source also? |
| 476 | | }); |
| 477 | 483 | } |
| 478 | 484 | |
| 479 | 485 | return result.value_ptr.*; |