Vulkan: fix blob caching of initial pipeline cache

When creating a new pipeline cache and the blob cache doesn't have
a matching one we can load, we unintentionally skipped serializing it to
the blob cache until the pipeline cache state changed later on.

Bug: angleproject:8230
Change-Id: If86d1bd169a63da9f9a394284a754bccb7d52e20
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4639496
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
This commit is contained in:
Steven Noonan
2023-06-23 04:12:09 -07:00
committed by Angle LUCI CQ
parent 0574f0ab5b
commit 131acc3133

View File

@@ -3407,11 +3407,14 @@ angle::Result RendererVk::initializeDevice(DisplayVk *displayVk, uint32_t queueF
mDefaultUniformBufferSize, getPhysicalDeviceProperties().limits.maxUniformBufferRange);
// Initialize the vulkan pipeline cache.
bool success = false;
{
std::unique_lock<std::mutex> lock(mPipelineCacheMutex);
ANGLE_TRY(initPipelineCache(displayVk, &mPipelineCache, &success));
ANGLE_TRY(getPipelineCacheSize(displayVk, &mPipelineCacheSizeAtLastSync));
bool loadedFromBlobCache = false;
ANGLE_TRY(initPipelineCache(displayVk, &mPipelineCache, &loadedFromBlobCache));
if (loadedFromBlobCache)
{
ANGLE_TRY(getPipelineCacheSize(displayVk, &mPipelineCacheSizeAtLastSync));
}
}
// Track the set of supported pipeline stages. This is used when issuing image layout
@@ -4774,17 +4777,18 @@ angle::Result RendererVk::getPipelineCache(vk::PipelineCacheAccess *pipelineCach
{
// We should now recreate the pipeline cache with the blob cache pipeline data.
vk::PipelineCache pCache;
bool success = false;
ANGLE_TRY(initPipelineCache(displayVk, &pCache, &success));
if (success)
bool loadedFromBlobCache = false;
ANGLE_TRY(initPipelineCache(displayVk, &pCache, &loadedFromBlobCache));
if (loadedFromBlobCache)
{
// Merge the newly created pipeline cache into the existing one.
mPipelineCache.merge(mDevice, 1, pCache.ptr());
ANGLE_TRY(getPipelineCacheSize(displayVk, &mPipelineCacheSizeAtLastSync));
}
mPipelineCacheInitialized = true;
pCache.destroy(mDevice);
ANGLE_TRY(getPipelineCacheSize(displayVk, &mPipelineCacheSizeAtLastSync));
}
pipelineCacheOut->init(&mPipelineCache, &mPipelineCacheMutex);