summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-compiler.cpp
diff options
context:
space:
mode:
authorArielG-NV <159081215+ArielG-NV@users.noreply.github.com>2024-08-28 15:06:23 -0400
committerGitHub <noreply@github.com>2024-08-28 12:06:23 -0700
commit65240d074b4ddec55e56962ebf8de46207bcf5fa (patch)
treefa887d3de8ab55c7498eae2d5bf61966818135a1 /source/slang/slang-compiler.cpp
parent638e5fb000d4e242a91e8b653da4a72daec0efda (diff)
Allow capabilities to be used with `[shader("...")]` (#4928)
* Allow capabilities to be used with `[shader("...")]` Fixes: #4917 Changes: 1. Allow using capabilities instead of `Stage`s with `EntryPointAttribute`. 2. When resolving capabilities for an entrypoint+profile (per entrypoint) in `resolveStageOfProfileWithEntryPoint` add our `EntryPointAttribute` and resolved capability 3. Added tests and some capabilities related clean-up * fix a warning made by a mistake in syntax * change fineStageByName to assume it is passed a stage without a '_' * test with and without prefix '_' * cleanup some profiles and reprisentation to work better with 'Stage' and 'Profile' This use case is why we need to clean all profile-usage into `CapabilityName`s directly. * change how we compare * only change profiles * let all capabilities be resolved by 'shader' profile for now * fix warning checks I accidently broke * meshshading_internal to _meshshading --------- Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'source/slang/slang-compiler.cpp')
-rw-r--r--source/slang/slang-compiler.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/source/slang/slang-compiler.cpp b/source/slang/slang-compiler.cpp
index f5b7ff428..428532658 100644
--- a/source/slang/slang-compiler.cpp
+++ b/source/slang/slang-compiler.cpp
@@ -361,7 +361,7 @@ namespace Slang
return lookUp(UnownedTerminatedStringSlice(name));
}
- List<CapabilityName> Profile::getCapabilityName()
+ CapabilitySet Profile::getCapabilityName()
{
List<CapabilityName> result;
switch (getVersion())
@@ -378,7 +378,11 @@ namespace Slang
default:
break;
}
- return result;
+
+ CapabilitySet resultSet = CapabilitySet(result);
+ for(auto i : this->additionalCapabilities)
+ resultSet.join(i);
+ return resultSet;
}
char const* Profile::getName()
@@ -451,21 +455,21 @@ namespace Slang
return Stage::Fragment;
case CapabilityAtom::compute:
return Stage::Compute;
- case CapabilityAtom::mesh:
+ case CapabilityAtom::_mesh:
return Stage::Mesh;
- case CapabilityAtom::amplification:
+ case CapabilityAtom::_amplification:
return Stage::Amplification;
- case CapabilityAtom::anyhit:
+ case CapabilityAtom::_anyhit:
return Stage::AnyHit;
- case CapabilityAtom::closesthit:
+ case CapabilityAtom::_closesthit:
return Stage::ClosestHit;
- case CapabilityAtom::intersection:
+ case CapabilityAtom::_intersection:
return Stage::Intersection;
- case CapabilityAtom::raygen:
+ case CapabilityAtom::_raygen:
return Stage::RayGeneration;
- case CapabilityAtom::miss:
+ case CapabilityAtom::_miss:
return Stage::Miss;
- case CapabilityAtom::callable:
+ case CapabilityAtom::_callable:
return Stage::Callable;
default:
SLANG_UNEXPECTED("unknown stage atom");