summaryrefslogtreecommitdiff
path: root/source/slang/slang-emit.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-04-24 16:23:35 -0700
committerGitHub <noreply@github.com>2024-04-24 16:23:35 -0700
commitd3ed08ec3073c3cb9ac24fa3670784dd6e97a164 (patch)
tree8589874c7dd2c1698a5dcbe22d7a2bd74fa29abf /source/slang/slang-emit.cpp
parentfc4c242442510fb97c3cfbf04d7582ebbc3bb0ed (diff)
Parameter layout and reflection for Metal bindings. (#4022)
Diffstat (limited to 'source/slang/slang-emit.cpp')
-rw-r--r--source/slang/slang-emit.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/source/slang/slang-emit.cpp b/source/slang/slang-emit.cpp
index 77164dae3..5cfcde0c9 100644
--- a/source/slang/slang-emit.cpp
+++ b/source/slang/slang-emit.cpp
@@ -583,6 +583,7 @@ Result linkAndOptimizeIR(
// will have (more) legal shader code.
//
legalizeExistentialTypeLayout(
+ targetProgram,
irModule,
sink);
@@ -603,6 +604,7 @@ Result linkAndOptimizeIR(
// then become multiple variables/parameters/arguments/etc.
//
legalizeResourceTypes(
+ targetProgram,
irModule,
sink);
@@ -617,6 +619,7 @@ Result linkAndOptimizeIR(
// On CPU/CUDA targets, we simply elminate any empty types if
// they are not part of public interface.
legalizeEmptyTypes(
+ targetProgram,
irModule,
sink);
}
@@ -876,6 +879,7 @@ Result linkAndOptimizeIR(
case CodeGenTarget::GLSL:
case CodeGenTarget::SPIRV:
case CodeGenTarget::SPIRVAssembly:
+ case CodeGenTarget::Metal:
moveGlobalVarInitializationToEntryPoints(irModule);
break;
case CodeGenTarget::CPPSource:
@@ -941,9 +945,12 @@ Result linkAndOptimizeIR(
if (options.shouldLegalizeExistentialAndResourceTypes)
{
- // We need to lower any types used in a buffer resource (e.g. ContantBuffer or StructuredBuffer) into
- // a simple storage type that has target independent layout based on the kind of buffer resource.
- lowerBufferElementTypeToStorageType(targetProgram, irModule);
+ if (!isMetalTarget(targetRequest))
+ {
+ // We need to lower any types used in a buffer resource (e.g. ContantBuffer or StructuredBuffer) into
+ // a simple storage type that has target independent layout based on the kind of buffer resource.
+ lowerBufferElementTypeToStorageType(targetProgram, irModule);
+ }
}
// Rewrite functions that return arrays to return them via `out` parameter,