Use git hash as fingerprint for getting caching interfaces.

- Also changes to use string_view for the constexpr hash.

Bug: dawn:549
Change-Id: I1ded4994d501f0378d3fa8f5c16d07e3c566270f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/92962
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
This commit is contained in:
Loko Kung 2022-06-07 23:31:31 +00:00 committed by Dawn LUCI CQ
parent 84bf4226d8
commit af510d7c6a
2 changed files with 6 additions and 4 deletions

View File

@ -15,9 +15,11 @@
#ifndef COMMON_VERISON_AUTOGEN_H_
#define COMMON_VERISON_AUTOGEN_H_
#include <string_view>
namespace dawn {
static constexpr char kGitHash[] = "{{get_gitHash()}}";
static constexpr std::string_view kGitHash("{{get_gitHash()}}");
} // namespace dawn

View File

@ -20,6 +20,7 @@
#include "dawn/common/GPUInfo.h"
#include "dawn/common/Log.h"
#include "dawn/common/SystemUtils.h"
#include "dawn/common/Version_autogen.h"
#include "dawn/native/ChainUtils_autogen.h"
#include "dawn/native/ErrorData.h"
#include "dawn/native/Surface.h"
@ -94,9 +95,8 @@ BackendsBitset GetEnabledBackends() {
}
dawn::platform::CachingInterface* GetCachingInterface(dawn::platform::Platform* platform) {
if (platform != nullptr) {
return platform->GetCachingInterface(/*fingerprint*/ nullptr,
/*fingerprintSize*/ 0);
if (platform != nullptr && dawn::kGitHash.size() > 0) {
return platform->GetCachingInterface(dawn::kGitHash.data(), dawn::kGitHash.size());
}
return nullptr;
}