@@ -33,7 +33,7 @@ class NBL_API2 IShaderCompiler : public core::IReferenceCounted
3333 {
3434 system::path absolutePath = {};
3535 std::string contents = {};
36- std::array< uint8_t , 32 > hash = {}; // TODO: we're not yet using IFile::getPrecomputedHash(), so for builtins we can maybe use that in the future
36+ core:: blake3_hash_t hash = {}; // TODO: we're not yet using IFile::getPrecomputedHash(), so for builtins we can maybe use that in the future
3737 // Could be used in the future for early rejection of cache hit
3838 // nbl::system::IFileBase::time_point_t lastWriteTime = {};
3939
@@ -185,7 +185,6 @@ class NBL_API2 IShaderCompiler : public core::IReferenceCounted
185185 // Used to check compatibility of Caches before reading
186186 constexpr static inline std::string_view VERSION = " 1.0.0" ;
187187
188- using hash_t = std::array<uint8_t ,32 >;
189188 static auto const SHADER_BUFFER_SIZE_BYTES = sizeof (uint64_t ) / sizeof (uint8_t ); // It's obviously 8
190189
191190 struct SEntry
@@ -196,7 +195,7 @@ class NBL_API2 IShaderCompiler : public core::IReferenceCounted
196195 {
197196 public:
198197 // Perf note: hashing while preprocessor lexing is likely to be slower than just hashing the whole array like this
199- inline SPreprocessingDependency (const system::path& _requestingSourceDir, const std::string_view& _identifier, bool _standardInclude, std::array< uint8_t , 32 > _hash) :
198+ inline SPreprocessingDependency (const system::path& _requestingSourceDir, const std::string_view& _identifier, bool _standardInclude, core:: blake3_hash_t _hash) :
200199 requestingSourceDir(_requestingSourceDir), identifier(_identifier), standardInclude(_standardInclude), hash(_hash)
201200 {}
202201
@@ -217,7 +216,7 @@ class NBL_API2 IShaderCompiler : public core::IReferenceCounted
217216 system::path requestingSourceDir = " " ;
218217 std::string identifier = " " ;
219218 // hash of the contents - used to check against a found_t
220- std::array< uint8_t , 32 > hash = {};
219+ core:: blake3_hash_t hash = {};
221220 // If true, then `getIncludeStandard` was used to find, otherwise `getIncludeRelative`
222221 bool standardInclude = false ;
223222 };
@@ -349,11 +348,8 @@ class NBL_API2 IShaderCompiler : public core::IReferenceCounted
349348
350349 core::blake3_hasher hasher;
351350 hasher.update (hashable.data (), hashable.size ());
352- hash = { *static_cast <core::blake3_hash_t >(hasher).data };
353- lookupHash = std::bit_cast<uint64_t , uint8_t [8 ]>({hash[0 ], hash[1 ], hash[2 ], hash[3 ], hash[4 ], hash[5 ], hash[6 ], hash[7 ]});
354- for (auto i = 8u ; i < 32 ; i++) {
355- core::hash_combine<uint64_t >(lookupHash, hash[i]);
356- }
351+ hash = static_cast <core::blake3_hash_t >(hasher);
352+ lookupHash = std::hash<core::blake3_hash_t >{}(hash);
357353 }
358354
359355 // Needed to get the vector deserialization automatically
@@ -372,7 +368,7 @@ class NBL_API2 IShaderCompiler : public core::IReferenceCounted
372368 // TODO: make some of these private
373369 std::string mainFileContents;
374370 SCompilerArgs compilerArgs;
375- std::array< uint8_t , 32 > hash;
371+ core:: blake3_hash_t hash;
376372 size_t lookupHash;
377373 dependency_container_t dependencies;
378374 core::smart_refctd_ptr<asset::ICPUShader> cpuShader;
0 commit comments