Handle/log errors when initializing pipeline caches in Vulkan.

Note that we can just log these errors and avoid bubbling them up since
cache creation failure should not be fatal in Vulkan.

Bug: dawn:1336
Change-Id: Ie49d433f9b991508859f4969f2d4bf3b7c9e66d3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/122024
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
Loko Kung 2023-03-02 00:27:50 +00:00 committed by Dawn LUCI CQ
parent 02e456c9fb
commit e11208e9ce
1 changed files with 12 additions and 3 deletions

View File

@ -14,7 +14,8 @@
#include "dawn/native/vulkan/PipelineCacheVk.h"
#include "dawn/common/Assert.h"
#include <memory>
#include "dawn/native/Device.h"
#include "dawn/native/Error.h"
#include "dawn/native/vulkan/DeviceVk.h"
@ -83,9 +84,17 @@ void PipelineCache::Initialize() {
Device* device = ToBackend(GetDevice());
mHandle = VK_NULL_HANDLE;
GetDevice()->ConsumedError(CheckVkSuccess(
// Attempts to create the pipeline cache but does not bubble the error, instead only logging.
// This should be fine because the handle will be left as null and pipeline creation should
// continue as if there was no cache.
MaybeError maybeError = CheckVkSuccess(
device->fn.CreatePipelineCache(device->GetVkDevice(), &createInfo, nullptr, &*mHandle),
"CreatePipelineCache"));
"CreatePipelineCache");
if (maybeError.IsError()) {
std::unique_ptr<ErrorData> error = maybeError.AcquireError();
GetDevice()->EmitLog(WGPULoggingType_Info, error->GetFormattedMessage().c_str());
}
}
} // namespace dawn::native::vulkan