diff options
Diffstat (limited to 'source/slang/reflection.cpp')
| -rw-r--r-- | source/slang/reflection.cpp | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/source/slang/reflection.cpp b/source/slang/reflection.cpp index f8d12b9e9..6661850ae 100644 --- a/source/slang/reflection.cpp +++ b/source/slang/reflection.cpp @@ -443,7 +443,7 @@ SLANG_API SlangReflectionType * spReflection_FindTypeByName(SlangReflection * re SLANG_API SlangReflectionTypeLayout* spReflection_GetTypeLayout( SlangReflection* reflection, - SlangReflectionType* inType, + SlangReflectionType* inType, SlangLayoutRules /*rules*/) { auto context = convert(reflection); @@ -674,6 +674,21 @@ SLANG_API SlangMatrixLayoutMode spReflectionTypeLayout_GetMatrixLayoutMode(Slang } +SLANG_API int spReflectionTypeLayout_getGenericParamIndex(SlangReflectionTypeLayout* inTypeLayout) +{ + auto typeLayout = convert(inTypeLayout); + if(!typeLayout) return -1; + + if(auto genericParamTypeLayout = dynamic_cast<GenericParamTypeLayout*>(typeLayout)) + { + return genericParamTypeLayout->paramIndex; + } + else + { + return -1; + } +} + // Variable Reflection @@ -925,7 +940,7 @@ namespace Slang return 0; } - + static VarLayout* getParameterByIndex(RefPtr<TypeLayout> typeLayout, unsigned index) { if(auto parameterGroupLayout = typeLayout.As<ParameterGroupTypeLayout>()) @@ -1147,6 +1162,24 @@ SLANG_API SlangReflectionEntryPoint* spReflection_getEntryPointByIndex(SlangRefl return convert(program->entryPoints[(int) index].Ptr()); } +SLANG_API SlangReflectionEntryPoint* spReflection_findEntryPointByName(SlangReflection* inProgram, char const* name) +{ + auto program = convert(inProgram); + if(!program) return 0; + + // TODO: improve on dumb linear search + for(auto ep : program->entryPoints) + { + if(ep->entryPoint->getName()->text == name) + { + return convert(ep); + } + } + + return nullptr; +} + + SLANG_API SlangUInt spReflection_getGlobalConstantBufferBinding(SlangReflection* inProgram) { auto program = convert(inProgram); |
