From c2dc1a86ed2f5e160749fe9f99b70db6c3e4d7a6 Mon Sep 17 00:00:00 2001 From: skallweitNV <64953474+skallweitNV@users.noreply.github.com> Date: Mon, 12 Dec 2022 19:25:48 +0100 Subject: Refactor shader cache (#2558) * Fix a bug in Path::find * Fix code formatting * Fix LockFile and add LockFileGuard * Add PersistentCache and unit test * Replace file path dependency list with source file dependency list * Add note on ordering in Module/FileDependencyList * Remove old shader cache code * Refactor shader cache implementation * Temporarily skip unit tests reading/writing files * Fix warning * Reenable lock file test * Rename shader cache tests and disable crashing test * Testing * Stop using Path::getCanonical * Fix persistent cache lock and test * Fix threading issues * Move adding file dependency hashes to getEntryPointHash() * Fix handling of #include files * Allow specifying additional search paths for gfx testing device * Work on shader cache tests * Update project files * Revive shader cache graphics tests * Split graphics pipeline test * Fix compilation --- source/slang/slang-preprocessor.cpp | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'source/slang/slang-preprocessor.cpp') diff --git a/source/slang/slang-preprocessor.cpp b/source/slang/slang-preprocessor.cpp index fca8f5029..341e75ea4 100644 --- a/source/slang/slang-preprocessor.cpp +++ b/source/slang/slang-preprocessor.cpp @@ -32,9 +32,9 @@ void PreprocessorHandler::handleEndOfTranslationUnit(Preprocessor* preprocessor) SLANG_UNUSED(preprocessor); } -void PreprocessorHandler::handleFileDependency(String const& path) +void PreprocessorHandler::handleFileDependency(SourceFile* sourceFile) { - SLANG_UNUSED(path); + SLANG_UNUSED(sourceFile); } // In order to simplify the naming scheme, we will nest the implementaiton of the @@ -2966,15 +2966,6 @@ static SlangResult readFile( auto fileSystemExt = context->m_preprocessor->fileSystem; SLANG_RETURN_ON_FAIL(fileSystemExt->loadFile(path.getBuffer(), outBlob)); - // If we are running the preprocessor as part of compiling a - // specific module, then we must keep track of the file we've - // read as yet another file that the module will depend on. - // - if( auto handler = context->m_preprocessor->handler ) - { - handler->handleFileDependency(path); - } - return SLANG_OK; } @@ -3056,10 +3047,18 @@ static void HandleIncludeDirective(PreprocessorDirectiveContext* context) } sourceFile = sourceManager->createSourceFileWithBlob(filePathInfo, foundSourceBlob); - sourceManager->addSourceFile(filePathInfo.uniqueIdentity, sourceFile); } + // If we are running the preprocessor as part of compiling a + // specific module, then we must keep track of the file we've + // read as yet another file that the module will depend on. + // + if (auto handler = context->m_preprocessor->handler) + { + handler->handleFileDependency(sourceFile); + } + // This is a new parse (even if it's a pre-existing source file), so create a new SourceView SourceView* sourceView = sourceManager->createSourceView(sourceFile, &filePathInfo, directiveLoc); -- cgit v1.2.3