diff options
Diffstat (limited to 'source/slang/slang-type-layout.cpp')
| -rw-r--r-- | source/slang/slang-type-layout.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/source/slang/slang-type-layout.cpp b/source/slang/slang-type-layout.cpp index 46a521f79..88ec5f4f7 100644 --- a/source/slang/slang-type-layout.cpp +++ b/source/slang/slang-type-layout.cpp @@ -3489,6 +3489,13 @@ static TypeLayoutResult _createTypeLayout( { arrayResourceCount = elementResourceInfo.count; } + // The second exception to this is arrays of an existential type + // where the entire array should be specialized to a single concrete type. + // + else if (elementResourceInfo.kind == LayoutResourceKind::ExistentialTypeParam) + { + arrayResourceCount = elementResourceInfo.count; + } // // The next big exception is when we are forming an unbounded-size // array and the element type got "adjusted," because that means @@ -3677,6 +3684,7 @@ static TypeLayoutResult _createTypeLayout( typeLayout->rules = rules; LayoutSize fixedExistentialValueSize = 0; + LayoutSize uniformSlotSize = 0; bool targetSupportsPointer = isCPUTarget(context.targetReq) || isCUDATarget(context.targetReq); @@ -3689,7 +3697,7 @@ static TypeLayoutResult _createTypeLayout( fixedExistentialValueSize = anyValueAttr->size; } // Append 16 bytes to accommodate RTTI pointer and witness table pointer. - auto uniformSlotSize = fixedExistentialValueSize + 16; + uniformSlotSize = fixedExistentialValueSize + 16; typeLayout->addResourceUsage(LayoutResourceKind::Uniform, uniformSlotSize); } typeLayout->addResourceUsage(LayoutResourceKind::ExistentialTypeParam, 1); @@ -3736,8 +3744,9 @@ static TypeLayoutResult _createTypeLayout( typeLayout->pendingDataTypeLayout = concreteTypeLayout; } } - - return TypeLayoutResult(typeLayout, SimpleLayoutInfo()); + // Interface type occupies a uniform slot for the fixed size storage, with alignment of 4 bytes. + return TypeLayoutResult( + typeLayout, SimpleLayoutInfo(LayoutResourceKind::Uniform, uniformSlotSize, 4)); } else if( auto enumDeclRef = declRef.as<EnumDecl>() ) { |
