summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/slang/slang-reflection.cpp47
1 files changed, 43 insertions, 4 deletions
diff --git a/source/slang/slang-reflection.cpp b/source/slang/slang-reflection.cpp
index 8901f6bdd..c0c5bd72f 100644
--- a/source/slang/slang-reflection.cpp
+++ b/source/slang/slang-reflection.cpp
@@ -357,9 +357,9 @@ SLANG_API SlangReflectionType* spReflectionType_GetElementType(SlangReflectionTy
{
return (SlangReflectionType*) arrayType->baseType.Ptr();
}
- else if( auto constantBufferType = as<ConstantBufferType>(type))
+ else if( auto parameterGroupType = as<ParameterGroupType>(type))
{
- return convert(constantBufferType->elementType.Ptr());
+ return convert(parameterGroupType->elementType.Ptr());
}
else if( auto vectorType = as<VectorExpressionType>(type))
{
@@ -680,6 +680,21 @@ SLANG_API size_t spReflectionTypeLayout_GetSize(SlangReflectionTypeLayout* inTyp
return getReflectionSize(info->count);
}
+SLANG_API int32_t spReflectionTypeLayout_getAlignment(SlangReflectionTypeLayout* inTypeLayout, SlangParameterCategory category)
+{
+ auto typeLayout = convert(inTypeLayout);
+ if(!typeLayout) return 0;
+
+ if( category == SLANG_PARAMETER_CATEGORY_UNIFORM )
+ {
+ return int32_t(typeLayout->uniformAlignment);
+ }
+ else
+ {
+ return 1;
+ }
+}
+
SLANG_API SlangReflectionVariableLayout* spReflectionTypeLayout_GetFieldByIndex(SlangReflectionTypeLayout* inTypeLayout, unsigned index)
{
auto typeLayout = convert(inTypeLayout);
@@ -758,9 +773,22 @@ SLANG_API SlangReflectionVariableLayout* spReflectionTypeLayout_GetElementVarLay
auto typeLayout = convert(inTypeLayout);
if(!typeLayout) return nullptr;
- if( auto constantBufferTypeLayout = as<ParameterGroupTypeLayout>(typeLayout))
+ if( auto parameterGroupTypeLayout = as<ParameterGroupTypeLayout>(typeLayout))
{
- return convert(constantBufferTypeLayout->elementVarLayout.Ptr());
+ return convert(parameterGroupTypeLayout->elementVarLayout.Ptr());
+ }
+
+ return nullptr;
+}
+
+SLANG_API SlangReflectionVariableLayout* spReflectionTypeLayout_getContainerVarLayout(SlangReflectionTypeLayout* inTypeLayout)
+{
+ auto typeLayout = convert(inTypeLayout);
+ if(!typeLayout) return nullptr;
+
+ if( auto parameterGroupTypeLayout = as<ParameterGroupTypeLayout>(typeLayout))
+ {
+ return convert(parameterGroupTypeLayout->containerVarLayout.Ptr());
}
return nullptr;
@@ -1300,6 +1328,17 @@ SLANG_API SlangReflectionVariableLayout* spReflectionEntryPoint_getVarLayout(
return convert(entryPointLayout->parametersLayout);
}
+SLANG_API SlangReflectionVariableLayout* spReflectionEntryPoint_getResultVarLayout(
+ SlangReflectionEntryPoint* inEntryPoint)
+{
+ auto entryPointLayout = convert(inEntryPoint);
+ if(!entryPointLayout)
+ return nullptr;
+
+ return convert(entryPointLayout->resultLayout);
+}
+
+
static bool hasDefaultConstantBuffer(ScopeLayout* layout)
{
auto typeLayout = layout->parametersLayout->getTypeLayout();