From dd06524f523cdac9c753801ce9c3992f66ae5576 Mon Sep 17 00:00:00 2001 From: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com> Date: Thu, 14 Aug 2025 12:27:55 -0700 Subject: [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> --- source/slang/slang-check-decl.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'source/slang/slang-check-decl.cpp') 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; -- cgit v1.2.3