[clang] [HLSL] Resource initialization by constructors (PR #135120)

Justin Bogner via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 29 09:29:56 PDT 2025


================
@@ -4801,6 +4801,18 @@ def HLSLResourceGetPointer : LangBuiltin<"HLSL_LANG"> {
   let Prototype = "void(...)";
 }
 
+def HLSLResourceCreatePoisonHandle : LangBuiltin<"HLSL_LANG"> {
+  let Spellings = ["__builtin_hlsl_resource_createpoisonhandle"];
+  let Attributes = [NoThrow];
+  let Prototype = "void(...)";
+}
+
+def HLSLResourceCreateHandleFromBinding : LangBuiltin<"HLSL_LANG"> {
+  let Spellings = ["__builtin_hlsl_resource_createhandlefrombinding"];
+  let Attributes = [NoThrow];
+  let Prototype = "void(...)";
+}
----------------
bogner wrote:

The DirectX and SPIRV intrinsics are called `resource.handlefrombinding` (as per [0014-consistent-naming-for-dx-intrinsics](https://github.com/llvm/wg-hlsl/blob/main/proposals/0014-consistent-naming-for-dx-intrinsics.md)), so I think it'd make sense to match that naming for the builtin. That is, `__builtin_hlsl_resource_handlefrombinding`.

Given that, the poison builtin could be `__builtin_hlsl_resource_poisonhandle`, though it might be clearer to call it something like "uninitialized handle" instead

https://github.com/llvm/llvm-project/pull/135120


More information about the cfe-commits mailing list