From 05af41d21d74d24871507e6f8f50574ea08c48a2 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Mon, 23 Sep 2019 15:38:25 -0400 Subject: Simple test profiling (#1062) * First pass support for performance profiling * Test across all elements * Fix bug - sourceContents is not used, should use rawSource. * * Add ability to get prelude from API. * Allow specifying source language for render-test * Made it possible to compile a test input file as C++ * Special handling for reflection * Added C++ impl to performance-profile.slang * Remove some clang warnings. * Output profile timings on appveyor and other TC. * Remove passing around of StdWriters (can use global). Small comment improvements. --- source/slang/slang-compiler.cpp | 5 ++--- source/slang/slang-compiler.h | 4 ++++ source/slang/slang.cpp | 10 ++++++++++ 3 files changed, 16 insertions(+), 3 deletions(-) (limited to 'source/slang') 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; -- cgit v1.2.3