diff options
| author | Yong He <yonghe@outlook.com> | 2024-02-02 22:28:02 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-02 22:28:02 -0800 |
| commit | 14764896c34b230a5563f48d8b8e565de2f3aa10 (patch) | |
| tree | 2f105d3f6222103f458054f1cd38e280b6fb52b4 /source/slang/slang.cpp | |
| parent | c15e7ade4e27e1649d5b98f5854e9e52bb9e60ae (diff) | |
Capability type checking. (#3530)
* Capability type checking.
* Fix.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang.cpp')
| -rw-r--r-- | source/slang/slang.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp index b95b21bb5..e99f94484 100644 --- a/source/slang/slang.cpp +++ b/source/slang/slang.cpp @@ -858,7 +858,7 @@ Profile getEffectiveProfile(EntryPoint* entryPoint, TargetRequest* target) case CodeGenTarget::SPIRVAssembly: if(targetProfile.getFamily() != ProfileFamily::GLSL) { - targetProfile.setVersion(ProfileVersion::GLSL_110); + targetProfile.setVersion(ProfileVersion::GLSL_150); } break; @@ -869,7 +869,7 @@ Profile getEffectiveProfile(EntryPoint* entryPoint, TargetRequest* target) case CodeGenTarget::DXILAssembly: if(targetProfile.getFamily() != ProfileFamily::DX) { - targetProfile.setVersion(ProfileVersion::DX_4_0); + targetProfile.setVersion(ProfileVersion::DX_5_1); } break; } @@ -1608,6 +1608,8 @@ CapabilitySet TargetRequest::getTargetCaps() break; } + CapabilitySet targetCap = CapabilitySet(atoms); + CapabilitySet latestSpirvCapSet = CapabilitySet(CapabilityName::spirv_latest); CapabilityName latestSpirvAtom = (CapabilityName)latestSpirvCapSet.getExpandedAtoms()[0].getExpandedAtoms().getLast(); for (auto atom : rawCapabilities) @@ -1623,7 +1625,11 @@ CapabilitySet TargetRequest::getTargetCaps() atom = (CapabilityName)((Int)CapabilityName::glsl_spirv_1_0 + ((Int)atom - (Int)CapabilityName::spirv_1_0)); } } - atoms.add(atom); + if (!targetCap.isIncompatibleWith(atom)) + { + // Only add atoms that are compatible with the current target. + atoms.add(atom); + } } cookedCapabilities = CapabilitySet(atoms); |
