summaryrefslogtreecommitdiff
path: root/source/slang/slang-check-decl.cpp
diff options
context:
space:
mode:
authorArielG-NV <159081215+ArielG-NV@users.noreply.github.com>2025-08-14 12:27:55 -0700
committerGitHub <noreply@github.com>2025-08-14 19:27:55 +0000
commitdd06524f523cdac9c753801ce9c3992f66ae5576 (patch)
treea73cad28075d1beaa04ba50dc4b668f3097c87b2 /source/slang/slang-check-decl.cpp
parentceb2e8d04885d55dd9685a38977a55c4f53f202f (diff)
[Capability System] Fix bug where capabilities do not correctly propegate if AST-parent has target+set the AST-child does not (#8175)
Fixes: #8174 Changes: * To determine if we propagate capabilities, we need to ensure that a `join` will do nothing (optimization since `join` is expensive + caching data for the `join` adds up to be expensive). This logic was changed in `slang-check-decl.cpp` since the current logic was incorrect. * A parent could have the set `metal+glsl` and the use-site could have `glsl`. In this case, we will not remove `metal` from the parent since `{metal+glsl}.implies({glsl})` is true. --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
Diffstat (limited to 'source/slang/slang-check-decl.cpp')
-rw-r--r--source/slang/slang-check-decl.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/source/slang/slang-check-decl.cpp b/source/slang/slang-check-decl.cpp
index 0a9853012..507e12fa6 100644
--- a/source/slang/slang-check-decl.cpp
+++ b/source/slang/slang-check-decl.cpp
@@ -14268,7 +14268,11 @@ static void _propagateRequirement(
ensureDecl(visitor, referencedDecl, DeclCheckState::CapabilityChecked);
}
- if (resultCaps.implies(nodeCaps))
+ // If we do not have the same target+stage, we need to `join` to remove excess target+stage.
+ //
+ // If we have the same target+stage but current capabilities do not imply incoming capabilities,
+ // we need to `join`.
+ if (!resultCaps.joinWithOtherWillChangeThis(nodeCaps))
return;
auto oldCaps = resultCaps;