[clang] [llvm] [VK][HLSL][SPIRV] Accept vk::builtin("PointSize") on pixel shader inputs (PR #243513)
Gregory Roth via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 24 12:02:21 PST 2026
================
@@ -0,0 +1,56 @@
+// REQUIRES: spirv-registered-target
+
+// RUN: %clang_cc1 -finclude-default-header -triple spirv-pc-vulkan1.3-pixel -hlsl-entry main -O3 -S -o - %s | FileCheck %s --check-prefix=UNREAD --implicit-check-not=PointSize
+// RUN: %clang_cc1 -finclude-default-header -triple spirv-pc-vulkan1.3-pixel -hlsl-entry main -O3 -DDEAD -S -o - %s | FileCheck %s --check-prefix=UNREAD --implicit-check-not=PointSize
+// RUN: not %clang_cc1 -finclude-default-header -triple spirv-pc-vulkan1.3-pixel -hlsl-entry main -O0 -S -o /dev/null %s 2>&1 | FileCheck %s --check-prefix=ERROR
+// RUN: not %clang_cc1 -finclude-default-header -triple spirv-pc-vulkan1.3-pixel -hlsl-entry main -O3 -DLIVE -S -o /dev/null %s 2>&1 | FileCheck %s --check-prefix=ERROR
+// RUN: not %clang_cc1 -finclude-default-header -triple spirv-pc-vulkan1.3-pixel -hlsl-entry main -O3 -DHELPER -S -o /dev/null %s 2>&1 | FileCheck %s --check-prefix=ERROR
+
+// RUN: %clang_cc1 -finclude-default-header -triple spirv-pc-vulkan1.3-pixel -hlsl-entry main -O3 -DSCALAR -S -o - %s | FileCheck %s --check-prefix=UNREAD --implicit-check-not=PointSize
+// RUN: not %clang_cc1 -finclude-default-header -triple spirv-pc-vulkan1.3-pixel -hlsl-entry main -O3 -DSCALAR -DLIVE -S -o /dev/null %s 2>&1 | FileCheck %s --check-prefix=ERROR
+
+// RUN: %if spirv-val %{ %clang_cc1 -finclude-default-header -triple spirv-pc-vulkan1.3-pixel -hlsl-entry main -O3 -emit-obj -o %t.spv %s %}
+// RUN: %if spirv-val %{ spirv-val --target-env vulkan1.3 %t.spv %}
+
+// A pixel shader PointSize input compiles when optimization removes it, and is
+// an error when the shader uses it or at -O0. It does not take a location.
+
+// UNREAD-DAG: OpEntryPoint Fragment
+// UNREAD-DAG: OpDecorate %[[#]] Location 0
+// UNREAD-DAG: OpDecorate %[[#]] Location 1
+
+// ERROR: error: BuiltIn PointSize cannot be used in a Fragment entry point (VUID-PointSize-PointSize-04314)
----------------
pow2clk wrote:
Testing for sema errors is ordinarily done in the SemaHLSL subdir. While this file shares a lot of code, all the ifdefs are a bit hard to follow and separating out those that are just for error testing might make the resulting files easier to read. At any rate, the errors might be better done with a -verify flag and that error syntax. That is done in a few places in this subdir.
https://github.com/llvm/llvm-project/pull/243513
More information about the cfe-commits
mailing list