summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/core/core.vcxproj3
-rw-r--r--source/core/core.vcxproj.filters9
-rw-r--r--source/core/smart-pointer.h10
-rw-r--r--source/slang/reflection.cpp37
-rw-r--r--source/slang/slang.cpp6
5 files changed, 45 insertions, 20 deletions
diff --git a/source/core/core.vcxproj b/source/core/core.vcxproj
index ecd8ee07b..3dbfaac3f 100644
--- a/source/core/core.vcxproj
+++ b/source/core/core.vcxproj
@@ -182,12 +182,9 @@
<ClInclude Include="list.h" />
<ClInclude Include="platform.h" />
<ClInclude Include="secure-crt.h" />
- <ClInclude Include="slang-com-ptr.h" />
- <ClInclude Include="slang-defines.h" />
<ClInclude Include="slang-free-list.h" />
<ClInclude Include="slang-io.h" />
<ClInclude Include="slang-math.h" />
- <ClInclude Include="slang-result.h" />
<ClInclude Include="slang-string-util.h" />
<ClInclude Include="slang-string.h" />
<ClInclude Include="smart-pointer.h" />
diff --git a/source/core/core.vcxproj.filters b/source/core/core.vcxproj.filters
index 39a164770..27b0fe82f 100644
--- a/source/core/core.vcxproj.filters
+++ b/source/core/core.vcxproj.filters
@@ -45,12 +45,6 @@
<ClInclude Include="secure-crt.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="slang-com-ptr.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="slang-defines.h">
- <Filter>Header Files</Filter>
- </ClInclude>
<ClInclude Include="slang-free-list.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -60,9 +54,6 @@
<ClInclude Include="slang-math.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="slang-result.h">
- <Filter>Header Files</Filter>
- </ClInclude>
<ClInclude Include="slang-string-util.h">
<Filter>Header Files</Filter>
</ClInclude>
diff --git a/source/core/smart-pointer.h b/source/core/smart-pointer.h
index bc1683a5b..4c6744d1b 100644
--- a/source/core/smart-pointer.h
+++ b/source/core/smart-pointer.h
@@ -6,6 +6,8 @@
#include <assert.h>
+#include "../../slang.h"
+
namespace Slang
{
// TODO: Need to centralize these typedefs
@@ -199,13 +201,17 @@ namespace Slang
T* detach()
{
- if (pointer)
- dynamic_cast<RefObject*>(pointer)->decreaseReference();
auto rs = pointer;
pointer = nullptr;
return rs;
}
+ /// Get ready for writing (nulls contents)
+ SLANG_FORCE_INLINE T** writeRef() { *this = nullptr; return &pointer; }
+
+ /// Get for read access
+ SLANG_FORCE_INLINE T*const* readRef() const { return &pointer; }
+
private:
T* pointer;
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;
}