| author | |
| committer | |
| log | efb7539cb6cd4caf63e17f50c7eace198339460c |
| tree | 782befee2d7e15da55d2efea0224252ab5f45492 |
| parent | 89bd987f1c5f9aed8c7d0f851eae93c7cbf1d70b |
| signature |
2 files changed, 26 insertions(+), 7 deletions(-)
src/codegen/spirv.zig+18-7| ... | @@ -4370,13 +4370,24 @@ const NavGen = struct { | ... | @@ -4370,13 +4370,24 @@ const NavGen = struct { |
| 4370 | defer self.gpa.free(ids); | 4370 | defer self.gpa.free(ids); |
| 4371 | 4371 | ||
| 4372 | const result_id = self.spv.allocId(); | 4372 | const result_id = self.spv.allocId(); |
| 4373 | try self.func.body.emit(self.spv.gpa, .OpInBoundsPtrAccessChain, .{ | 4373 | const target = self.getTarget(); |
| 4374 | .id_result_type = result_ty_id, | 4374 | switch (target.os.tag) { |
| 4375 | .id_result = result_id, | 4375 | .opencl => try self.func.body.emit(self.spv.gpa, .OpInBoundsPtrAccessChain, .{ |
| 4376 | .base = base, | 4376 | .id_result_type = result_ty_id, |
| 4377 | .element = element, | 4377 | .id_result = result_id, |
| 4378 | .indexes = ids, | 4378 | .base = base, |
| 4379 | }); | 4379 | .element = element, |
| 4380 | .indexes = ids, | ||
| 4381 | }), | ||
| 4382 | .vulkan => try self.func.body.emit(self.spv.gpa, .OpPtrAccessChain, .{ | ||
| 4383 | .id_result_type = result_ty_id, | ||
| 4384 | .id_result = result_id, | ||
| 4385 | .base = base, | ||
| 4386 | .element = element, | ||
| 4387 | .indexes = ids, | ||
| 4388 | }), | ||
| 4389 | else => unreachable, | ||
| 4390 | } | ||
| 4380 | return result_id; | 4391 | return result_id; |
| 4381 | } | 4392 | } |
| 4382 | 4393 |
src/link/SpirV/deduplicate.zig+8| ... | @@ -511,6 +511,14 @@ pub fn run(parser: *BinaryModule.Parser, binary: *BinaryModule, progress: std.Pr | ... | @@ -511,6 +511,14 @@ pub fn run(parser: *BinaryModule.Parser, binary: *BinaryModule, progress: std.Pr |
| 511 | } | 511 | } |
| 512 | 512 | ||
| 513 | if (maybe_result_id_offset == null or maybe_result_id_offset.? != i) { | 513 | if (maybe_result_id_offset == null or maybe_result_id_offset.? != i) { |
| 514 | // Only emit forward pointers before type, constant, and global instructions. | ||
| 515 | // Debug and Annotation instructions don't need the forward pointer, and it | ||
| 516 | // messes up the logical layout of the module. | ||
| 517 | switch (inst.opcode.class()) { | ||
| 518 | .TypeDeclaration, .ConstantCreation, .Memory => {}, | ||
| 519 | else => continue, | ||
| 520 | } | ||
| 521 | |||
| 514 | const id: ResultId = @enumFromInt(operand.*); | 522 | const id: ResultId = @enumFromInt(operand.*); |
| 515 | const index = info.entities.getIndex(id) orelse continue; | 523 | const index = info.entities.getIndex(id) orelse continue; |
| 516 | const entity = info.entities.values()[index]; | 524 | const entity = info.entities.values()[index]; |