[clang] [VK][HLSL][SPIRV] Implement vk::builtin("PointSize") (PR #231275)
Diego Novillo via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 9 08:57:55 PST 2026
================
@@ -1028,6 +1034,52 @@ static bool isVkPipelineBuiltin(const ASTContext &AstContext, FunctionDecl *FD,
}
}
+static void validateVkBuiltinUsage(Sema &S, FunctionDecl *FD,
+ const DeclaratorDecl *D,
+ const HLSLVkBuiltInAttr *Attr,
+ IOType CurrentIOType) {
+ const ASTContext &AstContext = S.getASTContext();
+ if (AstContext.getTargetInfo().getTriple().getOS() != llvm::Triple::Vulkan)
+ return;
+
+ StringRef BuiltIn = Attr->getBuiltIn();
+
+ QualType T =
+ (D == FD ? FD->getReturnType() : D->getType()).getNonReferenceType();
+ const auto *ShaderAttr = FD->getAttr<HLSLShaderAttr>();
+ assert(ShaderAttr && "Entry point has no shader attribute");
+ llvm::Triple::EnvironmentType Stage = ShaderAttr->getType();
+ bool IsIn = any(CurrentIOType & IOType::In);
+ bool IsOut = any(CurrentIOType & IOType::Out);
+
+ if (BuiltIn == "PointSize") {
+ if (!T->isFloatingType())
----------------
dnovillo wrote:
`isFloatingType()` also accepts `double`, and `half` (with `-enable-16bit-types`), but Vulkan requires `PointSize` to be a 32-bit float (VUID-PointSize-PointSize-04317). This should only accept 32-bit `float`.
https://github.com/llvm/llvm-project/pull/231275
More information about the cfe-commits
mailing list