diff options
| author | ArielG-NV <159081215+ArielG-NV@users.noreply.github.com> | 2025-08-08 13:19:25 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-08 20:19:25 +0000 |
| commit | 07f21ee31b5f427edb72d5578f713b3da3f3b96f (patch) | |
| tree | 777df480b51f488a296bcf0c231afc3cfff2afdc /tests/language-feature/capability/capabilitySimplification1.slang | |
| parent | 719772c01a8ee8afa81cded249d6a51e33e17d8d (diff) | |
Error if super-type capabilities are a super-set of sub-type (#7452)
Fixes: #7410
Changes:
1. super-type capabilities must be a super-set of sub-type capabilities
(and support the same shader stages/targets)
* InheritanceDecl visits super-type to inherit it's capabilities;
validate InheritanceDecl capabilities against sub-type
* visit all container decl's with a default case
* clean up functionDeclBase visitor
* Simplify `diagnoseUndeclaredCapability` by moving logic into
capability checking (more correct*)
3. added changed behavior to documentation
4. fixed some incorrect capabilities
5. **we do not** diagnose capability errors on interface
requirement-to-implementation if both lack explicit capability
requirements. This change is to work around a slangpy regression (test
case for the failing situation is in
`tests\language-feature\capability\capability-interface-extension-1.slang`),
Note: maybe for slang-2026 we don't do this?
6. requirement & implementation must support the same shader
stage/target. This was changed because otherwise we can have cases where
`X` inherits from `Y`, but `Y` is only expected to be used in `glsl`
whilst `X` is expected to be used in `hlsl | glsl`
7. removed
`tests/language-feature/capability/capabilitySimplification3.slang`
because it tests nothing special (redundant)
Note: not using rebase due to separate branches depending on this PR
---------
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
Diffstat (limited to 'tests/language-feature/capability/capabilitySimplification1.slang')
| -rw-r--r-- | tests/language-feature/capability/capabilitySimplification1.slang | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/tests/language-feature/capability/capabilitySimplification1.slang b/tests/language-feature/capability/capabilitySimplification1.slang index 440ac1ced..0e6303412 100644 --- a/tests/language-feature/capability/capabilitySimplification1.slang +++ b/tests/language-feature/capability/capabilitySimplification1.slang @@ -1,24 +1,13 @@ //TEST:SIMPLE(filecheck=CHECK): -target glsl -entry computeMain -stage compute -profile sm_5_0 //TEST:SIMPLE(filecheck=CHECK_IGNORE_CAPS): -target glsl -emit-spirv-directly -entry computeMain -stage compute -profile sm_5_0 -ignore-capabilities - // CHECK_IGNORE_CAPS-NOT: error 36107 -// CHECK: error 36107 -// CHECK-SAME: entrypoint 'computeMain' uses features that are not available in 'compute' stage for 'glsl' target. -// CHECK: capabilitySimplification1.slang(21): note: see using of 'WaveMultiPrefixCountBits' -// CHECK-NOT: see using of 'WaveMultiPrefixCountBits' -// CHECK: {{.*}}.meta.slang({{.*}}): note: see definition of 'WaveMultiPrefixCountBits' -// CHECK: {{.*}}.meta.slang({{.*}}): note: see declaration of 'require' - -void nestedSafeCall() -{ - AllMemoryBarrier(); -} - -void nestedBadCall() +[numthreads(1, 1, 1)] +// CHECK: ([[# @LINE+1]]): error 36107: {{.*}}computeMain{{.*}}compute{{.*}}glsl +void computeMain() { - WaveMultiPrefixCountBits(true, 0); + nestedCall(); } void nestedCall() @@ -27,8 +16,13 @@ void nestedCall() nestedBadCall(); } -[numthreads(1,1,1)] -void computeMain() +void nestedSafeCall() { - nestedCall(); + AllMemoryBarrier(); } + +void nestedBadCall() +{ + // CHECK: ([[# @LINE+1]]): note: see using of 'WaveMultiPrefixCountBits' + WaveMultiPrefixCountBits(true, 0); +}
\ No newline at end of file |
