Add Instance and CreateInstance to webgpu.h

This is the first step in making the API before WGPUDevice creation
match webgpu.h and is necessary to implement WGPUSwapChain.

BUG=dawn:269

Change-Id: If92ced42d7683d79e67c02738949ff8b483d22c4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14061
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
Corentin Wallez
2020-01-10 13:06:48 +00:00
committed by Commit Bot service account
parent e6441b604f
commit 5fc2c82c11
14 changed files with 97 additions and 17 deletions

View File

@@ -50,6 +50,19 @@ namespace dawn_native {
// InstanceBase
// static
InstanceBase* InstanceBase::Create(const InstanceDescriptor* descriptor) {
Ref<InstanceBase> instance = AcquireRef(new InstanceBase);
if (!instance->Initialize(descriptor)) {
return nullptr;
}
return instance.Detach();
}
bool InstanceBase::Initialize(const InstanceDescriptor*) {
return true;
}
void InstanceBase::DiscoverDefaultAdapters() {
EnsureBackendConnections();