From 43e0fba1a51ae27ac2b3ab12e9b6bbb87126b7cc Mon Sep 17 00:00:00 2001 From: Ellie Hermaszewska Date: Tue, 8 Aug 2023 13:22:47 +0800 Subject: 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 --- source/slang/slang-capability-defs.h | 12 +++++++----- source/slang/slang-lower-to-ir.cpp | 6 +++++- 2 files changed, 12 insertions(+), 6 deletions(-) (limited to 'source') 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 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) -- cgit v1.2.3