From 70ef9bc75c42ec00e9d4231a2e1f1dca84144748 Mon Sep 17 00:00:00 2001 From: Ryan Liptak Date: Sun, 31 Oct 2021 21:45:32 -0700 Subject: Fix ensureTotalCapacity calls that should be ensureUnusedCapacity calls If these functions are called more than once, then the array list would no longer be guaranteed to have enough capacity during the appendAssumeCapacity calls. With ensureUnusedCapacity, they will always be guaranteed to have enough capacity regardless of how many times the function is called. --- src/codegen/spirv.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/codegen') diff --git a/src/codegen/spirv.zig b/src/codegen/spirv.zig index da2fa66fee..67faf32471 100644 --- a/src/codegen/spirv.zig +++ b/src/codegen/spirv.zig @@ -629,7 +629,7 @@ pub const DeclGen = struct { const params = decl.ty.fnParamLen(); var i: usize = 0; - try self.args.ensureTotalCapacity(params); + try self.args.ensureUnusedCapacity(params); while (i < params) : (i += 1) { const param_type_id = self.spv.types.get(decl.ty.fnParamType(i)).?; const arg_result_id = self.spv.allocResultId(); -- cgit v1.2.3