| ... | @@ -725,7 +725,10 @@ pub fn genNav(cg: *CodeGen, do_codegen: bool) Error!void { | ... | @@ -725,7 +725,10 @@ pub fn genNav(cg: *CodeGen, do_codegen: bool) Error!void { |
| 725 | const val = zcu.navValue(cg.owner_nav); | 725 | const val = zcu.navValue(cg.owner_nav); |
| 726 | const ty = val.typeOf(zcu); | 726 | const ty = val.typeOf(zcu); |
| 727 | | 727 | |
| 728 | if (!do_codegen and !ty.hasRuntimeBits(zcu)) return; | 728 | if (!do_codegen and !ty.hasRuntimeBits(zcu)) { |
| | 729 | const child_ty = if (ty.zigTypeTag(zcu) == .pointer) ty.childType(zcu) else ty; |
| | 730 | if (child_ty.zigTypeTag(zcu) != .spirv) return; |
| | 731 | } |
| 729 | | 732 | |
| 730 | const spv_decl_index = try cg.resolveNav(ip, cg.owner_nav); | 733 | const spv_decl_index = try cg.resolveNav(ip, cg.owner_nav); |
| 731 | const decl = cg.declPtr(spv_decl_index); | 734 | const decl = cg.declPtr(spv_decl_index); |
| ... | @@ -1800,7 +1803,9 @@ fn derivePtr(cg: *CodeGen, derivation: Value.PointerDeriveStep) !Id { | ... | @@ -1800,7 +1803,9 @@ fn derivePtr(cg: *CodeGen, derivation: Value.PointerDeriveStep) !Id { |
| 1800 | }, | 1803 | }, |
| 1801 | } | 1804 | } |
| 1802 | | 1805 | |
| 1803 | if (!nav_ty.hasRuntimeBits(zcu)) return cg.constUndef(ty_id); | 1806 | if (!nav_ty.hasRuntimeBits(zcu) and nav_ty.zigTypeTag(zcu) != .spirv) { |
| | 1807 | return cg.constUndef(ty_id); |
| | 1808 | } |
| 1804 | | 1809 | |
| 1805 | const spv_decl_index = try cg.resolveNav(ip, nav_index); | 1810 | const spv_decl_index = try cg.resolveNav(ip, nav_index); |
| 1806 | const spv_decl = cg.declPtr(spv_decl_index); | 1811 | const spv_decl = cg.declPtr(spv_decl_index); |
| ... | @@ -1835,7 +1840,9 @@ fn derivePtr(cg: *CodeGen, derivation: Value.PointerDeriveStep) !Id { | ... | @@ -1835,7 +1840,9 @@ fn derivePtr(cg: *CodeGen, derivation: Value.PointerDeriveStep) !Id { |
| 1835 | else => {}, | 1840 | else => {}, |
| 1836 | } | 1841 | } |
| 1837 | | 1842 | |
| 1838 | if (!uav_ty.hasRuntimeBits(zcu)) return cg.constUndef(ty_id); | 1843 | if (!uav_ty.hasRuntimeBits(zcu) and uav_ty.zigTypeTag(zcu) != .spirv) { |
| | 1844 | return cg.constUndef(ty_id); |
| | 1845 | } |
| 1839 | | 1846 | |
| 1840 | // Uav refs are always generic. | 1847 | // Uav refs are always generic. |
| 1841 | assert(result_ptr_ty.ptrAddressSpace(zcu) == .generic); | 1848 | assert(result_ptr_ty.ptrAddressSpace(zcu) == .generic); |