From 883d9f7cccf1080739213282602c0dbae5fa7fe6 Mon Sep 17 00:00:00 2001 From: lucy96chen <47800040+lucy96chen@users.noreply.github.com> Date: Sat, 29 Oct 2022 12:08:41 -0700 Subject: Shader cache bugfixes and test additions (#2467) * Preliminary graphics shader test * Added test checking that a graphics shader is correctly split into two different entries * Removed testing only addition * Changed RequirementDictionary to an OrderedDictionary and added SerialTypeInfo for OrderedDictionary; Added entry point mangled name to the dependency hash * Added test covering failure case discovered as part of Falcor integration * Changed DifferentiableTypeSemanticContext::m_mapTypeToIDifferentiableWitness to an OrderedDictionary * Added serializedAST field to Module in order to save serialized ASTs to avoid reserialization as much as possible; Added classes field to Session in order to save the output of SerialClassesUtil::create to avoid recreating as much as possible * Changed AST hashing to hash the contents of a Module's file dependencies; Renamed all references to AST hashing to contents hashing * Further cleanup * Moved contents hash computation up to Linkage::loadModule and added field to Module to save the computed contents digest * Changed PreprocessorHandler::handleFileDependency to optionally take an ISlangBlob* containing file contents and changed FrontEndPreprocessorHandler::handleFileDependency to add the source code for an included file to the module's contents digest * Removed extraneous addToDigest call * Fixed accidental removal of source code hash for module being loaded --- tools/gfx/renderer-shared.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tools/gfx/renderer-shared.cpp') diff --git a/tools/gfx/renderer-shared.cpp b/tools/gfx/renderer-shared.cpp index c7d7933a3..65c625d5d 100644 --- a/tools/gfx/renderer-shared.cpp +++ b/tools/gfx/renderer-shared.cpp @@ -368,13 +368,13 @@ Result RendererBase::getEntryPointCodeFromShaderCache( // Produce a hash using the AST for this program - This is needed to check whether a cache entry is effectively dirty, // or to save along with the compiled code into an entry so the entry can be checked if fetched later on. slang::Digest contentsHash; - program->computeASTBasedHash(&contentsHash); + program->computeContentsBasedHash(&contentsHash); ComPtr codeBlob; - // Query the shader cache index for an entry with shaderKey as its key. + // Query the shader cache index for an entry with shaderKey as its key. auto entry = persistentShaderCache->findEntry(shaderKey, codeBlob.writeRef()); - if (entry && contentsHash == entry->Value.astBasedDigest) + if (entry && contentsHash == entry->Value.contentsBasedDigest) { // We found the entry in the cache, and the entry's contents are up-to-date. Nothing else needs to be done. shaderCacheHitCount++; -- cgit v1.2.3