[PATCH] D159103: [Driver][HLSL] Improve diagnostics for invalid shader model and stage

Nathan Gauër via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 12 04:50:17 PDT 2023


Keenuts added inline comments.


================
Comment at: clang/lib/Frontend/CompilerInvocation.cpp:4146
   if (Opts.HLSL) {
-    bool SupportedTarget = (T.getArch() == llvm::Triple::dxil ||
-                            T.getArch() == llvm::Triple::spirv) &&
-                           T.getOS() == llvm::Triple::ShaderModel;
-    if (!SupportedTarget)
+    if (T.isDXIL() || T.isSPIRV) {
+      enum { ShaderModel, ShaderStage };
----------------
bogner wrote:
> @Keenuts Does this look right, or do we want something like `T.isSPIRVLogical` here?
Thanks for asking!
I think `isSPIRVLogical()` would be better here, as other SPIR-V flavors are not compatible with graphics (including compute shaders).
Ideally you could also add a `TODO: revisit this once we figured out how to handle PhysicalStorageBuffer64 memory model`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159103/new/

https://reviews.llvm.org/D159103



More information about the cfe-commits mailing list