| ... | ... | @@ -8629,6 +8629,20 @@ fn checkParamType( |
| 8629 | 8629 | if (param_is_noalias and !param_ty.isGenericPoison() and !param_ty.isPtrAtRuntime(zcu) and !param_ty.isSliceAtRuntime(zcu)) { |
| 8630 | 8630 | return sema.fail(block, param_src, "non-pointer parameter declared noalias", .{}); |
| 8631 | 8631 | } |
| 8632 | switch (target.os.tag) { |
| 8633 | .vulkan, .opengl => if (cc != .@"inline" and param_ty.isPtrAtRuntime(zcu)) { |
| 8634 | switch (param_ty.ptrAddressSpace(zcu)) { |
| 8635 | .input, .output => |as| return sema.failWithOwnedErrorMsg(block, msg: { |
| 8636 | const msg = try sema.errMsg(param_src, "function parameter cannot be a pointer in '{s}' address space", .{@tagName(as)}); |
| 8637 | errdefer msg.destroy(sema.gpa); |
| 8638 | try sema.errNote(param_src, msg, "mark the function as 'inline' so the parameter is substituted at call sites", .{}); |
| 8639 | break :msg msg; |
| 8640 | }), |
| 8641 | else => {}, |
| 8642 | } |
| 8643 | }, |
| 8644 | else => {}, |
| 8645 | } |
| 8632 | 8646 | } |
| 8633 | 8647 | |
| 8634 | 8648 | fn checkReturnTypeAndCallConv( |
| ... | ... | @@ -20530,10 +20544,6 @@ fn zirReifySpirvType( |
| 20530 | 20544 | return sema.failWithUseOfUndef(block, operand_src, null); |
| 20531 | 20545 | } |
| 20532 | 20546 | |
| 20533 | | // TODO: use a longer hash! |
| 20534 | | var hasher = std.hash.Wyhash.init(0); |
| 20535 | | std.hash.autoHash(&hasher, union_val.tag); |
| 20536 | | |
| 20537 | 20547 | const name = try ip.getOrPutStringFmt( |
| 20538 | 20548 | gpa, |
| 20539 | 20549 | io, |
| ... | ... | @@ -20640,20 +20650,11 @@ fn zirReifySpirvType( |
| 20640 | 20650 | else => {}, |
| 20641 | 20651 | } |
| 20642 | 20652 | |
| 20643 | | std.hash.autoHash(&hasher, usage_tag); |
| 20644 | | std.hash.autoHash(&hasher, format); |
| 20645 | | std.hash.autoHash(&hasher, dim); |
| 20646 | | std.hash.autoHash(&hasher, depth); |
| 20647 | | std.hash.autoHash(&hasher, access); |
| 20648 | | std.hash.autoHash(&hasher, arrayed); |
| 20649 | | std.hash.autoHash(&hasher, multisampled); |
| 20650 | | |
| 20651 | 20653 | break :ip_data .{ |
| 20652 | 20654 | .name = name, |
| 20653 | 20655 | .zir_index = tracked_inst, |
| 20654 | 20656 | .ty = blk: { |
| 20655 | 20657 | const sampled_type = usage_val.unionPayload(zcu).toType(); |
| 20656 | | std.hash.autoHash(&hasher, sampled_type.toIntern()); |
| 20657 | 20658 | |
| 20658 | 20659 | if (target.os.tag != .opencl and sampled_type.toIntern() == .void_type) { |
| 20659 | 20660 | return sema.fail(block, operand_src, "'void' type for '{t}' field is only valid under the 'opencl' os", .{usage_tag}); |
| ... | ... | @@ -20726,7 +20727,6 @@ fn zirReifySpirvType( |
| 20726 | 20727 | if (image_info.usage != .sampled) { |
| 20727 | 20728 | return sema.fail(block, operand_src, "'sampled_image' element must be an image with 'usage = .sampled'", .{}); |
| 20728 | 20729 | } |
| 20729 | | std.hash.autoHash(&hasher, union_val.val); |
| 20730 | 20730 | break :blk .{ |
| 20731 | 20731 | .name = name, |
| 20732 | 20732 | .zir_index = tracked_inst, |
| ... | ... | @@ -20754,7 +20754,6 @@ fn zirReifySpirvType( |
| 20754 | 20754 | { |
| 20755 | 20755 | return sema.fail(block, operand_src, "'runtime_array' of 'runtime_array' is not allowed under the 'vulkan' os", .{}); |
| 20756 | 20756 | } |
| 20757 | | std.hash.autoHash(&hasher, union_val.val); |
| 20758 | 20757 | break :blk .{ |
| 20759 | 20758 | .name = name, |
| 20760 | 20759 | .zir_index = tracked_inst, |
| ... | ... | @@ -20773,11 +20772,7 @@ fn zirReifySpirvType( |
| 20773 | 20772 | }, |
| 20774 | 20773 | }; |
| 20775 | 20774 | |
| 20776 | | return .fromIntern(try ip.getReifiedSpirvType(gpa, io, pt.tid, .{ |
| 20777 | | .zir_index = tracked_inst, |
| 20778 | | .type_hash = hasher.final(), |
| 20779 | | .type_spirv = ip_data, |
| 20780 | | })); |
| 20775 | return .fromIntern(try ip.getReifiedSpirvType(gpa, io, pt.tid, ip_data)); |
| 20781 | 20776 | } |
| 20782 | 20777 | |
| 20783 | 20778 | fn resolveVaListRef(sema: *Sema, block: *Block, src: LazySrcLoc, zir_ref: Zir.Inst.Ref) CompileError!Air.Inst.Ref { |