summaryrefslogtreecommitdiff
path: root/source/slang
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang')
-rw-r--r--source/slang/reflection.cpp37
-rw-r--r--source/slang/slang.cpp6
2 files changed, 37 insertions, 6 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);
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp
index 2b1857e07..b94e146dd 100644
--- a/source/slang/slang.cpp
+++ b/source/slang/slang.cpp
@@ -979,9 +979,6 @@ SLANG_API void spDestroySession(
{
if(!session) return;
delete SESSION(session);
-#ifdef _MSC_VER
- _CrtDumpMemoryLeaks();
-#endif
}
SLANG_API void spAddBuiltins(
@@ -1483,7 +1480,8 @@ SLANG_API SlangResult spGetEntryPointCodeBlob(
}
Slang::CompileResult& result = targetReq->entryPointResults[entryPointIndex];
- *outBlob = result.getBlob().detach();
+ auto blob = result.getBlob();
+ *outBlob = blob.detach();
return SLANG_OK;
}