Adds pipeline cache and implementation for Vulkan backend.

- Adds testing for Vulkan pipeline caching.
- Removed redundant VK_NULL_HANDLE and use explicit {} initialization for 0 handles when necessary.
- Adds some const qualifiers where applicable and useful.
- Removes overloaded GetCacheKey (const/non-const) versions and exposed the cache key member directly for modifiers in derived classes.

Bug: dawn:549
Change-Id: I5e8ab9716eebc916b813c9d032f8dc1f3f5261bc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86581
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
2022-05-03 00:33:33 +00:00
committed by Dawn LUCI CQ
parent 03ddfbb81f
commit d181a3cf55
28 changed files with 617 additions and 57 deletions

View File

@@ -40,6 +40,7 @@
#include "dawn/native/Instance.h"
#include "dawn/native/InternalPipelineStore.h"
#include "dawn/native/ObjectType_autogen.h"
#include "dawn/native/PipelineCache.h"
#include "dawn/native/QuerySet.h"
#include "dawn/native/Queue.h"
#include "dawn/native/RenderBundleEncoder.h"
@@ -968,6 +969,10 @@ void DeviceBase::UncacheAttachmentState(AttachmentState* obj) {
ASSERT(removedCount == 1);
}
Ref<PipelineCacheBase> DeviceBase::GetOrCreatePipelineCache(const CacheKey& key) {
return GetOrCreatePipelineCacheImpl(key);
}
// Object creation API methods
BindGroupBase* DeviceBase::APICreateBindGroup(const BindGroupDescriptor* descriptor) {
@@ -1377,6 +1382,11 @@ ResultOrError<Ref<CommandEncoder>> DeviceBase::CreateCommandEncoder(
return CommandEncoder::Create(this, descriptor);
}
// Overwritten on the backends to return pipeline caches if supported.
Ref<PipelineCacheBase> DeviceBase::GetOrCreatePipelineCacheImpl(const CacheKey& key) {
UNREACHABLE();
}
MaybeError DeviceBase::CreateComputePipelineAsync(const ComputePipelineDescriptor* descriptor,
WGPUCreateComputePipelineAsyncCallback callback,
void* userdata) {