diff options
| author | Robin Voetter <robin@voetter.nl> | 2023-10-07 15:10:17 +0200 |
|---|---|---|
| committer | Robin Voetter <robin@voetter.nl> | 2023-10-15 13:59:25 +0200 |
| commit | a3d77bdba9f8c6c3a88cfdfc009e1fabff22d2eb (patch) | |
| tree | 1cdcb7164c2068dffd97e1c586e38b8e3bde58fb /src/codegen | |
| parent | ab701c3d375b102bc291f80a791109cb109964ba (diff) | |
| download | zig-a3d77bdba9f8c6c3a88cfdfc009e1fabff22d2eb.tar.gz zig-a3d77bdba9f8c6c3a88cfdfc009e1fabff22d2eb.zip | |
spirv: get rid of SpvModule arena
Diffstat (limited to 'src/codegen')
| -rw-r--r-- | src/codegen/spirv/Module.zig | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/codegen/spirv/Module.zig b/src/codegen/spirv/Module.zig index 81b97ebae5..2aacc5b748 100644 --- a/src/codegen/spirv/Module.zig +++ b/src/codegen/spirv/Module.zig @@ -103,15 +103,12 @@ pub const EntryPoint = struct { /// The declaration that should be exported. decl_index: Decl.Index, /// The name of the kernel to be exported. - name: []const u8, + name: CacheString, }; /// A general-purpose allocator which may be used to allocate resources for this module gpa: Allocator, -/// An arena allocator used to store things that have the same lifetime as this module. -arena: Allocator, - /// Module layout, according to SPIR-V Spec section 2.4, "Logical Layout of a Module". sections: struct { /// Capability instructions @@ -176,10 +173,9 @@ globals: struct { section: Section = .{}, } = .{}, -pub fn init(gpa: Allocator, arena: Allocator) Module { +pub fn init(gpa: Allocator) Module { return .{ .gpa = gpa, - .arena = arena, .next_result_id = 1, // 0 is an invalid SPIR-V result id, so start counting at 1. }; } @@ -321,7 +317,7 @@ fn entryPoints(self: *Module) !Section { try entry_points.emit(self.gpa, .OpEntryPoint, .{ .execution_model = .Kernel, .entry_point = entry_point_id, - .name = entry_point.name, + .name = self.cache.getString(entry_point.name).?, .interface = interface.items, }); } @@ -641,7 +637,7 @@ pub fn endGlobal(self: *Module, global_index: Decl.Index, begin_inst: u32, resul pub fn declareEntryPoint(self: *Module, decl_index: Decl.Index, name: []const u8) !void { try self.entry_points.append(self.gpa, .{ .decl_index = decl_index, - .name = try self.arena.dupe(u8, name), + .name = try self.resolveString(name), }); } |
