diff options
| author | Yong He <yongh@outlook.com> | 2018-01-03 12:46:23 -0800 |
|---|---|---|
| committer | Yong He <yongh@outlook.com> | 2018-01-03 12:46:23 -0800 |
| commit | 9f89c3b2de80c49222c4a6b48e845894c4256a5d (patch) | |
| tree | f35c1aa361e01dc300fc5eafcff0f866f93edc01 /slang.h | |
| parent | f52b93e15d68054a06db84ff86d077d9ce0af941 (diff) | |
Add API for querying TypeLayout from a Type
Added two API functions:
1. `spReflection_FindTypeByName`, which returns a DeclRefType to the struct type with the given name. The function finds from all loaded modules in a `CompileRequest` for a decl with the given name, construct a `Type` object and cache it in `CompileRequest::types` dictionary. The subsequent calls to `spReflection_FindTypeByName` with the same name will simply returned the cached Type objects.
2. `spReflection_GetTypeLayout`, which returns a `TypeLayout` for a given `Type`. This function creates and caches the `TypeLayout` in the `TargetRequest` object that is used to create the `ProgramLayout`.
Diffstat (limited to 'slang.h')
| -rw-r--r-- | slang.h | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -633,6 +633,12 @@ extern "C" SLANG_STAGE_PIXEL = SLANG_STAGE_FRAGMENT, }; + typedef SlangUInt32 SlangLayoutRules; + enum + { + SLANG_LAYOUT_RULES_DEFAULT, + }; + // Type Reflection SLANG_API SlangTypeKind spReflectionType_GetKind(SlangReflectionType* type); @@ -739,6 +745,9 @@ extern "C" SLANG_API SlangReflectionTypeParameter* spReflection_GetTypeParameterByIndex(SlangReflection* reflection, unsigned int index); SLANG_API SlangReflectionTypeParameter* spReflection_FindTypeParameter(SlangReflection* reflection, char const* name); + SLANG_API SlangReflectionType* spReflection_FindTypeByName(SlangReflection* reflection, char const* name); + SLANG_API SlangReflectionTypeLayout* spReflection_GetTypeLayout(SlangReflection* reflection, SlangReflectionType* reflectionType, SlangLayoutRules rules); + SLANG_API SlangUInt spReflection_getEntryPointCount(SlangReflection* reflection); SLANG_API SlangReflectionEntryPoint* spReflection_getEntryPointByIndex(SlangReflection* reflection, SlangUInt index); |
