[clang] [llvm] [HLSL][SPIR-V] Implement vk::location for inputs (PR #169479)

Steven Perron via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 25 08:34:47 PST 2025


Nathan =?utf-8?q?Gauër?= <brioche at google.com>,
Nathan =?utf-8?q?Gauër?= <brioche at google.com>,
Nathan =?utf-8?q?Gauër?= <brioche at google.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/169479 at github.com>


================
@@ -240,6 +241,8 @@ class SemaHLSL : public SemaBase {
     HLSLParsedSemanticAttr *Semantic;
     std::optional<uint32_t> Index;
   };
+  std::optional<bool> InputUsesExplicitVkLocations = std::nullopt;
+  std::optional<bool> OutputUsesExplicitVkLocations = std::nullopt;
----------------
s-perron wrote:

In general, I'm not a fan of state variable like this. This variable does not represent the state of SemaHLSL, it is the state of a particular function/algorithm. It is unclear when it should be reset. Do we want the use of a vk::location in one shader to force the use in another shader in the library? DXC does not do that currently: https://godbolt.org/z/1z5dYxcG8.

I'm wondering if it would be more readable to place many of the parameters to determineActiveSemantic into a new struct or class. Then that can be passed around as a group. These could be stored there instead.

Does that seem reasonable?

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


More information about the llvm-commits mailing list