summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEllie Hermaszewska <ellieh@nvidia.com>2023-08-08 13:22:47 +0800
committerGitHub <noreply@github.com>2023-08-07 22:22:47 -0700
commit43e0fba1a51ae27ac2b3ab12e9b6bbb87126b7cc (patch)
treec25d62fecef4c34cae7687afdf2ab99be0f22a7a
parentae1c9d9825b5e672f64277f13b3c6a6d4a5155c3 (diff)
Default target intrinsic should not apply to SPIR-V (#3054)
* Default target intrinsic should not apply to SPIR-V * CapabilitySet is a conjunction * Add TEXTUAL_SOURCE capability class
-rw-r--r--source/slang/slang-capability-defs.h12
-rw-r--r--source/slang/slang-lower-to-ir.cpp6
2 files changed, 12 insertions, 6 deletions
diff --git a/source/slang/slang-capability-defs.h b/source/slang/slang-capability-defs.h
index 14173b6bc..e9deb3fd6 100644
--- a/source/slang/slang-capability-defs.h
+++ b/source/slang/slang-capability-defs.h
@@ -50,11 +50,13 @@
// and for `glsl+spirv` or even just for `spirv`, and how should all of those impact
// overloading).
//
-SLANG_CAPABILITY_ATOM0(HLSL, hlsl, Concrete,TargetFormat,0)
-SLANG_CAPABILITY_ATOM0(GLSL, glsl, Concrete,TargetFormat,0)
-SLANG_CAPABILITY_ATOM0(C, c, Concrete,TargetFormat,0)
-SLANG_CAPABILITY_ATOM0(CPP, cpp, Concrete,TargetFormat,0)
-SLANG_CAPABILITY_ATOM0(CUDA, cuda, Concrete,TargetFormat,0)
+SLANG_CAPABILITY_ATOM0(TEXTUAL_SOURCE, textual_source, Abstract,None,0)
+SLANG_CAPABILITY_ATOM1(HLSL, hlsl, Concrete,TargetFormat,0,TEXTUAL_SOURCE)
+SLANG_CAPABILITY_ATOM1(GLSL, glsl, Concrete,TargetFormat,0,TEXTUAL_SOURCE)
+SLANG_CAPABILITY_ATOM1(C, c, Concrete,TargetFormat,0,TEXTUAL_SOURCE)
+SLANG_CAPABILITY_ATOM1(CPP, cpp, Concrete,TargetFormat,0,TEXTUAL_SOURCE)
+SLANG_CAPABILITY_ATOM1(CUDA, cuda, Concrete,TargetFormat,0,TEXTUAL_SOURCE)
+
SLANG_CAPABILITY_ATOM0(SPIRV_DIRECT, spirv_direct, Concrete, TargetFormat, 0)
// We have multiple capabilities for the various SPIR-V versions,
diff --git a/source/slang/slang-lower-to-ir.cpp b/source/slang/slang-lower-to-ir.cpp
index e0e97d6e7..f642409a1 100644
--- a/source/slang/slang-lower-to-ir.cpp
+++ b/source/slang/slang-lower-to-ir.cpp
@@ -8276,7 +8276,11 @@ struct DeclLoweringVisitor : DeclVisitor<DeclLoweringVisitor, LoweredValInfo>
definition.append(getText(declForName->getName()));
- getBuilder()->addTargetIntrinsicDecoration(irInst, CapabilitySet::makeEmpty(), definition.getUnownedSlice());
+ getBuilder()->addTargetIntrinsicDecoration(
+ irInst,
+ CapabilitySet(CapabilityAtom::TEXTUAL_SOURCE),
+ definition.getUnownedSlice()
+ );
}
void addParamNameHint(IRInst* inst, IRLoweringParameterInfo const& info)