summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorCopilot <198982749+Copilot@users.noreply.github.com>2025-07-02 17:44:43 +0000
committerGitHub <noreply@github.com>2025-07-02 17:44:43 +0000
commitcd28357bbeb56427032fd1e56c8b3749bcfeb854 (patch)
treeeb6c1ca667b0063c1f7e69caa526c78b79a081e2 /tests
parent0aa67332a8741ca4b14c20e571f281d0a5ccfa42 (diff)
Fix spurious vk::binding warnings when attribute is present (#7581)
* Initial plan * Fix spurious vk::binding warnings when attribute is present - Modified _maybeDiagnoseMissingVulkanLayoutModifier to check for GLSLBindingAttribute before warning - Changed function to return bool indicating if warning was actually issued - Updated call sites to properly track warning state to reduce duplicates - Tested fix resolves the issue while preserving correct warnings when needed Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Add test case for vk::binding spurious warning fix Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Update test to use filecheck format as requested Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Remove full file path from CHECK directives as requested Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Fix code formatting with clang-format Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Fix behavioral regression in vk-bindings test caused by warning flag logic Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/diagnostics/vk-binding-with-register-no-warning.slang35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/diagnostics/vk-binding-with-register-no-warning.slang b/tests/diagnostics/vk-binding-with-register-no-warning.slang
new file mode 100644
index 000000000..3bbbcc1bd
--- /dev/null
+++ b/tests/diagnostics/vk-binding-with-register-no-warning.slang
@@ -0,0 +1,35 @@
+// vk-binding-with-register-no-warning.slang
+
+//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK):-target metallib -matrix-layout-row-major -entry main
+
+// Test that no spurious warnings are generated when vk::binding is present alongside register
+// This addresses issue #7553 where the compiler incorrectly warned about missing vk::binding
+
+// Should NOT generate warning - has both vk::binding and register
+// CHECK-NOT: ([[# @LINE+1]]): warning 39029
+[[vk::binding(0, 0)]] cbuffer ConstantBuffer : register(b0)
+{
+ float4 testValue;
+};
+
+// Should NOT generate warning - has both vk::binding and register
+// CHECK-NOT: ([[# @LINE+1]]): warning 39029
+[[vk::binding(1, 0)]] Texture2D tex : register(t1);
+
+// Should NOT generate warning - has both vk::binding and register
+// CHECK-NOT: ([[# @LINE+1]]): warning 39029
+[[vk::binding(2, 0)]] SamplerState sampler : register(s2);
+
+// Should generate warning - has register but no vk::binding
+// CHECK: ([[# @LINE+1]]): warning 39029
+Texture2D texNoBinding : register(t3);
+
+// Should generate warning - has register but no vk::binding
+// CHECK: ([[# @LINE+1]]): warning 39029
+ConstantBuffer<float4> cbNoBinding : register(b4);
+
+[shader("compute")]
+[numthreads(1, 1, 1)]
+void main()
+{
+} \ No newline at end of file