From 537697d3aa21b418c348b1017005603668b6a4cb Mon Sep 17 00:00:00 2001 From: Julius Ikkala Date: Thu, 16 Oct 2025 21:53:10 +0300 Subject: Inline global constants for shader style CPU targets (#8686) On the shader-host-callable target, test `gh-4874.slang` generates IR that contains global constants referencing global params. These need to get inlined into functions, as otherwise `introduceExplicitGlobalContext()` will fail with "no outer func at use site for global", making the test crash the compiler. --- source/slang/slang-type-layout.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source/slang/slang-type-layout.cpp') diff --git a/source/slang/slang-type-layout.cpp b/source/slang/slang-type-layout.cpp index 5bbcd2eb1..2daf33fdf 100644 --- a/source/slang/slang-type-layout.cpp +++ b/source/slang/slang-type-layout.cpp @@ -2712,6 +2712,12 @@ bool isWGPUTarget(TargetRequest* targetReq) return isWGPUTarget(targetReq->getTarget()); } +bool isKernelTarget(CodeGenTarget codeGenTarget) +{ + return ArtifactDescUtil::makeDescForCompileTarget(asExternal(codeGenTarget)).style == + ArtifactStyle::Kernel; +} + SourceLanguage getIntermediateSourceLanguageForTarget(TargetProgram* targetProgram) { // If we are emitting directly, there is no intermediate source language -- cgit v1.2.3