From d5d03d1510f45f5ed7864031244713d87fc82b87 Mon Sep 17 00:00:00 2001 From: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com> Date: Tue, 2 Jul 2024 13:35:49 -0400 Subject: Emit errors when invalid capabilities are used (#4510) * Fix invalid capabilities being allowed fixes: #4506 fixes: #4508 1. As per #4506, no longer allow invalid `[require(...)]` 2. As per #4508, no longer allow mismatch between `case` and `require` of a calling function 3. Fixes incorrect hlsl.meta capabilities 4. Added a ref to the parent function/decl for when erroring with capabilities to help debug meta.slang files for when weird source locations are generated. * rename vars and copy lambdas by value * fix some more capabilities * incorrect capabilities on a texture test * push capabilities fix note: seperated capabilities for glsl,spirv,cuda,hlsl since not all functions support all targets (source of capability error) * fix cmd line arg by using `xslang` to passthrough to slangc * let auto-infer run for certain capabilities to reduce simple mistakes --------- Co-authored-by: Jay Kwak <82421531+jkwak-work@users.noreply.github.com> --- tests/language-feature/capability/capability6.slang | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 tests/language-feature/capability/capability6.slang (limited to 'tests/language-feature/capability') diff --git a/tests/language-feature/capability/capability6.slang b/tests/language-feature/capability/capability6.slang new file mode 100644 index 000000000..3d6642063 --- /dev/null +++ b/tests/language-feature/capability/capability6.slang @@ -0,0 +1,13 @@ +//TEST:SIMPLE(filecheck=CHECK): -target spirv -emit-spirv-directly -entry computeMain -stage compute +//TEST:SIMPLE(filecheck=CHECK_IGNORE_CAPS): -target spirv -emit-spirv-directly -entry computeMain -stage compute -ignore-capabilities +// CHECK_IGNORE_CAPS-NOT: error 36104 + + + +[require(spirv, hlsl)] +// CHECK: error 36111 +// CHECK_IGNORE_CAPS-NOT: error 36111 +void computeMain() +{ + +} -- cgit v1.2.3