Merge pull request #62 from clickingbuttons/master

Copy src path in ShaderCompileStep.add
This commit is contained in:
Robin Voetter
2022-12-22 23:14:21 +01:00
committed by GitHub

View File

@@ -77,7 +77,10 @@ pub const ShaderCompileStep = struct {
self.builder.cache_root, self.builder.cache_root,
if (params.output_filename) |out| out else std.fmt.allocPrint(self.builder.allocator, "{s}.spv", .{src}) catch unreachable, if (params.output_filename) |out| out else std.fmt.allocPrint(self.builder.allocator, "{s}.spv", .{src}) catch unreachable,
}) catch unreachable; }) catch unreachable;
self.shaders.append(.{ .source_path = src, .full_out_path = full_out_path, .entry_point = params.entry_point, .stage = params.stage }) catch unreachable; var src_cpy = self.builder.allocator.alloc(u8, src.len) catch unreachable;
_ = std.mem.copy(u8, src_cpy, src);
self.shaders.append(.{ .source_path = src_cpy, .full_out_path = full_out_path, .entry_point = params.entry_point, .stage = params.stage }) catch unreachable;
return full_out_path; return full_out_path;
} }