From 2e7e2b568ce93697e36a7c0b50364dc78bd1bb97 Mon Sep 17 00:00:00 2001 From: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com> Date: Thu, 25 Jul 2024 18:04:47 -0400 Subject: Add `_Internal`/`External` atom enforcement and validation. (#4702) * Add `_Internal`/`External` atom validation and use enforcement. Fixes: #4676 Changes: * Added `validateInternalAtomExternalAtomPair` to the capability generator to ensure all `_Internal` atoms have a corresponding `External` atom. * Validation of 'RequireCapabilityAttribute' warns if a user uses an '_Internal' atom. * Added 'External' atoms to atoms with an already existing '_Internal' atom. * Printing an atom removes '_'. * Fixed some incorrect which were checking for the incorrect warning/error (capability4.slang, capability5.slang, capability6.slang). * switch capability name to use `UnownedStringSlice` instead of `const char*` switch capability name to use `UnownedStringSlice` instead of `const char*`, this includes using functions like `.startsWith`. * grammer --------- Co-authored-by: Yong He --- source/slang/slang-capability.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source/slang/slang-capability.h') diff --git a/source/slang/slang-capability.h b/source/slang/slang-capability.h index 79b1f7068..2e12af622 100644 --- a/source/slang/slang-capability.h +++ b/source/slang/slang-capability.h @@ -340,6 +340,9 @@ bool isCapabilityDerivedFrom(CapabilityAtom atom, CapabilityAtom base); /// Find a capability atom with the given `name`, or return CapabilityAtom::Invalid. CapabilityName findCapabilityName(UnownedStringSlice const& name); + /// Check if 'name' is an '_Internal' or 'External' capability. +bool isInternalCapabilityName(CapabilityName name); + CapabilityAtom getLatestSpirvAtom(); CapabilityAtom getLatestMetalAtom(); -- cgit v1.2.3