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.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/source/slang/slang-type-layout.cpp b/source/slang/slang-type-layout.cpp
index 22aa3f304..293dce7c6 100644
--- a/source/slang/slang-type-layout.cpp
+++ b/source/slang/slang-type-layout.cpp
@@ -722,6 +722,9 @@ static LayoutResourceKind _getHLSLLayoutResourceKind(ShaderParameterKind kind)
{
switch (kind)
{
+ case ShaderParameterKind::SubpassInput:
+ return LayoutResourceKind::InputAttachmentIndex;
+
case ShaderParameterKind::ConstantBuffer:
return LayoutResourceKind::ConstantBuffer;
@@ -778,6 +781,13 @@ struct GLSLObjectLayoutRulesImpl : ObjectLayoutRulesImpl
}
}
+ switch (kind)
+ {
+ case ShaderParameterKind::SubpassInput:
+ return SimpleLayoutInfo(LayoutResourceKind::InputAttachmentIndex, slotCount);
+ default:
+ break;
+ }
return SimpleLayoutInfo(LayoutResourceKind::DescriptorTableSlot, slotCount);
}
};
@@ -4089,6 +4099,17 @@ static TypeLayoutResult _createTypeLayout(
type,
rules);
}
+ else if (as<SubpassInputType>(type))
+ {
+ // SubpassInputType fills 2 slots, 'shader resource' and 'input_attachment_index'
+ auto objLayout1 = rules->GetObjectLayout(ShaderParameterKind::Texture, context.objectLayoutOptions);
+ auto objLayout2 = rules->GetObjectLayout(ShaderParameterKind::SubpassInput, context.objectLayoutOptions);
+ objLayout1.layoutInfos.add(objLayout2.layoutInfos.getFirst());
+ return createSimpleTypeLayout(
+ objLayout1,
+ type,
+ rules);
+ }
else if (auto textureType = as<TextureType>(type))
{
// TODO: the logic here should really be defined by the rules,