[clang] [HLSL] Expose `half` types and intrinsics always (PR #81782)

Chris B via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 15 09:41:57 PST 2024


================
@@ -42,20 +49,20 @@ int16_t3 abs(int16_t3);
 _HLSL_AVAILABILITY(shadermodel, 6.2)
 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs)
 int16_t4 abs(int16_t4);
+#endif
 
-_HLSL_AVAILABILITY(shadermodel, 6.2)
+_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
----------------
llvm-beanz wrote:

This is complicated. `half` is a valid type regardless of whether or not 16bit types are enabled, and `half` is a _distinctly different_ type when 16-bit types are enabled. What this does is put the availability annotation on the 16-bit `half` type's overloads, but not the 32-bit `half` type's overloads.

That way if you're writing a shader for SM 6.0, using 32-bit `half` you get don't get blocked by the SM 6.2 availability annotation.

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


More information about the cfe-commits mailing list