From 6f2ce72b038b34e84819ddfc5d658166ed879eaa Mon Sep 17 00:00:00 2001 From: Yong He Date: Thu, 27 Feb 2025 16:57:52 -0800 Subject: Map `SV_InstanceID` to `gl_InstanceIndex-gl_BaseInstance` (#6468) * Map `SV_InstanceID` to `gl_InstanceIndex-gl_BaseInstance` * Fix ci. --- source/slang/slang-compiler.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'source/slang/slang-compiler.cpp') diff --git a/source/slang/slang-compiler.cpp b/source/slang/slang-compiler.cpp index 04ebb753c..58cc55e71 100644 --- a/source/slang/slang-compiler.cpp +++ b/source/slang/slang-compiler.cpp @@ -16,6 +16,8 @@ #include "slang-check-impl.h" #include "slang-check.h" +#include + // Artifact #include "../compiler-core/slang-artifact-associated.h" #include "../compiler-core/slang-artifact-container-util.h" @@ -1835,6 +1837,26 @@ SlangResult CodeGenContext::_emitEntryPoints(ComPtr& outArtifact) return SLANG_FAIL; } +// Helper class for recording compile time. +struct CompileTimerRAII +{ + std::chrono::high_resolution_clock::time_point startTime; + Session* session; + CompileTimerRAII(Session* inSession) + { + startTime = std::chrono::high_resolution_clock::now(); + session = inSession; + } + ~CompileTimerRAII() + { + double elapsedTime = std::chrono::duration_cast( + std::chrono::high_resolution_clock::now() - startTime) + .count() / + 1e6; + session->addTotalCompileTime(elapsedTime); + } +}; + // Do emit logic for a zero or more entry points SlangResult CodeGenContext::emitEntryPoints(ComPtr& outArtifact) { -- cgit v1.2.3