summaryrefslogtreecommitdiffstats
path: root/source/slang/parameter-binding.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/parameter-binding.cpp')
-rw-r--r--source/slang/parameter-binding.cpp43
1 files changed, 37 insertions, 6 deletions
diff --git a/source/slang/parameter-binding.cpp b/source/slang/parameter-binding.cpp
index 37642ac81..b0d90d435 100644
--- a/source/slang/parameter-binding.cpp
+++ b/source/slang/parameter-binding.cpp
@@ -1709,10 +1709,46 @@ static RefPtr<TypeLayout> processEntryPointParameterDecl(
static RefPtr<TypeLayout> processEntryPointParameter(
ParameterBindingContext* context,
- RefPtr<Type> type,
+ RefPtr<Type> type,
EntryPointParameterState const& state,
RefPtr<VarLayout> varLayout)
{
+ if (varLayout)
+ {
+ varLayout->stage = state.stage;
+ }
+
+ // The default handling of varying parameters should not apply
+ // to geometry shader output streams; they have their own special rules.
+ if( auto gsStreamType = type->As<HLSLStreamOutputType>() )
+ {
+ //
+
+ auto elementType = gsStreamType->getElementType();
+
+ int semanticIndex = 0;
+
+ EntryPointParameterState elementState;
+ elementState.directionMask = kEntryPointParameterDirection_Output;
+ elementState.ioSemanticIndex = &semanticIndex;
+ elementState.isSampleRate = false;
+ elementState.optSemanticName = nullptr;
+ elementState.semanticSlotCount = 0;
+ elementState.stage = state.stage;
+
+ auto elementTypeLayout = processEntryPointParameter(context, elementType, elementState, nullptr);
+
+ RefPtr<StreamOutputTypeLayout> typeLayout = new StreamOutputTypeLayout();
+ typeLayout->type = type;
+ typeLayout->rules = elementTypeLayout->rules;
+ typeLayout->elementTypeLayout = elementTypeLayout;
+
+ for(auto resInfo : elementTypeLayout->resourceInfos)
+ typeLayout->addResourceUsage(resInfo);
+
+ return typeLayout;
+ }
+
// If there is an available semantic name and index,
// then we should apply it to this parameter unconditionally
// (that is, not just if it is a leaf parameter).
@@ -1733,11 +1769,6 @@ static RefPtr<TypeLayout> processEntryPointParameter(
varLayout->flags |= VarLayoutFlag::HasSemantic;
}
- if (varLayout)
- {
- varLayout->stage = state.stage;
- }
-
// Scalar and vector types are treated as outputs directly
if(auto basicType = type->As<BasicExpressionType>())
{