| ... | ... | @@ -444,8 +444,14 @@ pub const DeclGen = struct { |
| 444 | 444 | // See https://github.com/KhronosGroup/SPIRV-LLVM-Translator/issues/1349 |
| 445 | 445 | // For now, just initialize the struct by setting the fields manually... |
| 446 | 446 | // TODO: Make this OpCompositeConstruct when we can |
| 447 | | // TODO: Make this Function storage type |
| 448 | | const ptr_composite_id = try self.alloc(result_ty_ref, null); |
| 447 | const ptr_ty_ref = try self.spv.ptrType(result_ty_ref, .Function); |
| 448 | const ptr_composite_id = self.spv.allocId(); |
| 449 | try self.func.prologue.emit(self.spv.gpa, .OpVariable, .{ |
| 450 | .id_result_type = self.typeId(ptr_ty_ref), |
| 451 | .id_result = ptr_composite_id, |
| 452 | .storage_class = .Function, |
| 453 | }); |
| 454 | |
| 449 | 455 | // Note: using 32-bit ints here because usize crashes the translator as well |
| 450 | 456 | const index_ty_ref = try self.intType(.unsigned, 32); |
| 451 | 457 | |
| ... | ... | @@ -454,7 +460,7 @@ pub const DeclGen = struct { |
| 454 | 460 | |
| 455 | 461 | for (constituents, member_types, 0..) |constitent_id, member_ty_ref, index| { |
| 456 | 462 | const index_id = try self.constInt(index_ty_ref, index); |
| 457 | | const ptr_member_ty_ref = try self.spv.ptrType(member_ty_ref, .Generic); |
| 463 | const ptr_member_ty_ref = try self.spv.ptrType(member_ty_ref, .Function); |
| 458 | 464 | const ptr_id = try self.accessChain(ptr_member_ty_ref, ptr_composite_id, &.{index_id}); |
| 459 | 465 | try self.func.body.emit(self.spv.gpa, .OpStore, .{ |
| 460 | 466 | .pointer = ptr_id, |
| ... | ... | @@ -479,13 +485,20 @@ pub const DeclGen = struct { |
| 479 | 485 | // For now, just initialize the struct by setting the fields manually... |
| 480 | 486 | // TODO: Make this OpCompositeConstruct when we can |
| 481 | 487 | // TODO: Make this Function storage type |
| 482 | | const ptr_composite_id = try self.alloc(result_ty_ref, null); |
| 488 | const ptr_ty_ref = try self.spv.ptrType(result_ty_ref, .Function); |
| 489 | const ptr_composite_id = self.spv.allocId(); |
| 490 | try self.func.prologue.emit(self.spv.gpa, .OpVariable, .{ |
| 491 | .id_result_type = self.typeId(ptr_ty_ref), |
| 492 | .id_result = ptr_composite_id, |
| 493 | .storage_class = .Function, |
| 494 | }); |
| 495 | |
| 483 | 496 | // Note: using 32-bit ints here because usize crashes the translator as well |
| 484 | 497 | const index_ty_ref = try self.intType(.unsigned, 32); |
| 485 | 498 | |
| 486 | 499 | const spv_composite_ty = self.spv.cache.lookup(result_ty_ref).array_type; |
| 487 | 500 | const elem_ty_ref = spv_composite_ty.element_type; |
| 488 | | const ptr_elem_ty_ref = try self.spv.ptrType(elem_ty_ref, .Generic); |
| 501 | const ptr_elem_ty_ref = try self.spv.ptrType(elem_ty_ref, .Function); |
| 489 | 502 | |
| 490 | 503 | for (constituents, 0..) |constitent_id, index| { |
| 491 | 504 | const index_id = try self.constInt(index_ty_ref, index); |