[clang] HLSL availability diagnostics design doc (PR #92207)

Chris B via cfe-commits cfe-commits at lists.llvm.org
Fri May 17 08:05:00 PDT 2024


================
@@ -0,0 +1,139 @@
+=============================
+HLSL Availability Diagnostics
+=============================
+
+.. contents::
+   :local:
+
+Introduction
+============
+
+HLSL availability diagnostics emits errors or warning when unavailable shader APIs are used. Unavailable shader APIs are APIs that are exposed in HLSL code but are not available in the target shader stage or shader model version.
+
+There are three modes of HLSL availability diagnostic:
+
+#. **Default mode** - compiler emits an error when an unavailable API is found in a code that is reachable from the shader entry point function or from an exported library function (when compiling a shader library)
+
+#. **Relaxed mode** - same as default mode except the compiler emits a warning. This mode is enabled by ``-Wno-error=hlsl-availability``.
+
+#. **Strict mode** - compiler emits an error when an unavailable API is found in parsed code regardless of whether it can be reached from the shader entry point or exported functions, or not. This mode is enabled by ``-fhlsl-strict-diagnostics``.
----------------
llvm-beanz wrote:

nit: maybe we should name this flag `-fhlsl-strict-availability`, which more clearly associates it with availability rather than more general diagnostics.

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


More information about the cfe-commits mailing list