summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--slang.h12
-rw-r--r--source/core/slang-cpp-compiler.cpp19
-rw-r--r--source/core/slang-cpp-compiler.h20
-rw-r--r--source/core/slang-gcc-compiler-util.cpp38
-rw-r--r--source/core/slang-platform.cpp48
-rw-r--r--source/core/slang-platform.h62
-rw-r--r--source/core/slang-visual-studio-compiler-util.cpp7
-rw-r--r--source/slang/slang-check.cpp44
-rw-r--r--source/slang/slang-compiler.h10
-rw-r--r--source/slang/slang.cpp61
-rw-r--r--tools/slang-test/test-context.cpp4
11 files changed, 295 insertions, 30 deletions
diff --git a/slang.h b/slang.h
index 474ea9916..0df93ece7 100644
--- a/slang.h
+++ b/slang.h
@@ -1072,6 +1072,10 @@ extern "C"
*/
typedef struct SlangCompileRequest SlangCompileRequest;
+ namespace slang {
+ struct IGlobalSession;
+ } // namespace slang
+
/*!
@brief Initialize an instance of the Slang library.
*/
@@ -2642,6 +2646,14 @@ namespace slang
*/
virtual SLANG_NO_THROW SlangProfileID SLANG_MCALL findProfile(
char const* name) = 0;
+
+ /** Set the path that pass through (aka back end compilers) will
+ be looked from. For back ends that are dlls/shared libraries, it will mean the path will
+ be prefixed with the path when calls are made out to ISlangSharedLibraryLoader.
+ For executables - it will look for executables along the path */
+ virtual void SLANG_MCALL setPassThroughPath(
+ SlangPassThrough passThrough,
+ char const* path) = 0;
};
#define SLANG_UUID_IGlobalSession { 0xc140b5fd, 0xc78, 0x452e, { 0xba, 0x7c, 0x1a, 0x1e, 0x70, 0xc7, 0xf7, 0x1c } };
diff --git a/source/core/slang-cpp-compiler.cpp b/source/core/slang-cpp-compiler.cpp
index 7ac4e96b4..153018527 100644
--- a/source/core/slang-cpp-compiler.cpp
+++ b/source/core/slang-cpp-compiler.cpp
@@ -327,10 +327,14 @@ const CPPCompiler::Desc& CPPCompilerUtil::getCompiledWithDesc()
return nullptr;
}
-// Have to do this conditionally because unreferenced static functions are a warning on VC, and warnings are errors.
-#if !SLANG_WINDOWS_FAMILY
-static void _addGCCFamilyCompiler(const String& exeName, CPPCompilerSet* compilerSet)
+static void _addGCCFamilyCompiler(const String& path, const String& inExeName, CPPCompilerSet* compilerSet)
{
+ String exeName(inExeName);
+ if (path.getLength() > 0)
+ {
+ exeName = Path::combine(path, inExeName);
+ }
+
CPPCompiler::Desc desc;
if (SLANG_SUCCEEDED(GCCCompilerUtil::calcVersion(exeName, desc)))
{
@@ -339,7 +343,6 @@ static void _addGCCFamilyCompiler(const String& exeName, CPPCompilerSet* compile
compilerSet->addCompiler(compiler);
}
}
-#endif
/* static */CPPCompiler* CPPCompilerUtil::findClosestCompiler(const CPPCompilerSet* set, const CPPCompiler::Desc& desc)
{
@@ -353,15 +356,15 @@ static void _addGCCFamilyCompiler(const String& exeName, CPPCompilerSet* compile
return findClosestCompiler(compilers, desc);
}
-/* static */SlangResult CPPCompilerUtil::initializeSet(CPPCompilerSet* set)
+/* static */SlangResult CPPCompilerUtil::initializeSet(const InitializeSetDesc& desc, CPPCompilerSet* set)
{
#if SLANG_WINDOWS_FAMILY
WinVisualStudioUtil::find(set);
-#else
- _addGCCFamilyCompiler("clang", set);
- _addGCCFamilyCompiler("g++", set);
#endif
+ _addGCCFamilyCompiler(desc.getPath(CompilerType::Clang), "clang", set);
+ _addGCCFamilyCompiler(desc.getPath(CompilerType::GCC), "g++", set);
+
// Set the default to the compiler closest to how this source was compiled
set->setDefaultCompiler(findClosestCompiler(set, getCompiledWithDesc()));
return SLANG_OK;
diff --git a/source/core/slang-cpp-compiler.h b/source/core/slang-cpp-compiler.h
index 185e960f3..d87ed63dc 100644
--- a/source/core/slang-cpp-compiler.h
+++ b/source/core/slang-cpp-compiler.h
@@ -6,6 +6,8 @@
#include "slang-process-util.h"
+#include "slang-platform.h"
+
namespace Slang
{
@@ -93,6 +95,7 @@ public:
enum Enum : Flags
{
EnableExceptionHandling = 0x01,
+ Verbose = 0x02,
};
};
@@ -104,6 +107,8 @@ public:
Flags flags = Flag::EnableExceptionHandling;
+ PlatformKind platform = PlatformKind::Unknown;
+
String modulePath; ///< The path/name of the output module. Should not have the extension, as that will be added for each of the target types
List<Define> defines;
@@ -171,7 +176,7 @@ public:
struct Output
{
/// Reset to an initial empty state
- void reset() { messages.clear(); result = SLANG_OK; }
+ void reset() { messages.clear(); rawMessages = String(); result = SLANG_OK; }
/// Get the number of messages by type
Index getCountByType(OutputMessage::Type type) const;
@@ -189,6 +194,8 @@ public:
/// Remove all messages of the type
void removeByType(OutputMessage::Type type);
+ String rawMessages;
+
SlangResult result;
List<OutputMessage> messages;
};
@@ -287,6 +294,7 @@ struct CPPCompilerBaseUtil
typedef CPPCompiler::TargetType TargetType;
typedef CPPCompiler::DebugInfoType DebugInfoType;
typedef CPPCompiler::SourceType SourceType;
+ typedef CPPCompiler::CompilerType CompilerType;
typedef CPPCompiler::OutputMessage OutputMessage;
typedef CPPCompiler::FloatingPointMode FloatingPointMode;
@@ -303,6 +311,14 @@ struct CPPCompilerUtil: public CPPCompilerBaseUtil
Newest,
};
+ struct InitializeSetDesc
+ {
+ const String& getPath(CompilerType type) const { return paths[int(type)]; }
+ void setPath(CompilerType type, const String& path) { paths[int(type)] = path; }
+
+ String paths[int(CPPCompiler::CompilerType::CountOf)];
+ };
+
/// Find a compiler
static CPPCompiler* findCompiler(const CPPCompilerSet* set, MatchType matchType, const CPPCompiler::Desc& desc);
static CPPCompiler* findCompiler(const List<CPPCompiler*>& compilers, MatchType matchType, const CPPCompiler::Desc& desc);
@@ -315,7 +331,7 @@ struct CPPCompilerUtil: public CPPCompilerBaseUtil
static const CPPCompiler::Desc& getCompiledWithDesc();
/// Given a set, registers compilers found through standard means and determines a reasonable default compiler if possible
- static SlangResult initializeSet(CPPCompilerSet* set);
+ static SlangResult initializeSet(const InitializeSetDesc& desc, CPPCompilerSet* set);
};
}
diff --git a/source/core/slang-gcc-compiler-util.cpp b/source/core/slang-gcc-compiler-util.cpp
index d42076039..c48e779d1 100644
--- a/source/core/slang-gcc-compiler-util.cpp
+++ b/source/core/slang-gcc-compiler-util.cpp
@@ -279,10 +279,13 @@ static SlangResult _parseGCCFamilyLine(const UnownedStringSlice& line, LineParse
LineParseResult prevLineResult = LineParseResult::Ignore;
outOutput.reset();
+ outOutput.rawMessages = exeRes.standardError;
for (auto line : LineParser(exeRes.standardError.getUnownedSlice()))
{
CPPCompiler::OutputMessage msg;
+ msg.reset();
+
LineParseResult lineRes;
SLANG_RETURN_ON_FAIL(_parseGCCFamilyLine(line, lineRes, msg));
@@ -383,6 +386,8 @@ static SlangResult _parseGCCFamilyLine(const UnownedStringSlice& line, LineParse
/* static */SlangResult GCCCompilerUtil::calcArgs(const CompileOptions& options, CommandLine& cmdLine)
{
+ PlatformKind platformKind = (options.platform == PlatformKind::Unknown) ? PlatformUtil::getPlatformKind() : options.platform;
+
cmdLine.addArg("-fvisibility=hidden");
if (options.sourceType == SourceType::CPP)
@@ -391,9 +396,6 @@ static SlangResult _parseGCCFamilyLine(const UnownedStringSlice& line, LineParse
cmdLine.addArg("-std=c++14");
}
- // Use shared libraries
- //cmdLine.addArg("-shared");
-
switch (options.optimizationLevel)
{
case OptimizationLevel::None:
@@ -425,6 +427,11 @@ static SlangResult _parseGCCFamilyLine(const UnownedStringSlice& line, LineParse
cmdLine.addArg("-g");
}
+ if (options.flags & CompileOptions::Flag::Verbose)
+ {
+ cmdLine.addArg("-v");
+ }
+
switch (options.floatingPointMode)
{
case FloatingPointMode::Default: break;
@@ -454,8 +461,12 @@ static SlangResult _parseGCCFamilyLine(const UnownedStringSlice& line, LineParse
{
// Shared library
cmdLine.addArg("-shared");
- // Position independent
- cmdLine.addArg("-fPIC");
+
+ if (PlatformUtil::isFamily(PlatformFamily::Unix, platformKind))
+ {
+ // Position independent
+ cmdLine.addArg("-fPIC");
+ }
break;
}
case TargetType::Executable:
@@ -500,13 +511,14 @@ static SlangResult _parseGCCFamilyLine(const UnownedStringSlice& line, LineParse
if (options.targetType == TargetType::SharedLibrary)
{
-#if !SLANG_APPLE_FAMILY
- // On MacOS, this linker option is not supported. That's ok though in
- // so far as on MacOS it does report any unfound symbols without the option.
+ if (!PlatformUtil::isFamily(PlatformFamily::Apple, platformKind))
+ {
+ // On MacOS, this linker option is not supported. That's ok though in
+ // so far as on MacOS it does report any unfound symbols without the option.
- // Linker flag to report any undefined symbols as a link error
- cmdLine.addArg("-Wl,--no-undefined");
-#endif
+ // Linker flag to report any undefined symbols as a link error
+ cmdLine.addArg("-Wl,--no-undefined");
+ }
}
// Files to compile
@@ -524,11 +536,11 @@ static SlangResult _parseGCCFamilyLine(const UnownedStringSlice& line, LineParse
cmdLine.addArg(libPath);
}
- if (options.sourceType == SourceType::CPP)
+ if (options.sourceType == SourceType::CPP && !PlatformUtil::isFamily(PlatformFamily::Windows, platformKind))
{
// Make STD libs available
cmdLine.addArg("-lstdc++");
- // Make maths lib available
+ // Make maths lib available
cmdLine.addArg("-lm");
}
diff --git a/source/core/slang-platform.cpp b/source/core/slang-platform.cpp
index 4f4c805ac..e735216f4 100644
--- a/source/core/slang-platform.cpp
+++ b/source/core/slang-platform.cpp
@@ -197,4 +197,52 @@ SLANG_COMPILE_TIME_ASSERT(E_OUTOFMEMORY == SLANG_E_OUT_OF_MEMORY);
#endif // _WIN32
+/* static */PlatformKind PlatformUtil::getPlatformKind()
+{
+#if SLANG_WINRT
+ return PlatformKind::WinRT;
+#elif SLANG_XBOXONE
+ return PlatformKind::XBoxOne;
+#elif SLANG_WIN64
+ return PlatformKind::Win64;
+#elif SLANG_X360
+ return PlatformKind::X360;
+#elif SLANG_WIN32
+ return PlatformKind::Win32;
+#elif SLANG_ANDROID
+ return PlatformKind::Android;
+#elif SLANG_LINUX
+ return PlatformKind::Linux;
+#elif SLANG_IOS
+ return PlatformKind::IOS;
+#elif SLANG_OSX
+ return PlatformKind::OSX;
+#elif SLANG_PS3
+ return PlatformKind::PS3;
+#elif SLANG_SLANG_PS4
+ return PlatformKind::PS4;
+#elif SLANG_PSP2
+ return PlatformKind::PSP2;
+#elif SLANG_WIIU
+ return PlatformKind::WIIU;
+#else
+ return PlatformKind::Unknown;
+#endif
+}
+
+static const PlatformFlags s_familyFlags[int(PlatformFamily::CountOf)] =
+{
+ 0, // Unknown
+ PlatformFlag::WinRT | PlatformFlag::Win32 | PlatformFlag::Win64, // Windows
+ PlatformFlag::WinRT | PlatformFlag::Win32 | PlatformFlag::Win64 | PlatformFlag::X360 | PlatformFlag::XBoxOne, // Microsoft
+ PlatformFlag::Linux | PlatformFlag::Android, // Linux
+ PlatformFlag::IOS | PlatformFlag::OSX, // Apple
+ PlatformFlag::Linux | PlatformFlag::Android | PlatformFlag::IOS | PlatformFlag::OSX, // Unix
+};
+
+/* static */PlatformFlags PlatformUtil::getPlatformFlags(PlatformFamily family)
+{
+ return s_familyFlags[int(family)];
+}
+
}
diff --git a/source/core/slang-platform.h b/source/core/slang-platform.h
index 0e6d12cb6..c3ad1c486 100644
--- a/source/core/slang-platform.h
+++ b/source/core/slang-platform.h
@@ -7,6 +7,58 @@
namespace Slang
{
+ enum class PlatformKind
+ {
+ Unknown,
+ WinRT,
+ XBoxOne,
+ Win64,
+ Win32,
+ X360,
+ Android,
+ Linux,
+ IOS,
+ OSX,
+ PS3,
+ PS4,
+ PSP2,
+ WIIU,
+ CountOf,
+ };
+
+ typedef uint32_t PlatformFlags;
+ struct PlatformFlag
+ {
+ enum Enum
+ {
+ Unknown = 1 << int(PlatformKind::Unknown),
+ WinRT = 1 << int(PlatformKind::WinRT),
+ XBoxOne = 1 << int(PlatformKind::XBoxOne),
+ Win64 = 1 << int(PlatformKind::Win64),
+ Win32 = 1 << int(PlatformKind::Win32),
+ X360 = 1 << int(PlatformKind::X360),
+ Android = 1 << int(PlatformKind::Android),
+ Linux = 1 << int(PlatformKind::Linux),
+ IOS = 1 << int(PlatformKind::IOS),
+ OSX = 1 << int(PlatformKind::OSX),
+ PS3 = 1 << int(PlatformKind::PS3),
+ PS4 = 1 << int(PlatformKind::PS4),
+ PSP2 = 1 << int(PlatformKind::PSP2),
+ WIIU = 1 << int(PlatformKind::WIIU),
+ };
+ };
+
+ enum class PlatformFamily
+ {
+ Unknown,
+ Windows,
+ Microsoft,
+ Linux,
+ Apple,
+ Unix,
+ CountOf,
+ };
+
// Interface for working with shared libraries
// in a platform-independent fashion.
struct SharedLibrary
@@ -66,6 +118,16 @@ namespace Slang
/// @param builderOut Append the string produced to builderOut
/// @return SLANG_OK if string is found and appended. Fail otherwise. SLANG_E_NOT_IMPLEMENTED if there is no impl for this platform.
static SlangResult appendResult(SlangResult res, StringBuilder& builderOut);
+
+ /// Get the platform kind as determined at compile time
+ static PlatformKind getPlatformKind();
+
+ /// Get the platforms that make up a family
+ static PlatformFlags getPlatformFlags(PlatformFamily family);
+
+ /// True if the kind is part of the family
+ static bool isFamily(PlatformFamily family, PlatformKind kind) { return (getPlatformFlags(family) & (PlatformFlags(1) << int(kind))) != 0; }
+
};
#ifndef _MSC_VER
diff --git a/source/core/slang-visual-studio-compiler-util.cpp b/source/core/slang-visual-studio-compiler-util.cpp
index 1c79f9004..4b1e08026 100644
--- a/source/core/slang-visual-studio-compiler-util.cpp
+++ b/source/core/slang-visual-studio-compiler-util.cpp
@@ -90,6 +90,11 @@ namespace Slang
}
}
+ if (options.flags & CompileOptions::Flag::Verbose)
+ {
+ // Doesn't appear to be a VS equivalent
+ }
+
switch (options.debugInfoType)
{
default:
@@ -378,6 +383,8 @@ static SlangResult _parseVisualStudioLine(const UnownedStringSlice& line, CPPCom
{
outOutput.reset();
+ outOutput.rawMessages = exeRes.standardOutput;
+
for (auto line : LineParser(exeRes.standardOutput.getUnownedSlice()))
{
#if 0
diff --git a/source/slang/slang-check.cpp b/source/slang/slang-check.cpp
index b7c1ccdc2..9a4a01045 100644
--- a/source/slang/slang-check.cpp
+++ b/source/slang/slang-check.cpp
@@ -5,6 +5,9 @@
#include "slang-visitor.h"
#include "../core/slang-secure-crt.h"
+
+#include "../core/slang-io.h"
+
#include <assert.h>
namespace Slang
@@ -323,6 +326,28 @@ namespace Slang
}
}
+ static PassThroughMode _toPassThroughMode(SharedLibraryType type)
+ {
+ switch (type)
+ {
+ case SharedLibraryType::Dxil:
+ case SharedLibraryType::Dxc:
+ {
+ return PassThroughMode::Dxc;
+ }
+ case SharedLibraryType::Fxc: return PassThroughMode::Fxc;
+ case SharedLibraryType::Glslang: return PassThroughMode::Glslang;
+ default: break;
+ }
+
+ return PassThroughMode::None;
+ }
+
+ void Session::setSharedLibrary(SharedLibraryType type, ISlangSharedLibrary* library)
+ {
+ sharedLibraries[int(type)] = library;
+ }
+
ISlangSharedLibrary* Session::getOrLoadSharedLibrary(SharedLibraryType type, DiagnosticSink* sink)
{
// If not loaded, try loading it
@@ -336,6 +361,15 @@ namespace Slang
}
const char* libName = DefaultSharedLibraryLoader::getSharedLibraryNameFromType(type);
+
+ StringBuilder builder;
+ PassThroughMode passThrough = _toPassThroughMode(type);
+ if (passThrough != PassThroughMode::None && m_passThroughPaths[int(passThrough)].getLength() > 0)
+ {
+ Path::combineIntoBuilder(m_passThroughPaths[int(passThrough)].getUnownedSlice(), UnownedStringSlice(libName), builder);
+ libName = builder.getBuffer();
+ }
+
if (SLANG_FAILED(sharedLibraryLoader->loadSharedLibrary(libName, sharedLibraries[int(type)].writeRef())))
{
if (sink)
@@ -386,7 +420,15 @@ namespace Slang
if (cppCompilerSet == nullptr)
{
cppCompilerSet = new CPPCompilerSet;
- CPPCompilerUtil::initializeSet(cppCompilerSet);
+
+ typedef CPPCompiler::CompilerType CompilerType;
+ CPPCompilerUtil::InitializeSetDesc desc;
+
+ desc.paths[int(CompilerType::GCC)] = m_passThroughPaths[int(PassThroughMode::Gcc)];
+ desc.paths[int(CompilerType::Clang)] = m_passThroughPaths[int(PassThroughMode::Clang)];
+ desc.paths[int(CompilerType::VisualStudio)] = m_passThroughPaths[int(PassThroughMode::VisualStudio)];
+
+ CPPCompilerUtil::initializeSet(desc, cppCompilerSet);
}
SLANG_ASSERT(cppCompilerSet);
return cppCompilerSet;
diff --git a/source/slang/slang-compiler.h b/source/slang/slang-compiler.h
index bbc6505b0..ce01e5ea3 100644
--- a/source/slang/slang-compiler.h
+++ b/source/slang/slang-compiler.h
@@ -762,9 +762,10 @@ namespace Slang
Dxc = SLANG_PASS_THROUGH_DXC, ///< pass through HLSL to `IDxcCompiler` API
Glslang = SLANG_PASS_THROUGH_GLSLANG, ///< pass through GLSL to `glslang` library
Clang = SLANG_PASS_THROUGH_CLANG, ///< Pass through clang compiler
- Gcc = SLANG_PASS_THROUGH_GCC, ///< Gcc compiler
VisualStudio = SLANG_PASS_THROUGH_VISUAL_STUDIO, ///< Visual studio compiler
+ Gcc = SLANG_PASS_THROUGH_GCC, ///< Gcc compiler
GenericCCpp = SLANG_PASS_THROUGH_GENERIC_C_CPP, ///< Generic C/C++ compiler
+ CountOf = SLANG_PASS_THROUGH_COUNT_OF,
};
class SourceFile;
@@ -1790,6 +1791,9 @@ namespace Slang
SLANG_NO_THROW SlangProfileID SLANG_MCALL findProfile(
char const* name) override;
+ SLANG_NO_THROW void SLANG_MCALL setPassThroughPath(
+ SlangPassThrough passThrough,
+ char const* path) override;
enum class SharedLibraryFuncType
@@ -1916,6 +1920,8 @@ namespace Slang
/// Will try to load the library by specified name (using the set loader), if not one already available.
ISlangSharedLibrary* getOrLoadSharedLibrary(SharedLibraryType type, DiagnosticSink* sink);
+ /// Will unload the specified shared library if it's currently loaded
+ void setSharedLibrary(SharedLibraryType type, ISlangSharedLibrary* library);
/// Gets a shared library by type, or null if not loaded
ISlangSharedLibrary* getSharedLibrary(SharedLibraryType type) const { return sharedLibraries[int(type)]; }
@@ -1936,6 +1942,8 @@ namespace Slang
private:
/// Linkage used for all built-in (stdlib) code.
RefPtr<Linkage> m_builtinLinkage;
+
+ String m_passThroughPaths[int(PassThroughMode::CountOf)]; ///< Paths for each pass through
};
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp
index bb7e705e6..f0570132f 100644
--- a/source/slang/slang.cpp
+++ b/source/slang/slang.cpp
@@ -146,6 +146,51 @@ SLANG_NO_THROW SlangProfileID SLANG_MCALL Session::findProfile(
return Slang::Profile::LookUp(name).raw;
}
+SLANG_NO_THROW void SLANG_MCALL Session::setPassThroughPath(
+ SlangPassThrough inPassThrough,
+ char const* path)
+{
+ PassThroughMode passThrough = PassThroughMode(inPassThrough);
+ SLANG_ASSERT(int(passThrough) > int(PassThroughMode::None) && int(passThrough) < int(PassThroughMode::CountOf));
+
+ if (m_passThroughPaths[int(passThrough)] != path)
+ {
+ // If it's changed we should unload any shared libraries that use it
+ switch (passThrough)
+ {
+ case PassThroughMode::Dxc:
+ {
+ setSharedLibrary(SharedLibraryType::Dxc, nullptr);
+ setSharedLibrary(SharedLibraryType::Dxil, nullptr);
+ break;
+ }
+ case PassThroughMode::Fxc:
+ {
+ setSharedLibrary(SharedLibraryType::Fxc, nullptr);
+ break;
+ }
+ case PassThroughMode::Glslang:
+ {
+ setSharedLibrary(SharedLibraryType::Glslang, nullptr);
+ break;
+ }
+ case PassThroughMode::VisualStudio:
+ case PassThroughMode::Gcc:
+ case PassThroughMode::Clang:
+ case PassThroughMode::GenericCCpp:
+ {
+ // If any compiler path set changed, require all to be refreshed
+ cppCompilerSet.setNull();
+ break;
+ }
+ default: break;
+ }
+
+ // Set the path
+ m_passThroughPaths[int(passThrough)] = path;
+ }
+}
+
struct IncludeHandlerImpl : IncludeHandler
{
Linkage* linkage;
@@ -2446,7 +2491,9 @@ Session::~Session()
SLANG_API SlangSession* spCreateSession(const char*)
{
- return asExternal(new Slang::Session());
+ Slang::RefPtr<Slang::Session> session(new Slang::Session());
+ // Will be returned with a refcount of 1
+ return asExternal(session.detach());
}
SLANG_API SlangResult slang_createGlobalSession(
@@ -2463,10 +2510,16 @@ SLANG_API SlangResult slang_createGlobalSession(
}
SLANG_API void spDestroySession(
- SlangSession* session)
+ SlangSession* inSession)
{
- if(!session) return;
- delete Slang::asInternal(session);
+ if(!inSession) return;
+
+ Slang::Session* session = Slang::asInternal(inSession);
+ // It is assumed there is only a single reference on the session (the one placed
+ // with spCreateSession) if this function is called
+ SLANG_ASSERT(session->debugGetReferenceCount() == 1);
+ // Release
+ session->release();
}
SLANG_API void spAddBuiltins(
diff --git a/tools/slang-test/test-context.cpp b/tools/slang-test/test-context.cpp
index 85e0a121b..5581ab6db 100644
--- a/tools/slang-test/test-context.cpp
+++ b/tools/slang-test/test-context.cpp
@@ -96,7 +96,9 @@ CPPCompilerSet* TestContext::getCPPCompilerSet()
if (!cppCompilerSet)
{
cppCompilerSet = new CPPCompilerSet;
- CPPCompilerUtil::initializeSet(cppCompilerSet);
+
+ CPPCompilerUtil::InitializeSetDesc desc;
+ CPPCompilerUtil::initializeSet(desc, cppCompilerSet);
}
return cppCompilerSet;
}