| ... | @@ -140,23 +140,26 @@ pub fn flushModule(self: *SpirV, comp: *Compilation) !void { | ... | @@ -140,23 +140,26 @@ pub fn flushModule(self: *SpirV, comp: *Compilation) !void { |
| 140 | // Now, actually generate the code for all declarations. | 140 | // Now, actually generate the code for all declarations. |
| 141 | { | 141 | { |
| 142 | // We are just going to re-use this same DeclGen for every Decl, and we are just going to | 142 | // We are just going to re-use this same DeclGen for every Decl, and we are just going to |
| 143 | // change the decl. Otherwise, we would have to keep a separate `types`, and re-construct this | 143 | // change the decl. Otherwise, we would have to keep a separate `args` and `types`, and re-construct this |
| 144 | // structure every time. | 144 | // structure every time. |
| 145 | var decl_gen = codegen.DeclGen{ | 145 | var decl_gen = codegen.DeclGen{ |
| 146 | .module = module, | 146 | .module = module, |
| 147 | .spv = &spv, | 147 | .spv = &spv, |
| | 148 | .args = std.ArrayList(u32).init(self.base.allocator), |
| 148 | .types = codegen.TypeMap.init(self.base.allocator), | 149 | .types = codegen.TypeMap.init(self.base.allocator), |
| 149 | .decl = undefined, | 150 | .decl = undefined, |
| 150 | .error_msg = undefined, | 151 | .error_msg = undefined, |
| 151 | }; | 152 | }; |
| 152 | | 153 | |
| 153 | defer decl_gen.types.deinit(); | 154 | defer decl_gen.types.deinit(); |
| | 155 | defer decl_gen.args.deinit(); |
| 154 | | 156 | |
| 155 | for (module.decl_table.items()) |entry| { | 157 | for (module.decl_table.items()) |entry| { |
| 156 | const decl = entry.value; | 158 | const decl = entry.value; |
| 157 | if (decl.typed_value != .most_recent) | 159 | if (decl.typed_value != .most_recent) |
| 158 | continue; | 160 | continue; |
| 159 | | 161 | |
| | 162 | decl_gen.args.items.len = 0; |
| 160 | decl_gen.decl = decl; | 163 | decl_gen.decl = decl; |
| 161 | decl_gen.error_msg = null; | 164 | decl_gen.error_msg = null; |
| 162 | | 165 | |