summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/core/slang-process-util.h4
-rw-r--r--source/core/unix/slang-unix-process-util.cpp15
-rw-r--r--source/core/windows/slang-win-process-util.cpp21
-rw-r--r--source/slang/slang-compiler.cpp5
-rw-r--r--source/slang/slang-compiler.h4
-rw-r--r--source/slang/slang.cpp10
6 files changed, 56 insertions, 3 deletions
diff --git a/source/core/slang-process-util.h b/source/core/slang-process-util.h
index 89e3400a0..5d8c358e8 100644
--- a/source/core/slang-process-util.h
+++ b/source/core/slang-process-util.h
@@ -91,6 +91,10 @@ struct ProcessUtil
/// Append text escaped for using on a command line
static void appendCommandLineEscaped(const UnownedStringSlice& slice, StringBuilder& out);
+
+ static uint64_t getClockFrequency();
+
+ static uint64_t getClockTick();
};
// -----------------------------------------------------------------------
diff --git a/source/core/unix/slang-unix-process-util.cpp b/source/core/unix/slang-unix-process-util.cpp
index 400f4f773..ab4366b06 100644
--- a/source/core/unix/slang-unix-process-util.cpp
+++ b/source/core/unix/slang-unix-process-util.cpp
@@ -15,6 +15,8 @@
#include <sys/wait.h>
#include <unistd.h>
+#include <time.h>
+
namespace Slang {
@@ -247,4 +249,17 @@ namespace Slang {
return SLANG_FAIL;
}
+
+/* static */uint64_t ProcessUtil::getClockFrequency()
+{
+ return 1000000000;
+}
+
+/* static */uint64_t ProcessUtil::getClockTick()
+{
+ struct timespec now;
+ clock_gettime(CLOCK_MONOTONIC, &now);
+ return now.tv_sec + now.tv_nsec;
+}
+
} // namespace Slang
diff --git a/source/core/windows/slang-win-process-util.cpp b/source/core/windows/slang-win-process-util.cpp
index ac6468109..3a5a01cb3 100644
--- a/source/core/windows/slang-win-process-util.cpp
+++ b/source/core/windows/slang-win-process-util.cpp
@@ -344,4 +344,25 @@ static DWORD WINAPI _readerThreadProc(LPVOID threadParam)
return SLANG_OK;
}
+static uint64_t _getClockFrequency()
+{
+ LARGE_INTEGER timerFrequency;
+ QueryPerformanceFrequency(&timerFrequency);
+ return timerFrequency.QuadPart;
+}
+
+static const uint64_t g_frequency = _getClockFrequency();
+
+/* static */uint64_t ProcessUtil::getClockFrequency()
+{
+ return g_frequency;
+}
+
+/* static */uint64_t ProcessUtil::getClockTick()
+{
+ LARGE_INTEGER counter;
+ QueryPerformanceCounter(&counter);
+ return counter.QuadPart;
+}
+
}
diff --git a/source/slang/slang-compiler.cpp b/source/slang/slang-compiler.cpp
index ce22186ee..0860a339c 100644
--- a/source/slang/slang-compiler.cpp
+++ b/source/slang/slang-compiler.cpp
@@ -1221,8 +1221,7 @@ SlangResult dissassembleDXILUsingDXC(
bool useOriginalFile = false;
String compileSourcePath;
- String sourceContents;
-
+
String rawSource;
SourceLanguage rawSourceLanguage = SourceLanguage::Unknown;
@@ -1313,7 +1312,7 @@ SlangResult dissassembleDXILUsingDXC(
{
_appendCodeWithPath(sourceFile->getPathInfo().foundPath.getUnownedSlice(), sourceFile->getContent(), codeBuilder);
}
- sourceContents = codeBuilder.ProduceString();
+ rawSource = codeBuilder.ProduceString();
}
}
else
diff --git a/source/slang/slang-compiler.h b/source/slang/slang-compiler.h
index c43af9506..ad90bb5ee 100644
--- a/source/slang/slang-compiler.h
+++ b/source/slang/slang-compiler.h
@@ -1824,6 +1824,10 @@ namespace Slang
SlangPassThrough inPassThrough,
char const* prelude) override;
+ SLANG_NO_THROW void SLANG_MCALL getDownstreamCompilerPrelude(
+ SlangPassThrough inPassThrough,
+ ISlangBlob** outPrelude) override;
+
SLANG_NO_THROW const char* SLANG_MCALL getBuildTagString() override;
enum class SharedLibraryFuncType
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp
index d5adae722..5f22f8a23 100644
--- a/source/slang/slang.cpp
+++ b/source/slang/slang.cpp
@@ -202,6 +202,16 @@ SLANG_NO_THROW void SLANG_MCALL Session::setDownstreamCompilerPrelude(
m_downstreamCompilerPreludes[int(passThrough)] = prelude;
}
+SLANG_NO_THROW void SLANG_MCALL Session::getDownstreamCompilerPrelude(
+ SlangPassThrough inPassThrough,
+ ISlangBlob** outPrelude)
+{
+ PassThroughMode passThrough = PassThroughMode(inPassThrough);
+ SLANG_ASSERT(int(passThrough) > int(PassThroughMode::None) && int(passThrough) < int(PassThroughMode::CountOf));
+
+ *outPrelude = Slang::StringUtil::createStringBlob(m_downstreamCompilerPreludes[int(passThrough)]).detach();
+}
+
SLANG_NO_THROW const char* SLANG_MCALL Session::getBuildTagString()
{
return SLANG_TAG_VERSION;