[llvm-branch-commits] [clang] [llvm] [HLSL] Add support for SV_RenderTargetArrayIndex (PR #237390)

Joshua Batista via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Nov 5 15:11:37 PST 2026


================
@@ -0,0 +1,34 @@
+// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.2-library -finclude-default-header -x hlsl -verify -o - %s
+// RUN: %clang_cc1 -triple spirv-pc-vulkan1.3-library -finclude-default-header -x hlsl -verify -o - %s
+
+// Stage and IO direction checks for SV_RenderTargetArrayIndex: a vertex output
+// and a pixel input. Type, index and interpolation checks are covered by
+// rendertargetarrayindex.vs-ps.hlsl.
+
+struct VSOut {
+  float4 p : SV_Position;
+  uint i : SV_RenderTargetArrayIndex;
+};
+
+[shader("vertex")]
+VSOut ok_vs_out() { return (VSOut)0; }
----------------
bob80905 wrote:

Question, is it possible for a vertex shader output to only be/have the RTAI semantic, and exclude position?
I like the isolation that `bad_vector` in `clang/test/SemaHLSL/Semantics/rendertargetarrayindex.vs-ps.hlsl` has, except for the illegal return type, but if it's not possible, that's fine.

The pattern I was hoping for was `f(arg) : SV_RenderTargetArrayIndex {...}`

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


More information about the llvm-branch-commits mailing list