| ... | @@ -135,10 +135,21 @@ pub fn updateDeclExports( | ... | @@ -135,10 +135,21 @@ pub fn updateDeclExports( |
| 135 | decl_index: Module.Decl.Index, | 135 | decl_index: Module.Decl.Index, |
| 136 | exports: []const *Module.Export, | 136 | exports: []const *Module.Export, |
| 137 | ) !void { | 137 | ) !void { |
| 138 | _ = self; | 138 | const decl = module.declPtr(decl_index); |
| 139 | _ = module; | 139 | if (decl.val.tag() == .function and decl.ty.fnCallingConvention() == .Kernel) { |
| 140 | _ = decl_index; | 140 | // TODO: Unify with resolveDecl in spirv.zig. |
| 141 | _ = exports; | 141 | const entry = try self.decl_link.getOrPut(decl_index); |
| | 142 | if (!entry.found_existing) { |
| | 143 | entry.value_ptr.* = try self.spv.allocDecl(.func); |
| | 144 | } |
| | 145 | const spv_decl_index = entry.value_ptr.*; |
| | 146 | |
| | 147 | for (exports) |exp| { |
| | 148 | try self.spv.declareEntryPoint(spv_decl_index, exp.options.name); |
| | 149 | } |
| | 150 | } |
| | 151 | |
| | 152 | // TODO: Export regular functions, variables, etc using Linkage attributes. |
| 142 | } | 153 | } |
| 143 | | 154 | |
| 144 | pub fn freeDecl(self: *SpirV, decl_index: Module.Decl.Index) void { | 155 | pub fn freeDecl(self: *SpirV, decl_index: Module.Decl.Index) void { |