summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorJay Kwak <82421531+jkwak-work@users.noreply.github.com>2025-03-31 16:31:48 -0700
committerGitHub <noreply@github.com>2025-03-31 23:31:48 +0000
commitbc9dc6557fc0cc3a4c0c2ff27e636940e361cf5d (patch)
tree5a11e5d5b252ef4fc39e68f95cbb15fada0e54b7 /source
parentd728451854e69fde69bae6232d2927eedfa9c7bb (diff)
Revert "Eliminate empty struct on metal target (#6603)" (#6711)
This reverts commit b3deec2001ea34e20e9a6af8ddf5cf3866cafac0.
Diffstat (limited to 'source')
-rw-r--r--source/slang/slang-emit.cpp9
-rw-r--r--source/slang/slang-ir-legalize-types.cpp10
-rw-r--r--source/slang/slang-legalize-types.cpp6
-rw-r--r--source/slang/slang-legalize-types.h2
4 files changed, 1 insertions, 26 deletions
diff --git a/source/slang/slang-emit.cpp b/source/slang/slang-emit.cpp
index 8d7577b52..841f44a80 100644
--- a/source/slang/slang-emit.cpp
+++ b/source/slang/slang-emit.cpp
@@ -1278,15 +1278,6 @@ Result linkAndOptimizeIR(
//
legalizeResourceTypes(targetProgram, irModule, sink);
- // We also need to legalize empty types for Metal targets.
- switch (target)
- {
- case CodeGenTarget::Metal:
- case CodeGenTarget::MetalLib:
- case CodeGenTarget::MetalLibAssembly:
- legalizeEmptyTypes(targetProgram, irModule, sink);
- break;
- }
// Debugging output of legalization
#if 0
dumpIRIfEnabled(codeGenContext, irModule, "LEGALIZED");
diff --git a/source/slang/slang-ir-legalize-types.cpp b/source/slang/slang-ir-legalize-types.cpp
index 837193abc..197cd93c5 100644
--- a/source/slang/slang-ir-legalize-types.cpp
+++ b/source/slang/slang-ir-legalize-types.cpp
@@ -4123,11 +4123,6 @@ struct IREmptyTypeLegalizationContext : IRTypeLegalizationContext
bool isSimpleType(IRType* type) override
{
- if (isMetalTarget(targetProgram->getTargetReq()))
- {
- return false;
- }
-
// If type is used as public interface, then treat it as simple.
for (auto decor : type->getDecorations())
{
@@ -4150,11 +4145,6 @@ struct IREmptyTypeLegalizationContext : IRTypeLegalizationContext
{
return LegalType();
}
-
- virtual bool shouldLegalizeParameterBlockElementType() override
- {
- return isMetalTarget(targetProgram->getTargetReq());
- }
};
// The main entry points that are used when transforming IR code
diff --git a/source/slang/slang-legalize-types.cpp b/source/slang/slang-legalize-types.cpp
index cc2c12d42..e26475522 100644
--- a/source/slang/slang-legalize-types.cpp
+++ b/source/slang/slang-legalize-types.cpp
@@ -1211,15 +1211,11 @@ LegalType legalizeTypeImpl(TypeLegalizationContext* context, IRType* type)
LegalType legalElementType;
if (isMetalTarget(context->targetProgram->getTargetReq()) &&
- as<IRParameterBlockType>(uniformBufferType) &&
- !context->shouldLegalizeParameterBlockElementType())
+ as<IRParameterBlockType>(uniformBufferType))
{
// On Metal, we do not need to legalize the element type of
// a parameter block because we can translate it directly into
// an argument buffer.
- //
- // But we do need empty type legalized for Metal, because Metal doesn't
- // allow empty struct in argument buffer.
legalElementType = LegalType::simple(originalElementType);
}
else
diff --git a/source/slang/slang-legalize-types.h b/source/slang/slang-legalize-types.h
index f1b15877d..ae76cbd39 100644
--- a/source/slang/slang-legalize-types.h
+++ b/source/slang/slang-legalize-types.h
@@ -659,8 +659,6 @@ struct IRTypeLegalizationContext
IROp op,
LegalType legalElementType,
IRInst* layoutOperand) = 0;
-
- virtual bool shouldLegalizeParameterBlockElementType() { return false; }
};
// This typedef exists to support pre-existing code from when