summaryrefslogtreecommitdiff
path: root/source/slang/slang-type-layout.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-type-layout.cpp')
-rw-r--r--source/slang/slang-type-layout.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/source/slang/slang-type-layout.cpp b/source/slang/slang-type-layout.cpp
index 9b00fc88c..dbdfaf79c 100644
--- a/source/slang/slang-type-layout.cpp
+++ b/source/slang/slang-type-layout.cpp
@@ -3613,6 +3613,22 @@ static TypeLayoutResult _createTypeLayout(
typeLayout->type = type;
typeLayout->rules = rules;
+ if (isCPUTarget(context.targetReq) || isCUDATarget(context.targetReq))
+ {
+ LayoutSize fixedSize = 16;
+ if (auto anyValueAttr =
+ interfaceDeclRef.getDecl()->findModifier<AnyValueSizeAttribute>())
+ {
+ fixedSize += anyValueAttr->size;
+ }
+ else
+ {
+ // The interface type does not have an `[anyValueSize]` attribute,
+ // assume a default of 8 bytes.
+ fixedSize += 8;
+ }
+ typeLayout->addResourceUsage(LayoutResourceKind::Uniform, fixedSize);
+ }
typeLayout->addResourceUsage(LayoutResourceKind::ExistentialTypeParam, 1);
typeLayout->addResourceUsage(LayoutResourceKind::ExistentialObjectParam, 1);