commit af1046aca464a5cf4c0c4f8e5dde1852a528c837 (tree)
parent e0e145048d4b7b80bdbf15c78b33dea06edadc0a
Author: Ali Cheraghi <alichraghi@proton.me>
Date: Sat, 27 Jun 2026 11:54:00 +0330
Type: allow vectors in externs for SPIR-V target
Vectors are well-defined in SPIR-V unlike other targets, and they are essential for almost any shader interface because arrays are incompatible with e.g. Vulkan data formats (`gl_Position`, vertex attributes, color outputs, etc.)
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/Type.zig b/src/Type.zig
@@ -3087,7 +3087,10 @@ pub fn validateExtern(ty: Type, position: ExternPosition, zcu: *const Zcu) bool
.frame,
=> false,
- .vector => position == .param_ty or position == .ret_ty,
+ .vector => {
+ if (zcu.getTarget().cpu.arch.isSpirV()) return true;
+ return position == .param_ty or position == .ret_ty;
+ },
.void => switch (position) {
.ret_ty,