diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2022-04-21 13:47:18 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-04-21 13:47:18 -0400 |
| commit | 3638e7735be67c8f4dae3f4544134441aa1e029d (patch) | |
| tree | f59c6965321ddcc5991df2bab3ea507b3ce50292 /source/slang/slang-ir.cpp | |
| parent | 34f8b5e722aede018e275324c43055cad9a9ca5a (diff) | |
`export` support in HLSL (#2188)
* #include an absolute path didn't work - because paths were taken to always be relative.
* Compile to a dxil library.
* Added CompileProduct.
* Support handling of ModuleLibrary.
* CacheBehavior -> Cache
* Use CompileProduct for -r references.
* CompileProduct -> Artifact.
* Determining an artifact type on binding.
* Determine binary linkability.
* Added Artifact::exists.
* Added ArtifactKeep.
* Small fixes.
* Small improvements to Artifact.
* Add zip extension.
* Fix some comments.
* Fix multiple adding of PublicDecoration.
Make public output export for DXIL/lib.
Add checking for simpleDecorations such that only added once.
* Use 'whole program' to identify library build.
* Add -target dxil so test infrastructure knows it needs DXC.
Diffstat (limited to 'source/slang/slang-ir.cpp')
| -rw-r--r-- | source/slang/slang-ir.cpp | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/source/slang/slang-ir.cpp b/source/slang/slang-ir.cpp index 09a28e394..b53c247c3 100644 --- a/source/slang/slang-ir.cpp +++ b/source/slang/slang-ir.cpp @@ -23,8 +23,36 @@ namespace Slang sb << nameHint->getName(); } - // !!!!!!!!!!!!!!!!!!!!!!!!!!!! DiagnosticSink Impls !!!!!!!!!!!!!!!!!!!!! + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + + bool isSimpleDecoration(IROp op) + { + switch (op) + { + case kIROp_EarlyDepthStencilDecoration: return true; + case kIROp_GloballyCoherentDecoration: return true; + case kIROp_KeepAliveDecoration: return true; + case kIROp_LineAdjInputPrimitiveTypeDecoration: return true; + case kIROp_LineInputPrimitiveTypeDecoration: return true; + case kIROp_NoInlineDecoration: return true; + case kIROp_PointInputPrimitiveTypeDecoration: return true; + case kIROp_PreciseDecoration: return true; + case kIROp_PublicDecoration: return true; + case kIROp_ReadNoneDecoration: return true; + case kIROp_RequiresNVAPIDecoration: return true; + case kIROp_TriangleAdjInputPrimitiveTypeDecoration: return true; + case kIROp_TriangleInputPrimitiveTypeDecoration: return true; + case kIROp_UnsafeForceInlineEarlyDecoration: return true; + case kIROp_VulkanCallablePayloadDecoration: return true; + case kIROp_VulkanHitAttributesDecoration: return true; + case kIROp_VulkanRayPayloadDecoration: return true; + default: break; + } + return false; + } + IRInst* cloneGlobalValueWithLinkage( IRSpecContext* context, IRInst* originalVal, @@ -4172,6 +4200,16 @@ namespace Slang IRDecoration* IRBuilder::addDecoration(IRInst* value, IROp op, IRInst* const* operands, Int operandCount) { + // If it's a simple (ie stateless) decoration, don't add it again. + if (operandCount == 0 && isSimpleDecoration(op)) + { + auto decoration = value->findDecorationImpl(op); + if (decoration) + { + return decoration; + } + } + auto decoration = createInstWithTrailingArgs<IRDecoration>( this, op, |
