Rename CreateReady*Pipeline to Create*PipelineAsync
This follows the name change in the upstream WebGPU specification.
Bug: dawn:529
Change-Id: I6d940dcc89f6b75136c642b578cb01bb8e40d681
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/41720
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
diff --git a/dawn.json b/dawn.json
index afee3f3..d81172e 100644
--- a/dawn.json
+++ b/dawn.json
@@ -597,16 +597,16 @@
{"name": "flipY", "type": "bool", "default": "false"}
]
},
- "create ready compute pipeline callback": {
+ "create compute pipeline async callback": {
"category": "callback",
"args": [
- {"name": "status", "type": "create ready pipeline status"},
+ {"name": "status", "type": "create pipeline async status"},
{"name": "pipeline", "type": "compute pipeline"},
{"name": "message", "type": "char", "annotation": "const*", "length": "strlen"},
{"name": "userdata", "type": "void", "annotation": "*"}
]
},
- "create ready pipeline status": {
+ "create pipeline async status": {
"category": "enum",
"values": [
{"value": 0, "name": "success"},
@@ -616,10 +616,10 @@
{"value": 4, "name": "unknown"}
]
},
- "create ready render pipeline callback": {
+ "create render pipeline async callback": {
"category": "callback",
"args": [
- {"name": "status", "type": "create ready pipeline status"},
+ {"name": "status", "type": "create pipeline async status"},
{"name": "pipeline", "type": "render pipeline"},
{"name": "message", "type": "char", "annotation": "const*", "length": "strlen"},
{"name": "userdata", "type": "void", "annotation": "*"}
@@ -677,11 +677,11 @@
]
},
{
- "name": "create ready compute pipeline",
+ "name": "create compute pipeline async",
"returns": "void",
"args": [
{"name": "descriptor", "type": "compute pipeline descriptor", "annotation": "const*"},
- {"name": "callback", "type": "create ready compute pipeline callback"},
+ {"name": "callback", "type": "create compute pipeline async callback"},
{"name": "userdata", "type": "void", "annotation": "*"}
]
},
@@ -700,11 +700,11 @@
]
},
{
- "name": "create ready render pipeline",
+ "name": "create render pipeline async",
"returns": "void",
"args": [
{"name": "descriptor", "type": "render pipeline descriptor", "annotation": "const*"},
- {"name": "callback", "type": "create ready render pipeline callback"},
+ {"name": "callback", "type": "create render pipeline async callback"},
{"name": "userdata", "type": "void", "annotation": "*"}
]
},
diff --git a/dawn_wire.json b/dawn_wire.json
index 4294ed4..98b4596 100644
--- a/dawn_wire.json
+++ b/dawn_wire.json
@@ -36,13 +36,13 @@
{ "name": "handle create info length", "type": "uint64_t" },
{ "name": "handle create info", "type": "uint8_t", "annotation": "const*", "length": "handle create info length", "skip_serialize": true}
],
- "device create ready compute pipeline": [
+ "device create compute pipeline async": [
{ "name": "device id", "type": "ObjectId" },
{ "name": "request serial", "type": "uint64_t" },
{ "name": "pipeline object handle", "type": "ObjectHandle", "handle_type": "compute pipeline"},
{ "name": "descriptor", "type": "compute pipeline descriptor", "annotation": "const*"}
],
- "device create ready render pipeline": [
+ "device create render pipeline async": [
{ "name": "device id", "type": "ObjectId" },
{ "name": "request serial", "type": "uint64_t" },
{ "name": "pipeline object handle", "type": "ObjectHandle", "handle_type": "render pipeline"},
@@ -85,16 +85,16 @@
{ "name": "read initial data info length", "type": "uint64_t" },
{ "name": "read initial data info", "type": "uint8_t", "annotation": "const*", "length": "read initial data info length", "skip_serialize": true }
],
- "device create ready compute pipeline callback": [
+ "device create compute pipeline async callback": [
{ "name": "device", "type": "ObjectHandle", "handle_type": "device" },
{ "name": "request serial", "type": "uint64_t" },
- { "name": "status", "type": "create ready pipeline status" },
+ { "name": "status", "type": "create pipeline async status" },
{ "name": "message", "type": "char", "annotation": "const*", "length": "strlen" }
],
- "device create ready render pipeline callback": [
+ "device create render pipeline async callback": [
{ "name": "device", "type": "ObjectHandle", "handle_type": "device" },
{ "name": "request serial", "type": "uint64_t" },
- { "name": "status", "type": "create ready pipeline status" },
+ { "name": "status", "type": "create pipeline async status" },
{ "name": "message", "type": "char", "annotation": "const*", "length": "strlen" }
],
"device uncaptured error callback": [
@@ -133,8 +133,8 @@
"BufferGetConstMappedRange",
"BufferGetMappedRange",
"DeviceCreateBuffer",
- "DeviceCreateReadyComputePipeline",
- "DeviceCreateReadyRenderPipeline",
+ "DeviceCreateComputePipelineAsync",
+ "DeviceCreateRenderPipelineAsync",
"DevicePopErrorScope",
"DeviceSetDeviceLostCallback",
"DeviceSetUncapturedErrorCallback",
diff --git a/src/dawn_native/BUILD.gn b/src/dawn_native/BUILD.gn
index 77afa36..b708e66 100644
--- a/src/dawn_native/BUILD.gn
+++ b/src/dawn_native/BUILD.gn
@@ -199,8 +199,8 @@
"ComputePipeline.h",
"CopyTextureForBrowserHelper.cpp",
"CopyTextureForBrowserHelper.h",
- "CreateReadyPipelineTracker.cpp",
- "CreateReadyPipelineTracker.h",
+ "CreatePipelineAsyncTracker.cpp",
+ "CreatePipelineAsyncTracker.h",
"Device.cpp",
"Device.h",
"DynamicUploader.cpp",
diff --git a/src/dawn_native/CMakeLists.txt b/src/dawn_native/CMakeLists.txt
index 91c474c..ea3684e 100644
--- a/src/dawn_native/CMakeLists.txt
+++ b/src/dawn_native/CMakeLists.txt
@@ -72,8 +72,8 @@
"ComputePipeline.h"
"CopyTextureForBrowserHelper.cpp"
"CopyTextureForBrowserHelper.h"
- "CreateReadyPipelineTracker.cpp"
- "CreateReadyPipelineTracker.h"
+ "CreatePipelineAsyncTracker.cpp"
+ "CreatePipelineAsyncTracker.h"
"Device.cpp"
"Device.h"
"DynamicUploader.cpp"
diff --git a/src/dawn_native/CreatePipelineAsyncTracker.cpp b/src/dawn_native/CreatePipelineAsyncTracker.cpp
new file mode 100644
index 0000000..7239774
--- /dev/null
+++ b/src/dawn_native/CreatePipelineAsyncTracker.cpp
@@ -0,0 +1,114 @@
+// Copyright 2020 The Dawn Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "dawn_native/CreatePipelineAsyncTracker.h"
+
+#include "dawn_native/ComputePipeline.h"
+#include "dawn_native/Device.h"
+#include "dawn_native/RenderPipeline.h"
+
+namespace dawn_native {
+
+ CreatePipelineAsyncTaskBase::CreatePipelineAsyncTaskBase(void* userdata) : mUserData(userdata) {
+ }
+
+ CreatePipelineAsyncTaskBase::~CreatePipelineAsyncTaskBase() {
+ }
+
+ CreateComputePipelineAsyncTask::CreateComputePipelineAsyncTask(
+ ComputePipelineBase* pipeline,
+ WGPUCreateComputePipelineAsyncCallback callback,
+ void* userdata)
+ : CreatePipelineAsyncTaskBase(userdata),
+ mPipeline(pipeline),
+ mCreateComputePipelineAsyncCallback(callback) {
+ }
+
+ void CreateComputePipelineAsyncTask::Finish(WGPUCreatePipelineAsyncStatus status) {
+ ASSERT(mPipeline != nullptr);
+ ASSERT(mCreateComputePipelineAsyncCallback != nullptr);
+
+ if (status != WGPUCreatePipelineAsyncStatus_Success) {
+ // TODO(jiawei.shao@intel.com): support handling device lost
+ ASSERT(status == WGPUCreatePipelineAsyncStatus_DeviceDestroyed);
+ mCreateComputePipelineAsyncCallback(WGPUCreatePipelineAsyncStatus_DeviceDestroyed,
+ nullptr, "Device destroyed before callback",
+ mUserData);
+ mPipeline->Release();
+ } else {
+ mCreateComputePipelineAsyncCallback(
+ status, reinterpret_cast<WGPUComputePipeline>(mPipeline), "", mUserData);
+ }
+
+ // Set mCreateComputePipelineAsyncCallback to nullptr in case it is called more than once.
+ mCreateComputePipelineAsyncCallback = nullptr;
+ }
+
+ CreateRenderPipelineAsyncTask::CreateRenderPipelineAsyncTask(
+ RenderPipelineBase* pipeline,
+ WGPUCreateRenderPipelineAsyncCallback callback,
+ void* userdata)
+ : CreatePipelineAsyncTaskBase(userdata),
+ mPipeline(pipeline),
+ mCreateRenderPipelineAsyncCallback(callback) {
+ }
+
+ void CreateRenderPipelineAsyncTask::Finish(WGPUCreatePipelineAsyncStatus status) {
+ ASSERT(mPipeline != nullptr);
+ ASSERT(mCreateRenderPipelineAsyncCallback != nullptr);
+
+ if (status != WGPUCreatePipelineAsyncStatus_Success) {
+ // TODO(jiawei.shao@intel.com): support handling device lost
+ ASSERT(status == WGPUCreatePipelineAsyncStatus_DeviceDestroyed);
+ mCreateRenderPipelineAsyncCallback(WGPUCreatePipelineAsyncStatus_DeviceDestroyed,
+ nullptr, "Device destroyed before callback",
+ mUserData);
+ mPipeline->Release();
+ } else {
+ mCreateRenderPipelineAsyncCallback(
+ status, reinterpret_cast<WGPURenderPipeline>(mPipeline), "", mUserData);
+ }
+
+ // Set mCreatePipelineAsyncCallback to nullptr in case it is called more than once.
+ mCreateRenderPipelineAsyncCallback = nullptr;
+ }
+
+ CreatePipelineAsyncTracker::CreatePipelineAsyncTracker(DeviceBase* device) : mDevice(device) {
+ }
+
+ CreatePipelineAsyncTracker::~CreatePipelineAsyncTracker() {
+ ASSERT(mCreatePipelineAsyncTasksInFlight.Empty());
+ }
+
+ void CreatePipelineAsyncTracker::TrackTask(std::unique_ptr<CreatePipelineAsyncTaskBase> task,
+ ExecutionSerial serial) {
+ mCreatePipelineAsyncTasksInFlight.Enqueue(std::move(task), serial);
+ mDevice->AddFutureSerial(serial);
+ }
+
+ void CreatePipelineAsyncTracker::Tick(ExecutionSerial finishedSerial) {
+ for (auto& task : mCreatePipelineAsyncTasksInFlight.IterateUpTo(finishedSerial)) {
+ task->Finish(WGPUCreatePipelineAsyncStatus_Success);
+ }
+ mCreatePipelineAsyncTasksInFlight.ClearUpTo(finishedSerial);
+ }
+
+ void CreatePipelineAsyncTracker::ClearForShutDown() {
+ for (auto& task : mCreatePipelineAsyncTasksInFlight.IterateAll()) {
+ task->Finish(WGPUCreatePipelineAsyncStatus_DeviceDestroyed);
+ }
+ mCreatePipelineAsyncTasksInFlight.Clear();
+ }
+
+} // namespace dawn_native
diff --git a/src/dawn_native/CreatePipelineAsyncTracker.h b/src/dawn_native/CreatePipelineAsyncTracker.h
new file mode 100644
index 0000000..73e366c
--- /dev/null
+++ b/src/dawn_native/CreatePipelineAsyncTracker.h
@@ -0,0 +1,82 @@
+// Copyright 2020 The Dawn Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef DAWNNATIVE_CREATEPIPELINEASYNCTRACKER_H_
+#define DAWNNATIVE_CREATEPIPELINEASYNCTRACKER_H_
+
+#include "common/SerialQueue.h"
+#include "dawn/webgpu.h"
+#include "dawn_native/IntegerTypes.h"
+
+#include <memory>
+
+namespace dawn_native {
+
+ class ComputePipelineBase;
+ class DeviceBase;
+ class PipelineBase;
+ class RenderPipelineBase;
+
+ struct CreatePipelineAsyncTaskBase {
+ CreatePipelineAsyncTaskBase(void* userData);
+ virtual ~CreatePipelineAsyncTaskBase();
+
+ virtual void Finish(WGPUCreatePipelineAsyncStatus status) = 0;
+
+ protected:
+ void* mUserData;
+ };
+
+ struct CreateComputePipelineAsyncTask final : public CreatePipelineAsyncTaskBase {
+ CreateComputePipelineAsyncTask(ComputePipelineBase* pipeline,
+ WGPUCreateComputePipelineAsyncCallback callback,
+ void* userdata);
+
+ void Finish(WGPUCreatePipelineAsyncStatus status) final;
+
+ private:
+ ComputePipelineBase* mPipeline;
+ WGPUCreateComputePipelineAsyncCallback mCreateComputePipelineAsyncCallback;
+ };
+
+ struct CreateRenderPipelineAsyncTask final : public CreatePipelineAsyncTaskBase {
+ CreateRenderPipelineAsyncTask(RenderPipelineBase* pipeline,
+ WGPUCreateRenderPipelineAsyncCallback callback,
+ void* userdata);
+
+ void Finish(WGPUCreatePipelineAsyncStatus status) final;
+
+ private:
+ RenderPipelineBase* mPipeline;
+ WGPUCreateRenderPipelineAsyncCallback mCreateRenderPipelineAsyncCallback;
+ };
+
+ class CreatePipelineAsyncTracker {
+ public:
+ CreatePipelineAsyncTracker(DeviceBase* device);
+ ~CreatePipelineAsyncTracker();
+
+ void TrackTask(std::unique_ptr<CreatePipelineAsyncTaskBase> task, ExecutionSerial serial);
+ void Tick(ExecutionSerial finishedSerial);
+ void ClearForShutDown();
+
+ private:
+ DeviceBase* mDevice;
+ SerialQueue<ExecutionSerial, std::unique_ptr<CreatePipelineAsyncTaskBase>>
+ mCreatePipelineAsyncTasksInFlight;
+ };
+
+} // namespace dawn_native
+
+#endif // DAWNNATIVE_CREATEPIPELINEASYNCTRACKER_H_
diff --git a/src/dawn_native/CreateReadyPipelineTracker.cpp b/src/dawn_native/CreateReadyPipelineTracker.cpp
deleted file mode 100644
index be64393..0000000
--- a/src/dawn_native/CreateReadyPipelineTracker.cpp
+++ /dev/null
@@ -1,114 +0,0 @@
-// Copyright 2020 The Dawn Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "dawn_native/CreateReadyPipelineTracker.h"
-
-#include "dawn_native/ComputePipeline.h"
-#include "dawn_native/Device.h"
-#include "dawn_native/RenderPipeline.h"
-
-namespace dawn_native {
-
- CreateReadyPipelineTaskBase::CreateReadyPipelineTaskBase(void* userdata) : mUserData(userdata) {
- }
-
- CreateReadyPipelineTaskBase::~CreateReadyPipelineTaskBase() {
- }
-
- CreateReadyComputePipelineTask::CreateReadyComputePipelineTask(
- ComputePipelineBase* pipeline,
- WGPUCreateReadyComputePipelineCallback callback,
- void* userdata)
- : CreateReadyPipelineTaskBase(userdata),
- mPipeline(pipeline),
- mCreateReadyComputePipelineCallback(callback) {
- }
-
- void CreateReadyComputePipelineTask::Finish(WGPUCreateReadyPipelineStatus status) {
- ASSERT(mPipeline != nullptr);
- ASSERT(mCreateReadyComputePipelineCallback != nullptr);
-
- if (status != WGPUCreateReadyPipelineStatus_Success) {
- // TODO(jiawei.shao@intel.com): support handling device lost
- ASSERT(status == WGPUCreateReadyPipelineStatus_DeviceDestroyed);
- mCreateReadyComputePipelineCallback(WGPUCreateReadyPipelineStatus_DeviceDestroyed,
- nullptr, "Device destroyed before callback",
- mUserData);
- mPipeline->Release();
- } else {
- mCreateReadyComputePipelineCallback(
- status, reinterpret_cast<WGPUComputePipeline>(mPipeline), "", mUserData);
- }
-
- // Set mCreateReadyComputePipelineCallback to nullptr in case it is called more than once.
- mCreateReadyComputePipelineCallback = nullptr;
- }
-
- CreateReadyRenderPipelineTask::CreateReadyRenderPipelineTask(
- RenderPipelineBase* pipeline,
- WGPUCreateReadyRenderPipelineCallback callback,
- void* userdata)
- : CreateReadyPipelineTaskBase(userdata),
- mPipeline(pipeline),
- mCreateReadyRenderPipelineCallback(callback) {
- }
-
- void CreateReadyRenderPipelineTask::Finish(WGPUCreateReadyPipelineStatus status) {
- ASSERT(mPipeline != nullptr);
- ASSERT(mCreateReadyRenderPipelineCallback != nullptr);
-
- if (status != WGPUCreateReadyPipelineStatus_Success) {
- // TODO(jiawei.shao@intel.com): support handling device lost
- ASSERT(status == WGPUCreateReadyPipelineStatus_DeviceDestroyed);
- mCreateReadyRenderPipelineCallback(WGPUCreateReadyPipelineStatus_DeviceDestroyed,
- nullptr, "Device destroyed before callback",
- mUserData);
- mPipeline->Release();
- } else {
- mCreateReadyRenderPipelineCallback(
- status, reinterpret_cast<WGPURenderPipeline>(mPipeline), "", mUserData);
- }
-
- // Set mCreateReadyPipelineCallback to nullptr in case it is called more than once.
- mCreateReadyRenderPipelineCallback = nullptr;
- }
-
- CreateReadyPipelineTracker::CreateReadyPipelineTracker(DeviceBase* device) : mDevice(device) {
- }
-
- CreateReadyPipelineTracker::~CreateReadyPipelineTracker() {
- ASSERT(mCreateReadyPipelineTasksInFlight.Empty());
- }
-
- void CreateReadyPipelineTracker::TrackTask(std::unique_ptr<CreateReadyPipelineTaskBase> task,
- ExecutionSerial serial) {
- mCreateReadyPipelineTasksInFlight.Enqueue(std::move(task), serial);
- mDevice->AddFutureSerial(serial);
- }
-
- void CreateReadyPipelineTracker::Tick(ExecutionSerial finishedSerial) {
- for (auto& task : mCreateReadyPipelineTasksInFlight.IterateUpTo(finishedSerial)) {
- task->Finish(WGPUCreateReadyPipelineStatus_Success);
- }
- mCreateReadyPipelineTasksInFlight.ClearUpTo(finishedSerial);
- }
-
- void CreateReadyPipelineTracker::ClearForShutDown() {
- for (auto& task : mCreateReadyPipelineTasksInFlight.IterateAll()) {
- task->Finish(WGPUCreateReadyPipelineStatus_DeviceDestroyed);
- }
- mCreateReadyPipelineTasksInFlight.Clear();
- }
-
-} // namespace dawn_native
diff --git a/src/dawn_native/CreateReadyPipelineTracker.h b/src/dawn_native/CreateReadyPipelineTracker.h
deleted file mode 100644
index b1eed08..0000000
--- a/src/dawn_native/CreateReadyPipelineTracker.h
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright 2020 The Dawn Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef DAWNNATIVE_CREATEREADYPIPELINETRACKER_H_
-#define DAWNNATIVE_CREATEREADYPIPELINETRACKER_H_
-
-#include "common/SerialQueue.h"
-#include "dawn/webgpu.h"
-#include "dawn_native/IntegerTypes.h"
-
-#include <memory>
-
-namespace dawn_native {
-
- class ComputePipelineBase;
- class DeviceBase;
- class PipelineBase;
- class RenderPipelineBase;
-
- struct CreateReadyPipelineTaskBase {
- CreateReadyPipelineTaskBase(void* userData);
- virtual ~CreateReadyPipelineTaskBase();
-
- virtual void Finish(WGPUCreateReadyPipelineStatus status) = 0;
-
- protected:
- void* mUserData;
- };
-
- struct CreateReadyComputePipelineTask final : public CreateReadyPipelineTaskBase {
- CreateReadyComputePipelineTask(ComputePipelineBase* pipeline,
- WGPUCreateReadyComputePipelineCallback callback,
- void* userdata);
-
- void Finish(WGPUCreateReadyPipelineStatus status) final;
-
- private:
- ComputePipelineBase* mPipeline;
- WGPUCreateReadyComputePipelineCallback mCreateReadyComputePipelineCallback;
- };
-
- struct CreateReadyRenderPipelineTask final : public CreateReadyPipelineTaskBase {
- CreateReadyRenderPipelineTask(RenderPipelineBase* pipeline,
- WGPUCreateReadyRenderPipelineCallback callback,
- void* userdata);
-
- void Finish(WGPUCreateReadyPipelineStatus status) final;
-
- private:
- RenderPipelineBase* mPipeline;
- WGPUCreateReadyRenderPipelineCallback mCreateReadyRenderPipelineCallback;
- };
-
- class CreateReadyPipelineTracker {
- public:
- CreateReadyPipelineTracker(DeviceBase* device);
- ~CreateReadyPipelineTracker();
-
- void TrackTask(std::unique_ptr<CreateReadyPipelineTaskBase> task, ExecutionSerial serial);
- void Tick(ExecutionSerial finishedSerial);
- void ClearForShutDown();
-
- private:
- DeviceBase* mDevice;
- SerialQueue<ExecutionSerial, std::unique_ptr<CreateReadyPipelineTaskBase>>
- mCreateReadyPipelineTasksInFlight;
- };
-
-} // namespace dawn_native
-
-#endif
diff --git a/src/dawn_native/Device.cpp b/src/dawn_native/Device.cpp
index d2fdd97..7e33e3f 100644
--- a/src/dawn_native/Device.cpp
+++ b/src/dawn_native/Device.cpp
@@ -23,7 +23,7 @@
#include "dawn_native/CommandBuffer.h"
#include "dawn_native/CommandEncoder.h"
#include "dawn_native/ComputePipeline.h"
-#include "dawn_native/CreateReadyPipelineTracker.h"
+#include "dawn_native/CreatePipelineAsyncTracker.h"
#include "dawn_native/DynamicUploader.h"
#include "dawn_native/ErrorData.h"
#include "dawn_native/ErrorScope.h"
@@ -123,7 +123,7 @@
mCaches = std::make_unique<DeviceBase::Caches>();
mErrorScopeStack = std::make_unique<ErrorScopeStack>();
mDynamicUploader = std::make_unique<DynamicUploader>(this);
- mCreateReadyPipelineTracker = std::make_unique<CreateReadyPipelineTracker>(this);
+ mCreatePipelineAsyncTracker = std::make_unique<CreatePipelineAsyncTracker>(this);
mDeprecationWarnings = std::make_unique<DeprecationWarnings>();
mInternalPipelineStore = std::make_unique<InternalPipelineStore>();
mPersistentCache = std::make_unique<PersistentCache>(this);
@@ -141,7 +141,7 @@
// Skip handling device facilities if they haven't even been created (or failed doing so)
if (mState != State::BeingCreated) {
// Reject all async pipeline creations.
- mCreateReadyPipelineTracker->ClearForShutDown();
+ mCreatePipelineAsyncTracker->ClearForShutDown();
}
// Disconnect the device, depending on which state we are currently in.
@@ -186,7 +186,7 @@
mState = State::Disconnected;
mDynamicUploader = nullptr;
- mCreateReadyPipelineTracker = nullptr;
+ mCreatePipelineAsyncTracker = nullptr;
mPersistentCache = nullptr;
mEmptyBindGroupLayout = nullptr;
@@ -705,21 +705,21 @@
return result;
}
- void DeviceBase::CreateReadyComputePipeline(const ComputePipelineDescriptor* descriptor,
- WGPUCreateReadyComputePipelineCallback callback,
+ void DeviceBase::CreateComputePipelineAsync(const ComputePipelineDescriptor* descriptor,
+ WGPUCreateComputePipelineAsyncCallback callback,
void* userdata) {
ComputePipelineBase* result = nullptr;
MaybeError maybeError = CreateComputePipelineInternal(&result, descriptor);
if (maybeError.IsError()) {
std::unique_ptr<ErrorData> error = maybeError.AcquireError();
- callback(WGPUCreateReadyPipelineStatus_Error, nullptr, error->GetMessage().c_str(),
+ callback(WGPUCreatePipelineAsyncStatus_Error, nullptr, error->GetMessage().c_str(),
userdata);
return;
}
- std::unique_ptr<CreateReadyComputePipelineTask> request =
- std::make_unique<CreateReadyComputePipelineTask>(result, callback, userdata);
- mCreateReadyPipelineTracker->TrackTask(std::move(request), GetPendingCommandSerial());
+ std::unique_ptr<CreateComputePipelineAsyncTask> request =
+ std::make_unique<CreateComputePipelineAsyncTask>(result, callback, userdata);
+ mCreatePipelineAsyncTracker->TrackTask(std::move(request), GetPendingCommandSerial());
}
PipelineLayoutBase* DeviceBase::CreatePipelineLayout(
const PipelineLayoutDescriptor* descriptor) {
@@ -749,21 +749,21 @@
return result;
}
- void DeviceBase::CreateReadyRenderPipeline(const RenderPipelineDescriptor* descriptor,
- WGPUCreateReadyRenderPipelineCallback callback,
+ void DeviceBase::CreateRenderPipelineAsync(const RenderPipelineDescriptor* descriptor,
+ WGPUCreateRenderPipelineAsyncCallback callback,
void* userdata) {
RenderPipelineBase* result = nullptr;
MaybeError maybeError = CreateRenderPipelineInternal(&result, descriptor);
if (maybeError.IsError()) {
std::unique_ptr<ErrorData> error = maybeError.AcquireError();
- callback(WGPUCreateReadyPipelineStatus_Error, nullptr, error->GetMessage().c_str(),
+ callback(WGPUCreatePipelineAsyncStatus_Error, nullptr, error->GetMessage().c_str(),
userdata);
return;
}
- std::unique_ptr<CreateReadyRenderPipelineTask> request =
- std::make_unique<CreateReadyRenderPipelineTask>(result, callback, userdata);
- mCreateReadyPipelineTracker->TrackTask(std::move(request), GetPendingCommandSerial());
+ std::unique_ptr<CreateRenderPipelineAsyncTask> request =
+ std::make_unique<CreateRenderPipelineAsyncTask>(result, callback, userdata);
+ mCreatePipelineAsyncTracker->TrackTask(std::move(request), GetPendingCommandSerial());
}
RenderBundleEncoder* DeviceBase::CreateRenderBundleEncoder(
const RenderBundleEncoderDescriptor* descriptor) {
@@ -862,7 +862,7 @@
mDynamicUploader->Deallocate(mCompletedSerial);
GetQueue()->Tick(mCompletedSerial);
- mCreateReadyPipelineTracker->Tick(mCompletedSerial);
+ mCreatePipelineAsyncTracker->Tick(mCompletedSerial);
}
return !IsDeviceIdle();
diff --git a/src/dawn_native/Device.h b/src/dawn_native/Device.h
index 3a830d9..7764ec6 100644
--- a/src/dawn_native/Device.h
+++ b/src/dawn_native/Device.h
@@ -33,7 +33,7 @@
class AttachmentState;
class AttachmentStateBlueprint;
class BindGroupLayoutBase;
- class CreateReadyPipelineTracker;
+ class CreatePipelineAsyncTracker;
class DynamicUploader;
class ErrorScopeStack;
class PersistentCache;
@@ -146,11 +146,11 @@
ComputePipelineBase* CreateComputePipeline(const ComputePipelineDescriptor* descriptor);
PipelineLayoutBase* CreatePipelineLayout(const PipelineLayoutDescriptor* descriptor);
QuerySetBase* CreateQuerySet(const QuerySetDescriptor* descriptor);
- void CreateReadyComputePipeline(const ComputePipelineDescriptor* descriptor,
- WGPUCreateReadyComputePipelineCallback callback,
+ void CreateComputePipelineAsync(const ComputePipelineDescriptor* descriptor,
+ WGPUCreateComputePipelineAsyncCallback callback,
void* userdata);
- void CreateReadyRenderPipeline(const RenderPipelineDescriptor* descriptor,
- WGPUCreateReadyRenderPipelineCallback callback,
+ void CreateRenderPipelineAsync(const RenderPipelineDescriptor* descriptor,
+ WGPUCreateRenderPipelineAsyncCallback callback,
void* userdata);
RenderBundleEncoder* CreateRenderBundleEncoder(
const RenderBundleEncoderDescriptor* descriptor);
@@ -381,7 +381,7 @@
Ref<BindGroupLayoutBase> mEmptyBindGroupLayout;
std::unique_ptr<DynamicUploader> mDynamicUploader;
- std::unique_ptr<CreateReadyPipelineTracker> mCreateReadyPipelineTracker;
+ std::unique_ptr<CreatePipelineAsyncTracker> mCreatePipelineAsyncTracker;
Ref<QueueBase> mQueue;
struct DeprecationWarnings;
diff --git a/src/dawn_wire/client/ClientDoers.cpp b/src/dawn_wire/client/ClientDoers.cpp
index d86d13e..a5ef7f6 100644
--- a/src/dawn_wire/client/ClientDoers.cpp
+++ b/src/dawn_wire/client/ClientDoers.cpp
@@ -93,26 +93,26 @@
return true;
}
- bool Client::DoDeviceCreateReadyComputePipelineCallback(Device* device,
+ bool Client::DoDeviceCreateComputePipelineAsyncCallback(Device* device,
uint64_t requestSerial,
- WGPUCreateReadyPipelineStatus status,
+ WGPUCreatePipelineAsyncStatus status,
const char* message) {
// The device might have been deleted or recreated so this isn't an error.
if (device == nullptr) {
return true;
}
- return device->OnCreateReadyComputePipelineCallback(requestSerial, status, message);
+ return device->OnCreateComputePipelineAsyncCallback(requestSerial, status, message);
}
- bool Client::DoDeviceCreateReadyRenderPipelineCallback(Device* device,
+ bool Client::DoDeviceCreateRenderPipelineAsyncCallback(Device* device,
uint64_t requestSerial,
- WGPUCreateReadyPipelineStatus status,
+ WGPUCreatePipelineAsyncStatus status,
const char* message) {
// The device might have been deleted or recreated so this isn't an error.
if (device == nullptr) {
return true;
}
- return device->OnCreateReadyRenderPipelineCallback(requestSerial, status, message);
+ return device->OnCreateRenderPipelineAsyncCallback(requestSerial, status, message);
}
}} // namespace dawn_wire::client
diff --git a/src/dawn_wire/client/Device.cpp b/src/dawn_wire/client/Device.cpp
index cbd661d..3a9189e 100644
--- a/src/dawn_wire/client/Device.cpp
+++ b/src/dawn_wire/client/Device.cpp
@@ -55,16 +55,16 @@
it.second.userdata);
}
- auto createReadyPipelineRequests = std::move(mCreateReadyPipelineRequests);
- for (const auto& it : createReadyPipelineRequests) {
- if (it.second.createReadyComputePipelineCallback != nullptr) {
- it.second.createReadyComputePipelineCallback(
- WGPUCreateReadyPipelineStatus_DeviceDestroyed, nullptr,
+ auto createPipelineAsyncRequests = std::move(mCreatePipelineAsyncRequests);
+ for (const auto& it : createPipelineAsyncRequests) {
+ if (it.second.createComputePipelineAsyncCallback != nullptr) {
+ it.second.createComputePipelineAsyncCallback(
+ WGPUCreatePipelineAsyncStatus_DeviceDestroyed, nullptr,
"Device destroyed before callback", it.second.userdata);
} else {
- ASSERT(it.second.createReadyRenderPipelineCallback != nullptr);
- it.second.createReadyRenderPipelineCallback(
- WGPUCreateReadyPipelineStatus_DeviceDestroyed, nullptr,
+ ASSERT(it.second.createRenderPipelineAsyncCallback != nullptr);
+ it.second.createRenderPipelineAsyncCallback(
+ WGPUCreatePipelineAsyncStatus_DeviceDestroyed, nullptr,
"Device destroyed before callback", it.second.userdata);
}
}
@@ -84,20 +84,20 @@
}
void Device::CancelCallbacksForDisconnect() {
- for (auto& it : mCreateReadyPipelineRequests) {
- ASSERT((it.second.createReadyComputePipelineCallback != nullptr) ^
- (it.second.createReadyRenderPipelineCallback != nullptr));
- if (it.second.createReadyRenderPipelineCallback) {
- it.second.createReadyRenderPipelineCallback(
- WGPUCreateReadyPipelineStatus_DeviceLost, nullptr, "Device lost",
+ for (auto& it : mCreatePipelineAsyncRequests) {
+ ASSERT((it.second.createComputePipelineAsyncCallback != nullptr) ^
+ (it.second.createRenderPipelineAsyncCallback != nullptr));
+ if (it.second.createRenderPipelineAsyncCallback) {
+ it.second.createRenderPipelineAsyncCallback(
+ WGPUCreatePipelineAsyncStatus_DeviceLost, nullptr, "Device lost",
it.second.userdata);
} else {
- it.second.createReadyComputePipelineCallback(
- WGPUCreateReadyPipelineStatus_DeviceLost, nullptr, "Device lost",
+ it.second.createComputePipelineAsyncCallback(
+ WGPUCreatePipelineAsyncStatus_DeviceLost, nullptr, "Device lost",
it.second.userdata);
}
}
- mCreateReadyPipelineRequests.clear();
+ mCreatePipelineAsyncRequests.clear();
for (auto& it : mErrorScopes) {
it.second.callback(WGPUErrorType_DeviceLost, "Device lost", it.second.userdata);
@@ -221,113 +221,113 @@
return GetQueue();
}
- void Device::CreateReadyComputePipeline(WGPUComputePipelineDescriptor const* descriptor,
- WGPUCreateReadyComputePipelineCallback callback,
+ void Device::CreateComputePipelineAsync(WGPUComputePipelineDescriptor const* descriptor,
+ WGPUCreateComputePipelineAsyncCallback callback,
void* userdata) {
if (client->IsDisconnected()) {
- return callback(WGPUCreateReadyPipelineStatus_DeviceLost, nullptr,
+ return callback(WGPUCreatePipelineAsyncStatus_DeviceLost, nullptr,
"GPU device disconnected", userdata);
}
- DeviceCreateReadyComputePipelineCmd cmd;
+ DeviceCreateComputePipelineAsyncCmd cmd;
cmd.deviceId = this->id;
cmd.descriptor = descriptor;
- uint64_t serial = mCreateReadyPipelineRequestSerial++;
- ASSERT(mCreateReadyPipelineRequests.find(serial) == mCreateReadyPipelineRequests.end());
+ uint64_t serial = mCreatePipelineAsyncRequestSerial++;
+ ASSERT(mCreatePipelineAsyncRequests.find(serial) == mCreatePipelineAsyncRequests.end());
cmd.requestSerial = serial;
auto* allocation = client->ComputePipelineAllocator().New(client);
- CreateReadyPipelineRequest request = {};
- request.createReadyComputePipelineCallback = callback;
+ CreatePipelineAsyncRequest request = {};
+ request.createComputePipelineAsyncCallback = callback;
request.userdata = userdata;
request.pipelineObjectID = allocation->object->id;
cmd.pipelineObjectHandle = ObjectHandle{allocation->object->id, allocation->generation};
client->SerializeCommand(cmd);
- mCreateReadyPipelineRequests[serial] = std::move(request);
+ mCreatePipelineAsyncRequests[serial] = std::move(request);
}
- bool Device::OnCreateReadyComputePipelineCallback(uint64_t requestSerial,
- WGPUCreateReadyPipelineStatus status,
+ bool Device::OnCreateComputePipelineAsyncCallback(uint64_t requestSerial,
+ WGPUCreatePipelineAsyncStatus status,
const char* message) {
- const auto& requestIt = mCreateReadyPipelineRequests.find(requestSerial);
- if (requestIt == mCreateReadyPipelineRequests.end()) {
+ const auto& requestIt = mCreatePipelineAsyncRequests.find(requestSerial);
+ if (requestIt == mCreatePipelineAsyncRequests.end()) {
return false;
}
- CreateReadyPipelineRequest request = std::move(requestIt->second);
- mCreateReadyPipelineRequests.erase(requestIt);
+ CreatePipelineAsyncRequest request = std::move(requestIt->second);
+ mCreatePipelineAsyncRequests.erase(requestIt);
auto pipelineAllocation =
client->ComputePipelineAllocator().GetObject(request.pipelineObjectID);
// If the return status is a failure we should give a null pipeline to the callback and
// free the allocation both on the client side and the server side.
- if (status != WGPUCreateReadyPipelineStatus_Success) {
+ if (status != WGPUCreatePipelineAsyncStatus_Success) {
client->ComputePipelineAllocator().Free(pipelineAllocation);
- request.createReadyComputePipelineCallback(status, nullptr, message, request.userdata);
+ request.createComputePipelineAsyncCallback(status, nullptr, message, request.userdata);
return true;
}
WGPUComputePipeline pipeline = reinterpret_cast<WGPUComputePipeline>(pipelineAllocation);
- request.createReadyComputePipelineCallback(status, pipeline, message, request.userdata);
+ request.createComputePipelineAsyncCallback(status, pipeline, message, request.userdata);
return true;
}
- void Device::CreateReadyRenderPipeline(WGPURenderPipelineDescriptor const* descriptor,
- WGPUCreateReadyRenderPipelineCallback callback,
+ void Device::CreateRenderPipelineAsync(WGPURenderPipelineDescriptor const* descriptor,
+ WGPUCreateRenderPipelineAsyncCallback callback,
void* userdata) {
if (client->IsDisconnected()) {
- return callback(WGPUCreateReadyPipelineStatus_DeviceLost, nullptr,
+ return callback(WGPUCreatePipelineAsyncStatus_DeviceLost, nullptr,
"GPU device disconnected", userdata);
}
- DeviceCreateReadyRenderPipelineCmd cmd;
+ DeviceCreateRenderPipelineAsyncCmd cmd;
cmd.deviceId = this->id;
cmd.descriptor = descriptor;
- uint64_t serial = mCreateReadyPipelineRequestSerial++;
- ASSERT(mCreateReadyPipelineRequests.find(serial) == mCreateReadyPipelineRequests.end());
+ uint64_t serial = mCreatePipelineAsyncRequestSerial++;
+ ASSERT(mCreatePipelineAsyncRequests.find(serial) == mCreatePipelineAsyncRequests.end());
cmd.requestSerial = serial;
auto* allocation = client->RenderPipelineAllocator().New(client);
- CreateReadyPipelineRequest request = {};
- request.createReadyRenderPipelineCallback = callback;
+ CreatePipelineAsyncRequest request = {};
+ request.createRenderPipelineAsyncCallback = callback;
request.userdata = userdata;
request.pipelineObjectID = allocation->object->id;
cmd.pipelineObjectHandle = ObjectHandle(allocation->object->id, allocation->generation);
client->SerializeCommand(cmd);
- mCreateReadyPipelineRequests[serial] = std::move(request);
+ mCreatePipelineAsyncRequests[serial] = std::move(request);
}
- bool Device::OnCreateReadyRenderPipelineCallback(uint64_t requestSerial,
- WGPUCreateReadyPipelineStatus status,
+ bool Device::OnCreateRenderPipelineAsyncCallback(uint64_t requestSerial,
+ WGPUCreatePipelineAsyncStatus status,
const char* message) {
- const auto& requestIt = mCreateReadyPipelineRequests.find(requestSerial);
- if (requestIt == mCreateReadyPipelineRequests.end()) {
+ const auto& requestIt = mCreatePipelineAsyncRequests.find(requestSerial);
+ if (requestIt == mCreatePipelineAsyncRequests.end()) {
return false;
}
- CreateReadyPipelineRequest request = std::move(requestIt->second);
- mCreateReadyPipelineRequests.erase(requestIt);
+ CreatePipelineAsyncRequest request = std::move(requestIt->second);
+ mCreatePipelineAsyncRequests.erase(requestIt);
auto pipelineAllocation =
client->RenderPipelineAllocator().GetObject(request.pipelineObjectID);
// If the return status is a failure we should give a null pipeline to the callback and
// free the allocation both on the client side and the server side.
- if (status != WGPUCreateReadyPipelineStatus_Success) {
+ if (status != WGPUCreatePipelineAsyncStatus_Success) {
client->RenderPipelineAllocator().Free(pipelineAllocation);
- request.createReadyRenderPipelineCallback(status, nullptr, message, request.userdata);
+ request.createRenderPipelineAsyncCallback(status, nullptr, message, request.userdata);
return true;
}
WGPURenderPipeline pipeline = reinterpret_cast<WGPURenderPipeline>(pipelineAllocation);
- request.createReadyRenderPipelineCallback(status, pipeline, message, request.userdata);
+ request.createRenderPipelineAsyncCallback(status, pipeline, message, request.userdata);
return true;
}
diff --git a/src/dawn_wire/client/Device.h b/src/dawn_wire/client/Device.h
index 6e86dbe..c72200b 100644
--- a/src/dawn_wire/client/Device.h
+++ b/src/dawn_wire/client/Device.h
@@ -42,11 +42,11 @@
bool PopErrorScope(WGPUErrorCallback callback, void* userdata);
WGPUBuffer CreateBuffer(const WGPUBufferDescriptor* descriptor);
WGPUBuffer CreateErrorBuffer();
- void CreateReadyComputePipeline(WGPUComputePipelineDescriptor const* descriptor,
- WGPUCreateReadyComputePipelineCallback callback,
+ void CreateComputePipelineAsync(WGPUComputePipelineDescriptor const* descriptor,
+ WGPUCreateComputePipelineAsyncCallback callback,
void* userdata);
- void CreateReadyRenderPipeline(WGPURenderPipelineDescriptor const* descriptor,
- WGPUCreateReadyRenderPipelineCallback callback,
+ void CreateRenderPipelineAsync(WGPURenderPipelineDescriptor const* descriptor,
+ WGPUCreateRenderPipelineAsyncCallback callback,
void* userdata);
void HandleError(WGPUErrorType errorType, const char* message);
@@ -54,11 +54,11 @@
bool OnPopErrorScopeCallback(uint64_t requestSerial,
WGPUErrorType type,
const char* message);
- bool OnCreateReadyComputePipelineCallback(uint64_t requestSerial,
- WGPUCreateReadyPipelineStatus status,
+ bool OnCreateComputePipelineAsyncCallback(uint64_t requestSerial,
+ WGPUCreatePipelineAsyncStatus status,
const char* message);
- bool OnCreateReadyRenderPipelineCallback(uint64_t requestSerial,
- WGPUCreateReadyPipelineStatus status,
+ bool OnCreateRenderPipelineAsyncCallback(uint64_t requestSerial,
+ WGPUCreatePipelineAsyncStatus status,
const char* message);
// TODO(dawn:22): Remove once the deprecation period is finished.
@@ -78,14 +78,14 @@
uint64_t mErrorScopeRequestSerial = 0;
uint64_t mErrorScopeStackSize = 0;
- struct CreateReadyPipelineRequest {
- WGPUCreateReadyComputePipelineCallback createReadyComputePipelineCallback = nullptr;
- WGPUCreateReadyRenderPipelineCallback createReadyRenderPipelineCallback = nullptr;
+ struct CreatePipelineAsyncRequest {
+ WGPUCreateComputePipelineAsyncCallback createComputePipelineAsyncCallback = nullptr;
+ WGPUCreateRenderPipelineAsyncCallback createRenderPipelineAsyncCallback = nullptr;
void* userdata = nullptr;
ObjectId pipelineObjectID;
};
- std::map<uint64_t, CreateReadyPipelineRequest> mCreateReadyPipelineRequests;
- uint64_t mCreateReadyPipelineRequestSerial = 0;
+ std::map<uint64_t, CreatePipelineAsyncRequest> mCreatePipelineAsyncRequests;
+ uint64_t mCreatePipelineAsyncRequestSerial = 0;
WGPUErrorCallback mErrorCallback = nullptr;
WGPUDeviceLostCallback mDeviceLostCallback = nullptr;
diff --git a/src/dawn_wire/server/Server.h b/src/dawn_wire/server/Server.h
index 90d29c4..bcedeaa 100644
--- a/src/dawn_wire/server/Server.h
+++ b/src/dawn_wire/server/Server.h
@@ -141,7 +141,7 @@
uint64_t requestSerial;
};
- struct CreateReadyPipelineUserData : CallbackUserdata {
+ struct CreatePipelineAsyncUserData : CallbackUserdata {
using CallbackUserdata::CallbackUserdata;
ObjectHandle device;
@@ -202,14 +202,14 @@
FenceCompletionUserdata* userdata);
void OnFenceOnCompletion(WGPUFenceCompletionStatus status,
FenceOnCompletionUserdata* userdata);
- void OnCreateReadyComputePipelineCallback(WGPUCreateReadyPipelineStatus status,
+ void OnCreateComputePipelineAsyncCallback(WGPUCreatePipelineAsyncStatus status,
WGPUComputePipeline pipeline,
const char* message,
- CreateReadyPipelineUserData* userdata);
- void OnCreateReadyRenderPipelineCallback(WGPUCreateReadyPipelineStatus status,
+ CreatePipelineAsyncUserData* userdata);
+ void OnCreateRenderPipelineAsyncCallback(WGPUCreatePipelineAsyncStatus status,
WGPURenderPipeline pipeline,
const char* message,
- CreateReadyPipelineUserData* userdata);
+ CreatePipelineAsyncUserData* userdata);
#include "dawn_wire/server/ServerPrototypes_autogen.inc"
diff --git a/src/dawn_wire/server/ServerDevice.cpp b/src/dawn_wire/server/ServerDevice.cpp
index bcc8db6..19e6298 100644
--- a/src/dawn_wire/server/ServerDevice.cpp
+++ b/src/dawn_wire/server/ServerDevice.cpp
@@ -19,10 +19,10 @@
namespace {
template <ObjectType objectType, typename Pipeline>
- void HandleCreateReadyRenderPipelineCallbackResult(KnownObjects<Pipeline>* knownObjects,
- WGPUCreateReadyPipelineStatus status,
+ void HandleCreateRenderPipelineAsyncCallbackResult(KnownObjects<Pipeline>* knownObjects,
+ WGPUCreatePipelineAsyncStatus status,
Pipeline pipeline,
- CreateReadyPipelineUserData* data) {
+ CreatePipelineAsyncUserData* data) {
// May be null if the device was destroyed. Device destruction destroys child
// objects on the wire.
auto* pipelineObject =
@@ -31,7 +31,7 @@
// they move from Reserved to Allocated, or if they are destroyed here.
ASSERT(pipelineObject != nullptr);
- if (status == WGPUCreateReadyPipelineStatus_Success) {
+ if (status == WGPUCreatePipelineAsyncStatus_Success) {
// Assign the handle and allocated status if the pipeline is created successfully.
pipelineObject->state = AllocationState::Allocated;
pipelineObject->handle = pipeline;
@@ -101,7 +101,7 @@
SerializeCommand(cmd);
}
- bool Server::DoDeviceCreateReadyComputePipeline(
+ bool Server::DoDeviceCreateComputePipelineAsync(
ObjectId deviceId,
uint64_t requestSerial,
ObjectHandle pipelineObjectHandle,
@@ -120,27 +120,27 @@
resultData->generation = pipelineObjectHandle.generation;
resultData->deviceInfo = device->info.get();
- auto userdata = MakeUserdata<CreateReadyPipelineUserData>();
+ auto userdata = MakeUserdata<CreatePipelineAsyncUserData>();
userdata->device = ObjectHandle{deviceId, device->generation};
userdata->requestSerial = requestSerial;
userdata->pipelineObjectID = pipelineObjectHandle.id;
- mProcs.deviceCreateReadyComputePipeline(
+ mProcs.deviceCreateComputePipelineAsync(
device->handle, descriptor,
- ForwardToServer<decltype(&Server::OnCreateReadyComputePipelineCallback)>::Func<
- &Server::OnCreateReadyComputePipelineCallback>(),
+ ForwardToServer<decltype(&Server::OnCreateComputePipelineAsyncCallback)>::Func<
+ &Server::OnCreateComputePipelineAsyncCallback>(),
userdata.release());
return true;
}
- void Server::OnCreateReadyComputePipelineCallback(WGPUCreateReadyPipelineStatus status,
+ void Server::OnCreateComputePipelineAsyncCallback(WGPUCreatePipelineAsyncStatus status,
WGPUComputePipeline pipeline,
const char* message,
- CreateReadyPipelineUserData* data) {
- HandleCreateReadyRenderPipelineCallbackResult<ObjectType::ComputePipeline>(
+ CreatePipelineAsyncUserData* data) {
+ HandleCreateRenderPipelineAsyncCallbackResult<ObjectType::ComputePipeline>(
&ComputePipelineObjects(), status, pipeline, data);
- ReturnDeviceCreateReadyComputePipelineCallbackCmd cmd;
+ ReturnDeviceCreateComputePipelineAsyncCallbackCmd cmd;
cmd.device = data->device;
cmd.status = status;
cmd.requestSerial = data->requestSerial;
@@ -149,7 +149,7 @@
SerializeCommand(cmd);
}
- bool Server::DoDeviceCreateReadyRenderPipeline(ObjectId deviceId,
+ bool Server::DoDeviceCreateRenderPipelineAsync(ObjectId deviceId,
uint64_t requestSerial,
ObjectHandle pipelineObjectHandle,
const WGPURenderPipelineDescriptor* descriptor) {
@@ -167,27 +167,27 @@
resultData->generation = pipelineObjectHandle.generation;
resultData->deviceInfo = device->info.get();
- auto userdata = MakeUserdata<CreateReadyPipelineUserData>();
+ auto userdata = MakeUserdata<CreatePipelineAsyncUserData>();
userdata->device = ObjectHandle{deviceId, device->generation};
userdata->requestSerial = requestSerial;
userdata->pipelineObjectID = pipelineObjectHandle.id;
- mProcs.deviceCreateReadyRenderPipeline(
+ mProcs.deviceCreateRenderPipelineAsync(
device->handle, descriptor,
- ForwardToServer<decltype(&Server::OnCreateReadyRenderPipelineCallback)>::Func<
- &Server::OnCreateReadyRenderPipelineCallback>(),
+ ForwardToServer<decltype(&Server::OnCreateRenderPipelineAsyncCallback)>::Func<
+ &Server::OnCreateRenderPipelineAsyncCallback>(),
userdata.release());
return true;
}
- void Server::OnCreateReadyRenderPipelineCallback(WGPUCreateReadyPipelineStatus status,
+ void Server::OnCreateRenderPipelineAsyncCallback(WGPUCreatePipelineAsyncStatus status,
WGPURenderPipeline pipeline,
const char* message,
- CreateReadyPipelineUserData* data) {
- HandleCreateReadyRenderPipelineCallbackResult<ObjectType::RenderPipeline>(
+ CreatePipelineAsyncUserData* data) {
+ HandleCreateRenderPipelineAsyncCallbackResult<ObjectType::RenderPipeline>(
&RenderPipelineObjects(), status, pipeline, data);
- ReturnDeviceCreateReadyRenderPipelineCallbackCmd cmd;
+ ReturnDeviceCreateRenderPipelineAsyncCallbackCmd cmd;
cmd.device = data->device;
cmd.status = status;
cmd.requestSerial = data->requestSerial;
diff --git a/src/tests/BUILD.gn b/src/tests/BUILD.gn
index efc2aee..0c3ffc3 100644
--- a/src/tests/BUILD.gn
+++ b/src/tests/BUILD.gn
@@ -221,7 +221,7 @@
"unittests/wire/WireArgumentTests.cpp",
"unittests/wire/WireBasicTests.cpp",
"unittests/wire/WireBufferMappingTests.cpp",
- "unittests/wire/WireCreateReadyPipelineTests.cpp",
+ "unittests/wire/WireCreatePipelineAsyncTests.cpp",
"unittests/wire/WireDestroyObjectTests.cpp",
"unittests/wire/WireDisconnectTests.cpp",
"unittests/wire/WireErrorCallbackTests.cpp",
@@ -283,7 +283,7 @@
"end2end/ComputeStorageBufferBarrierTests.cpp",
"end2end/CopyTests.cpp",
"end2end/CopyTextureForBrowserTests.cpp",
- "end2end/CreateReadyPipelineTests.cpp",
+ "end2end/CreatePipelineAsyncTests.cpp",
"end2end/CullingTests.cpp",
"end2end/DebugMarkerTests.cpp",
"end2end/DeprecatedAPITests.cpp",
diff --git a/src/tests/end2end/CreateReadyPipelineTests.cpp b/src/tests/end2end/CreatePipelineAsyncTests.cpp
similarity index 77%
rename from src/tests/end2end/CreateReadyPipelineTests.cpp
rename to src/tests/end2end/CreatePipelineAsyncTests.cpp
index a10d208..ef6307c 100644
--- a/src/tests/end2end/CreateReadyPipelineTests.cpp
+++ b/src/tests/end2end/CreatePipelineAsyncTests.cpp
@@ -18,7 +18,7 @@
#include "utils/WGPUHelpers.h"
namespace {
- struct CreateReadyPipelineTask {
+ struct CreatePipelineAsyncTask {
wgpu::ComputePipeline computePipeline = nullptr;
wgpu::RenderPipeline renderPipeline = nullptr;
bool isCompleted = false;
@@ -26,13 +26,13 @@
};
} // anonymous namespace
-class CreateReadyPipelineTest : public DawnTest {
+class CreatePipelineAsyncTest : public DawnTest {
protected:
- CreateReadyPipelineTask task;
+ CreatePipelineAsyncTask task;
};
-// Verify the basic use of CreateReadyComputePipeline works on all backends.
-TEST_P(CreateReadyPipelineTest, BasicUseOfCreateReadyComputePipeline) {
+// Verify the basic use of CreateComputePipelineAsync works on all backends.
+TEST_P(CreatePipelineAsyncTest, BasicUseOfCreateComputePipelineAsync) {
wgpu::ComputePipelineDescriptor csDesc;
csDesc.computeStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct SSBO {
@@ -45,13 +45,13 @@
})");
csDesc.computeStage.entryPoint = "main";
- device.CreateReadyComputePipeline(
+ device.CreateComputePipelineAsync(
&csDesc,
- [](WGPUCreateReadyPipelineStatus status, WGPUComputePipeline returnPipeline,
+ [](WGPUCreatePipelineAsyncStatus status, WGPUComputePipeline returnPipeline,
const char* message, void* userdata) {
- EXPECT_EQ(WGPUCreateReadyPipelineStatus::WGPUCreateReadyPipelineStatus_Success, status);
+ EXPECT_EQ(WGPUCreatePipelineAsyncStatus::WGPUCreatePipelineAsyncStatus_Success, status);
- CreateReadyPipelineTask* task = static_cast<CreateReadyPipelineTask*>(userdata);
+ CreatePipelineAsyncTask* task = static_cast<CreatePipelineAsyncTask*>(userdata);
task->computePipeline = wgpu::ComputePipeline::Acquire(returnPipeline);
task->isCompleted = true;
task->message = message;
@@ -93,11 +93,11 @@
EXPECT_BUFFER_U32_EQ(kExpected, ssbo, 0);
}
-// Verify CreateReadyComputePipeline() works as expected when there is any error that happens during
+// Verify CreateComputePipelineAsync() works as expected when there is any error that happens during
// the creation of the compute pipeline. The SPEC requires that during the call of
-// CreateReadyComputePipeline() any error won't be forwarded to the error scope / unhandled error
+// CreateComputePipelineAsync() any error won't be forwarded to the error scope / unhandled error
// callback.
-TEST_P(CreateReadyPipelineTest, CreateComputePipelineFailed) {
+TEST_P(CreatePipelineAsyncTest, CreateComputePipelineFailed) {
DAWN_SKIP_TEST_IF(HasToggleEnabled("skip_validation"));
wgpu::ComputePipelineDescriptor csDesc;
@@ -112,13 +112,13 @@
})");
csDesc.computeStage.entryPoint = "main0";
- device.CreateReadyComputePipeline(
+ device.CreateComputePipelineAsync(
&csDesc,
- [](WGPUCreateReadyPipelineStatus status, WGPUComputePipeline returnPipeline,
+ [](WGPUCreatePipelineAsyncStatus status, WGPUComputePipeline returnPipeline,
const char* message, void* userdata) {
- EXPECT_EQ(WGPUCreateReadyPipelineStatus::WGPUCreateReadyPipelineStatus_Error, status);
+ EXPECT_EQ(WGPUCreatePipelineAsyncStatus::WGPUCreatePipelineAsyncStatus_Error, status);
- CreateReadyPipelineTask* task = static_cast<CreateReadyPipelineTask*>(userdata);
+ CreatePipelineAsyncTask* task = static_cast<CreatePipelineAsyncTask*>(userdata);
task->computePipeline = wgpu::ComputePipeline::Acquire(returnPipeline);
task->isCompleted = true;
task->message = message;
@@ -133,8 +133,8 @@
ASSERT_EQ(nullptr, task.computePipeline.Get());
}
-// Verify the basic use of CreateReadyRenderPipeline() works on all backends.
-TEST_P(CreateReadyPipelineTest, BasicUseOfCreateReadyRenderPipeline) {
+// Verify the basic use of CreateRenderPipelineAsync() works on all backends.
+TEST_P(CreatePipelineAsyncTest, BasicUseOfCreateRenderPipelineAsync) {
constexpr wgpu::TextureFormat kRenderAttachmentFormat = wgpu::TextureFormat::RGBA8Unorm;
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor(device);
@@ -153,13 +153,13 @@
renderPipelineDescriptor.cColorStates[0].format = kRenderAttachmentFormat;
renderPipelineDescriptor.primitiveTopology = wgpu::PrimitiveTopology::PointList;
- device.CreateReadyRenderPipeline(
+ device.CreateRenderPipelineAsync(
&renderPipelineDescriptor,
- [](WGPUCreateReadyPipelineStatus status, WGPURenderPipeline returnPipeline,
+ [](WGPUCreatePipelineAsyncStatus status, WGPURenderPipeline returnPipeline,
const char* message, void* userdata) {
- EXPECT_EQ(WGPUCreateReadyPipelineStatus::WGPUCreateReadyPipelineStatus_Success, status);
+ EXPECT_EQ(WGPUCreatePipelineAsyncStatus::WGPUCreatePipelineAsyncStatus_Success, status);
- CreateReadyPipelineTask* task = static_cast<CreateReadyPipelineTask*>(userdata);
+ CreatePipelineAsyncTask* task = static_cast<CreatePipelineAsyncTask*>(userdata);
task->renderPipeline = wgpu::RenderPipeline::Acquire(returnPipeline);
task->isCompleted = true;
task->message = message;
@@ -198,11 +198,11 @@
EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 255, 0, 255), outputTexture, 0, 0);
}
-// Verify CreateReadyRenderPipeline() works as expected when there is any error that happens during
+// Verify CreateRenderPipelineAsync() works as expected when there is any error that happens during
// the creation of the render pipeline. The SPEC requires that during the call of
-// CreateReadyRenderPipeline() any error won't be forwarded to the error scope / unhandled error
+// CreateRenderPipelineAsync() any error won't be forwarded to the error scope / unhandled error
// callback.
-TEST_P(CreateReadyPipelineTest, CreateRenderPipelineFailed) {
+TEST_P(CreatePipelineAsyncTest, CreateRenderPipelineFailed) {
DAWN_SKIP_TEST_IF(HasToggleEnabled("skip_validation"));
constexpr wgpu::TextureFormat kRenderAttachmentFormat = wgpu::TextureFormat::Depth32Float;
@@ -223,13 +223,13 @@
renderPipelineDescriptor.cColorStates[0].format = kRenderAttachmentFormat;
renderPipelineDescriptor.primitiveTopology = wgpu::PrimitiveTopology::PointList;
- device.CreateReadyRenderPipeline(
+ device.CreateRenderPipelineAsync(
&renderPipelineDescriptor,
- [](WGPUCreateReadyPipelineStatus status, WGPURenderPipeline returnPipeline,
+ [](WGPUCreatePipelineAsyncStatus status, WGPURenderPipeline returnPipeline,
const char* message, void* userdata) {
- EXPECT_EQ(WGPUCreateReadyPipelineStatus::WGPUCreateReadyPipelineStatus_Error, status);
+ EXPECT_EQ(WGPUCreatePipelineAsyncStatus::WGPUCreatePipelineAsyncStatus_Error, status);
- CreateReadyPipelineTask* task = static_cast<CreateReadyPipelineTask*>(userdata);
+ CreatePipelineAsyncTask* task = static_cast<CreatePipelineAsyncTask*>(userdata);
task->renderPipeline = wgpu::RenderPipeline::Acquire(returnPipeline);
task->isCompleted = true;
task->message = message;
@@ -245,22 +245,22 @@
}
// Verify there is no error when the device is released before the callback of
-// CreateReadyComputePipeline() is called.
-TEST_P(CreateReadyPipelineTest, ReleaseDeviceBeforeCallbackOfCreateReadyComputePipeline) {
+// CreateComputePipelineAsync() is called.
+TEST_P(CreatePipelineAsyncTest, ReleaseDeviceBeforeCallbackOfCreateComputePipelineAsync) {
wgpu::ComputePipelineDescriptor csDesc;
csDesc.computeStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
[[stage(compute)]] fn main() -> void {
})");
csDesc.computeStage.entryPoint = "main";
- device.CreateReadyComputePipeline(
+ device.CreateComputePipelineAsync(
&csDesc,
- [](WGPUCreateReadyPipelineStatus status, WGPUComputePipeline returnPipeline,
+ [](WGPUCreatePipelineAsyncStatus status, WGPUComputePipeline returnPipeline,
const char* message, void* userdata) {
- EXPECT_EQ(WGPUCreateReadyPipelineStatus::WGPUCreateReadyPipelineStatus_DeviceDestroyed,
+ EXPECT_EQ(WGPUCreatePipelineAsyncStatus::WGPUCreatePipelineAsyncStatus_DeviceDestroyed,
status);
- CreateReadyPipelineTask* task = static_cast<CreateReadyPipelineTask*>(userdata);
+ CreatePipelineAsyncTask* task = static_cast<CreatePipelineAsyncTask*>(userdata);
task->computePipeline = wgpu::ComputePipeline::Acquire(returnPipeline);
task->isCompleted = true;
task->message = message;
@@ -269,8 +269,8 @@
}
// Verify there is no error when the device is released before the callback of
-// CreateReadyRenderPipeline() is called.
-TEST_P(CreateReadyPipelineTest, ReleaseDeviceBeforeCallbackOfCreateReadyRenderPipeline) {
+// CreateRenderPipelineAsync() is called.
+TEST_P(CreatePipelineAsyncTest, ReleaseDeviceBeforeCallbackOfCreateRenderPipelineAsync) {
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor(device);
wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, R"(
[[builtin(position)]] var<out> Position : vec4<f32>;
@@ -287,14 +287,14 @@
renderPipelineDescriptor.cColorStates[0].format = wgpu::TextureFormat::RGBA8Unorm;
renderPipelineDescriptor.primitiveTopology = wgpu::PrimitiveTopology::PointList;
- device.CreateReadyRenderPipeline(
+ device.CreateRenderPipelineAsync(
&renderPipelineDescriptor,
- [](WGPUCreateReadyPipelineStatus status, WGPURenderPipeline returnPipeline,
+ [](WGPUCreatePipelineAsyncStatus status, WGPURenderPipeline returnPipeline,
const char* message, void* userdata) {
- EXPECT_EQ(WGPUCreateReadyPipelineStatus::WGPUCreateReadyPipelineStatus_DeviceDestroyed,
+ EXPECT_EQ(WGPUCreatePipelineAsyncStatus::WGPUCreatePipelineAsyncStatus_DeviceDestroyed,
status);
- CreateReadyPipelineTask* task = static_cast<CreateReadyPipelineTask*>(userdata);
+ CreatePipelineAsyncTask* task = static_cast<CreatePipelineAsyncTask*>(userdata);
task->renderPipeline = wgpu::RenderPipeline::Acquire(returnPipeline);
task->isCompleted = true;
task->message = message;
@@ -302,7 +302,7 @@
&task);
}
-DAWN_INSTANTIATE_TEST(CreateReadyPipelineTest,
+DAWN_INSTANTIATE_TEST(CreatePipelineAsyncTest,
D3D12Backend(),
MetalBackend(),
OpenGLBackend(),
diff --git a/src/tests/unittests/WorkerThreadTests.cpp b/src/tests/unittests/WorkerThreadTests.cpp
index 8faee5d..996d7e1 100644
--- a/src/tests/unittests/WorkerThreadTests.cpp
+++ b/src/tests/unittests/WorkerThreadTests.cpp
@@ -149,7 +149,7 @@
class WorkerThreadTest : public testing::Test {};
-// Emulate the basic usage of worker thread pool in CreateReady*Pipeline().
+// Emulate the basic usage of worker thread pool in Create*PipelineAsync().
TEST_F(WorkerThreadTest, Basic) {
dawn_platform::Platform platform;
std::unique_ptr<dawn_platform::WorkerTaskPool> pool = platform.CreateWorkerTaskPool();
diff --git a/src/tests/unittests/validation/MultipleDeviceTests.cpp b/src/tests/unittests/validation/MultipleDeviceTests.cpp
index 1d1dee2..0f940b0 100644
--- a/src/tests/unittests/validation/MultipleDeviceTests.cpp
+++ b/src/tests/unittests/validation/MultipleDeviceTests.cpp
@@ -28,9 +28,9 @@
ASSERT_DEVICE_ERROR(device.GetQueue().Submit(1, &commandBuffer));
}
-// Test that CreateReadyPipeline fails creation with an Error status if it uses
+// Test that CreatePipelineAsync fails creation with an Error status if it uses
// objects from a different device.
-TEST_F(MultipleDeviceTest, ValidatesSameDeviceCreateReadyPipeline) {
+TEST_F(MultipleDeviceTest, ValidatesSameDeviceCreatePipelineAsync) {
wgpu::ShaderModuleWGSLDescriptor wgslDesc = {};
wgslDesc.source = R"(
[[stage(compute)]] fn main() -> void {
@@ -40,7 +40,7 @@
wgpu::ShaderModuleDescriptor shaderModuleDesc = {};
shaderModuleDesc.nextInChain = &wgslDesc;
- // Base case: CreateReadyComputePipeline succeeds.
+ // Base case: CreateComputePipelineAsync succeeds.
{
wgpu::ShaderModule shaderModule = device.CreateShaderModule(&shaderModuleDesc);
@@ -48,18 +48,18 @@
pipelineDesc.computeStage.module = shaderModule;
pipelineDesc.computeStage.entryPoint = "main";
- StrictMock<MockCallback<WGPUCreateReadyComputePipelineCallback>> creationCallback;
+ StrictMock<MockCallback<WGPUCreateComputePipelineAsyncCallback>> creationCallback;
EXPECT_CALL(creationCallback,
- Call(WGPUCreateReadyPipelineStatus_Success, NotNull(), _, this))
+ Call(WGPUCreatePipelineAsyncStatus_Success, NotNull(), _, this))
.WillOnce(WithArg<1>(Invoke(
[](WGPUComputePipeline pipeline) { wgpu::ComputePipeline::Acquire(pipeline); })));
- device.CreateReadyComputePipeline(&pipelineDesc, creationCallback.Callback(),
+ device.CreateComputePipelineAsync(&pipelineDesc, creationCallback.Callback(),
creationCallback.MakeUserdata(this));
WaitForAllOperations(device);
}
- // CreateReadyComputePipeline errors if the shader module is created on a different device.
+ // CreateComputePipelineAsync errors if the shader module is created on a different device.
{
wgpu::Device device2 = RegisterDevice(CreateTestDevice());
wgpu::ShaderModule shaderModule = device2.CreateShaderModule(&shaderModuleDesc);
@@ -68,11 +68,11 @@
pipelineDesc.computeStage.module = shaderModule;
pipelineDesc.computeStage.entryPoint = "main";
- StrictMock<MockCallback<WGPUCreateReadyComputePipelineCallback>> creationCallback;
+ StrictMock<MockCallback<WGPUCreateComputePipelineAsyncCallback>> creationCallback;
EXPECT_CALL(creationCallback,
- Call(WGPUCreateReadyPipelineStatus_Error, nullptr, _, this + 1))
+ Call(WGPUCreatePipelineAsyncStatus_Error, nullptr, _, this + 1))
.Times(1);
- device.CreateReadyComputePipeline(&pipelineDesc, creationCallback.Callback(),
+ device.CreateComputePipelineAsync(&pipelineDesc, creationCallback.Callback(),
creationCallback.MakeUserdata(this + 1));
WaitForAllOperations(device);
diff --git a/src/tests/unittests/wire/WireCreateReadyPipelineTests.cpp b/src/tests/unittests/wire/WireCreatePipelineAsyncTests.cpp
similarity index 61%
rename from src/tests/unittests/wire/WireCreateReadyPipelineTests.cpp
rename to src/tests/unittests/wire/WireCreatePipelineAsyncTests.cpp
index 2e7ae0f..72cdc94 100644
--- a/src/tests/unittests/wire/WireCreateReadyPipelineTests.cpp
+++ b/src/tests/unittests/wire/WireCreatePipelineAsyncTests.cpp
@@ -22,78 +22,78 @@
namespace {
// Mock class to add expectations on the wire calling callbacks
- class MockCreateReadyComputePipelineCallback {
+ class MockCreateComputePipelineAsyncCallback {
public:
MOCK_METHOD(void,
Call,
- (WGPUCreateReadyPipelineStatus status,
+ (WGPUCreatePipelineAsyncStatus status,
WGPUComputePipeline pipeline,
const char* message,
void* userdata));
};
- std::unique_ptr<StrictMock<MockCreateReadyComputePipelineCallback>>
- mockCreateReadyComputePipelineCallback;
- void ToMockCreateReadyComputePipelineCallback(WGPUCreateReadyPipelineStatus status,
+ std::unique_ptr<StrictMock<MockCreateComputePipelineAsyncCallback>>
+ mockCreateComputePipelineAsyncCallback;
+ void ToMockCreateComputePipelineAsyncCallback(WGPUCreatePipelineAsyncStatus status,
WGPUComputePipeline pipeline,
const char* message,
void* userdata) {
- mockCreateReadyComputePipelineCallback->Call(status, pipeline, message, userdata);
+ mockCreateComputePipelineAsyncCallback->Call(status, pipeline, message, userdata);
}
- class MockCreateReadyRenderPipelineCallback {
+ class MockCreateRenderPipelineAsyncCallback {
public:
MOCK_METHOD(void,
Call,
- (WGPUCreateReadyPipelineStatus status,
+ (WGPUCreatePipelineAsyncStatus status,
WGPURenderPipeline pipeline,
const char* message,
void* userdata));
};
- std::unique_ptr<StrictMock<MockCreateReadyRenderPipelineCallback>>
- mockCreateReadyRenderPipelineCallback;
- void ToMockCreateReadyRenderPipelineCallback(WGPUCreateReadyPipelineStatus status,
+ std::unique_ptr<StrictMock<MockCreateRenderPipelineAsyncCallback>>
+ mockCreateRenderPipelineAsyncCallback;
+ void ToMockCreateRenderPipelineAsyncCallback(WGPUCreatePipelineAsyncStatus status,
WGPURenderPipeline pipeline,
const char* message,
void* userdata) {
- mockCreateReadyRenderPipelineCallback->Call(status, pipeline, message, userdata);
+ mockCreateRenderPipelineAsyncCallback->Call(status, pipeline, message, userdata);
}
} // anonymous namespace
-class WireCreateReadyPipelineTest : public WireTest {
+class WireCreatePipelineAsyncTest : public WireTest {
public:
void SetUp() override {
WireTest::SetUp();
- mockCreateReadyComputePipelineCallback =
- std::make_unique<StrictMock<MockCreateReadyComputePipelineCallback>>();
- mockCreateReadyRenderPipelineCallback =
- std::make_unique<StrictMock<MockCreateReadyRenderPipelineCallback>>();
+ mockCreateComputePipelineAsyncCallback =
+ std::make_unique<StrictMock<MockCreateComputePipelineAsyncCallback>>();
+ mockCreateRenderPipelineAsyncCallback =
+ std::make_unique<StrictMock<MockCreateRenderPipelineAsyncCallback>>();
}
void TearDown() override {
WireTest::TearDown();
// Delete mock so that expectations are checked
- mockCreateReadyComputePipelineCallback = nullptr;
- mockCreateReadyRenderPipelineCallback = nullptr;
+ mockCreateComputePipelineAsyncCallback = nullptr;
+ mockCreateRenderPipelineAsyncCallback = nullptr;
}
void FlushClient() {
WireTest::FlushClient();
- Mock::VerifyAndClearExpectations(&mockCreateReadyComputePipelineCallback);
+ Mock::VerifyAndClearExpectations(&mockCreateComputePipelineAsyncCallback);
}
void FlushServer() {
WireTest::FlushServer();
- Mock::VerifyAndClearExpectations(&mockCreateReadyComputePipelineCallback);
+ Mock::VerifyAndClearExpectations(&mockCreateComputePipelineAsyncCallback);
}
};
-// Test when creating a compute pipeline with CreateReadyComputePipeline() successfully.
-TEST_F(WireCreateReadyPipelineTest, CreateReadyComputePipelineSuccess) {
+// Test when creating a compute pipeline with CreateComputePipelineAsync() successfully.
+TEST_F(WireCreatePipelineAsyncTest, CreateComputePipelineAsyncSuccess) {
WGPUShaderModuleDescriptor csDescriptor{};
WGPUShaderModule csModule = wgpuDeviceCreateShaderModule(device, &csDescriptor);
WGPUShaderModule apiCsModule = api.GetNewShaderModule();
@@ -103,26 +103,26 @@
descriptor.computeStage.module = csModule;
descriptor.computeStage.entryPoint = "main";
- wgpuDeviceCreateReadyComputePipeline(device, &descriptor,
- ToMockCreateReadyComputePipelineCallback, this);
+ wgpuDeviceCreateComputePipelineAsync(device, &descriptor,
+ ToMockCreateComputePipelineAsyncCallback, this);
- EXPECT_CALL(api, OnDeviceCreateReadyComputePipeline(apiDevice, _, _, _))
+ EXPECT_CALL(api, OnDeviceCreateComputePipelineAsync(apiDevice, _, _, _))
.WillOnce(InvokeWithoutArgs([&]() {
- api.CallDeviceCreateReadyComputePipelineCallback(
- apiDevice, WGPUCreateReadyPipelineStatus_Success, nullptr, "");
+ api.CallDeviceCreateComputePipelineAsyncCallback(
+ apiDevice, WGPUCreatePipelineAsyncStatus_Success, nullptr, "");
}));
FlushClient();
- EXPECT_CALL(*mockCreateReadyComputePipelineCallback,
- Call(WGPUCreateReadyPipelineStatus_Success, _, StrEq(""), this))
+ EXPECT_CALL(*mockCreateComputePipelineAsyncCallback,
+ Call(WGPUCreatePipelineAsyncStatus_Success, _, StrEq(""), this))
.Times(1);
FlushServer();
}
-// Test when creating a compute pipeline with CreateReadyComputePipeline() results in an error.
-TEST_F(WireCreateReadyPipelineTest, CreateReadyComputePipelineError) {
+// Test when creating a compute pipeline with CreateComputePipelineAsync() results in an error.
+TEST_F(WireCreatePipelineAsyncTest, CreateComputePipelineAsyncError) {
WGPUShaderModuleDescriptor csDescriptor{};
WGPUShaderModule csModule = wgpuDeviceCreateShaderModule(device, &csDescriptor);
WGPUShaderModule apiCsModule = api.GetNewShaderModule();
@@ -132,26 +132,26 @@
descriptor.computeStage.module = csModule;
descriptor.computeStage.entryPoint = "main";
- wgpuDeviceCreateReadyComputePipeline(device, &descriptor,
- ToMockCreateReadyComputePipelineCallback, this);
+ wgpuDeviceCreateComputePipelineAsync(device, &descriptor,
+ ToMockCreateComputePipelineAsyncCallback, this);
- EXPECT_CALL(api, OnDeviceCreateReadyComputePipeline(apiDevice, _, _, _))
+ EXPECT_CALL(api, OnDeviceCreateComputePipelineAsync(apiDevice, _, _, _))
.WillOnce(InvokeWithoutArgs([&]() {
- api.CallDeviceCreateReadyComputePipelineCallback(
- apiDevice, WGPUCreateReadyPipelineStatus_Error, nullptr, "Some error message");
+ api.CallDeviceCreateComputePipelineAsyncCallback(
+ apiDevice, WGPUCreatePipelineAsyncStatus_Error, nullptr, "Some error message");
}));
FlushClient();
- EXPECT_CALL(*mockCreateReadyComputePipelineCallback,
- Call(WGPUCreateReadyPipelineStatus_Error, _, StrEq("Some error message"), this))
+ EXPECT_CALL(*mockCreateComputePipelineAsyncCallback,
+ Call(WGPUCreatePipelineAsyncStatus_Error, _, StrEq("Some error message"), this))
.Times(1);
FlushServer();
}
-// Test when creating a render pipeline with CreateReadyRenderPipeline() successfully.
-TEST_F(WireCreateReadyPipelineTest, CreateReadyRenderPipelineSuccess) {
+// Test when creating a render pipeline with CreateRenderPipelineAsync() successfully.
+TEST_F(WireCreatePipelineAsyncTest, CreateRenderPipelineAsyncSuccess) {
WGPUShaderModuleDescriptor vertexDescriptor = {};
WGPUShaderModule vsModule = wgpuDeviceCreateShaderModule(device, &vertexDescriptor);
WGPUShaderModule apiVsModule = api.GetNewShaderModule();
@@ -166,25 +166,25 @@
fragmentStage.entryPoint = "main";
pipelineDescriptor.fragmentStage = &fragmentStage;
- wgpuDeviceCreateReadyRenderPipeline(device, &pipelineDescriptor,
- ToMockCreateReadyRenderPipelineCallback, this);
- EXPECT_CALL(api, OnDeviceCreateReadyRenderPipeline(apiDevice, _, _, _))
+ wgpuDeviceCreateRenderPipelineAsync(device, &pipelineDescriptor,
+ ToMockCreateRenderPipelineAsyncCallback, this);
+ EXPECT_CALL(api, OnDeviceCreateRenderPipelineAsync(apiDevice, _, _, _))
.WillOnce(InvokeWithoutArgs([&]() {
- api.CallDeviceCreateReadyRenderPipelineCallback(
- apiDevice, WGPUCreateReadyPipelineStatus_Success, nullptr, "");
+ api.CallDeviceCreateRenderPipelineAsyncCallback(
+ apiDevice, WGPUCreatePipelineAsyncStatus_Success, nullptr, "");
}));
FlushClient();
- EXPECT_CALL(*mockCreateReadyRenderPipelineCallback,
- Call(WGPUCreateReadyPipelineStatus_Success, _, StrEq(""), this))
+ EXPECT_CALL(*mockCreateRenderPipelineAsyncCallback,
+ Call(WGPUCreatePipelineAsyncStatus_Success, _, StrEq(""), this))
.Times(1);
FlushServer();
}
-// Test when creating a render pipeline with CreateReadyRenderPipeline() results in an error.
-TEST_F(WireCreateReadyPipelineTest, CreateReadyRenderPipelineError) {
+// Test when creating a render pipeline with CreateRenderPipelineAsync() results in an error.
+TEST_F(WireCreatePipelineAsyncTest, CreateRenderPipelineAsyncError) {
WGPUShaderModuleDescriptor vertexDescriptor = {};
WGPUShaderModule vsModule = wgpuDeviceCreateShaderModule(device, &vertexDescriptor);
WGPUShaderModule apiVsModule = api.GetNewShaderModule();
@@ -199,18 +199,18 @@
fragmentStage.entryPoint = "main";
pipelineDescriptor.fragmentStage = &fragmentStage;
- wgpuDeviceCreateReadyRenderPipeline(device, &pipelineDescriptor,
- ToMockCreateReadyRenderPipelineCallback, this);
- EXPECT_CALL(api, OnDeviceCreateReadyRenderPipeline(apiDevice, _, _, _))
+ wgpuDeviceCreateRenderPipelineAsync(device, &pipelineDescriptor,
+ ToMockCreateRenderPipelineAsyncCallback, this);
+ EXPECT_CALL(api, OnDeviceCreateRenderPipelineAsync(apiDevice, _, _, _))
.WillOnce(InvokeWithoutArgs([&]() {
- api.CallDeviceCreateReadyRenderPipelineCallback(
- apiDevice, WGPUCreateReadyPipelineStatus_Error, nullptr, "Some error message");
+ api.CallDeviceCreateRenderPipelineAsyncCallback(
+ apiDevice, WGPUCreatePipelineAsyncStatus_Error, nullptr, "Some error message");
}));
FlushClient();
- EXPECT_CALL(*mockCreateReadyRenderPipelineCallback,
- Call(WGPUCreateReadyPipelineStatus_Error, _, StrEq("Some error message"), this))
+ EXPECT_CALL(*mockCreateRenderPipelineAsyncCallback,
+ Call(WGPUCreatePipelineAsyncStatus_Error, _, StrEq("Some error message"), this))
.Times(1);
FlushServer();
@@ -218,7 +218,7 @@
// Test that registering a callback then wire disconnect calls the callback with
// DeviceLost.
-TEST_F(WireCreateReadyPipelineTest, CreateReadyRenderPipelineThenDisconnect) {
+TEST_F(WireCreatePipelineAsyncTest, CreateRenderPipelineAsyncThenDisconnect) {
WGPUShaderModuleDescriptor vertexDescriptor = {};
WGPUShaderModule vsModule = wgpuDeviceCreateShaderModule(device, &vertexDescriptor);
WGPUShaderModule apiVsModule = api.GetNewShaderModule();
@@ -233,25 +233,25 @@
pipelineDescriptor.vertexStage.entryPoint = "main";
pipelineDescriptor.fragmentStage = &fragmentStage;
- wgpuDeviceCreateReadyRenderPipeline(device, &pipelineDescriptor,
- ToMockCreateReadyRenderPipelineCallback, this);
- EXPECT_CALL(api, OnDeviceCreateReadyRenderPipeline(apiDevice, _, _, _))
+ wgpuDeviceCreateRenderPipelineAsync(device, &pipelineDescriptor,
+ ToMockCreateRenderPipelineAsyncCallback, this);
+ EXPECT_CALL(api, OnDeviceCreateRenderPipelineAsync(apiDevice, _, _, _))
.WillOnce(InvokeWithoutArgs([&]() {
- api.CallDeviceCreateReadyRenderPipelineCallback(
- apiDevice, WGPUCreateReadyPipelineStatus_Success, nullptr, "");
+ api.CallDeviceCreateRenderPipelineAsyncCallback(
+ apiDevice, WGPUCreatePipelineAsyncStatus_Success, nullptr, "");
}));
FlushClient();
- EXPECT_CALL(*mockCreateReadyRenderPipelineCallback,
- Call(WGPUCreateReadyPipelineStatus_DeviceLost, _, _, this))
+ EXPECT_CALL(*mockCreateRenderPipelineAsyncCallback,
+ Call(WGPUCreatePipelineAsyncStatus_DeviceLost, _, _, this))
.Times(1);
GetWireClient()->Disconnect();
}
// Test that registering a callback then wire disconnect calls the callback with
// DeviceLost.
-TEST_F(WireCreateReadyPipelineTest, CreateReadyComputePipelineThenDisconnect) {
+TEST_F(WireCreatePipelineAsyncTest, CreateComputePipelineAsyncThenDisconnect) {
WGPUShaderModuleDescriptor csDescriptor{};
WGPUShaderModule csModule = wgpuDeviceCreateShaderModule(device, &csDescriptor);
WGPUShaderModule apiCsModule = api.GetNewShaderModule();
@@ -261,25 +261,25 @@
descriptor.computeStage.module = csModule;
descriptor.computeStage.entryPoint = "main";
- wgpuDeviceCreateReadyComputePipeline(device, &descriptor,
- ToMockCreateReadyComputePipelineCallback, this);
- EXPECT_CALL(api, OnDeviceCreateReadyComputePipeline(apiDevice, _, _, _))
+ wgpuDeviceCreateComputePipelineAsync(device, &descriptor,
+ ToMockCreateComputePipelineAsyncCallback, this);
+ EXPECT_CALL(api, OnDeviceCreateComputePipelineAsync(apiDevice, _, _, _))
.WillOnce(InvokeWithoutArgs([&]() {
- api.CallDeviceCreateReadyComputePipelineCallback(
- apiDevice, WGPUCreateReadyPipelineStatus_Success, nullptr, "");
+ api.CallDeviceCreateComputePipelineAsyncCallback(
+ apiDevice, WGPUCreatePipelineAsyncStatus_Success, nullptr, "");
}));
FlushClient();
- EXPECT_CALL(*mockCreateReadyComputePipelineCallback,
- Call(WGPUCreateReadyPipelineStatus_DeviceLost, _, _, this))
+ EXPECT_CALL(*mockCreateComputePipelineAsyncCallback,
+ Call(WGPUCreatePipelineAsyncStatus_DeviceLost, _, _, this))
.Times(1);
GetWireClient()->Disconnect();
}
// Test that registering a callback after wire disconnect calls the callback with
// DeviceLost.
-TEST_F(WireCreateReadyPipelineTest, CreateReadyRenderPipelineAfterDisconnect) {
+TEST_F(WireCreatePipelineAsyncTest, CreateRenderPipelineAsyncAfterDisconnect) {
WGPUShaderModuleDescriptor vertexDescriptor = {};
WGPUShaderModule vsModule = wgpuDeviceCreateShaderModule(device, &vertexDescriptor);
WGPUShaderModule apiVsModule = api.GetNewShaderModule();
@@ -298,16 +298,16 @@
GetWireClient()->Disconnect();
- EXPECT_CALL(*mockCreateReadyRenderPipelineCallback,
- Call(WGPUCreateReadyPipelineStatus_DeviceLost, nullptr, _, this))
+ EXPECT_CALL(*mockCreateRenderPipelineAsyncCallback,
+ Call(WGPUCreatePipelineAsyncStatus_DeviceLost, nullptr, _, this))
.Times(1);
- wgpuDeviceCreateReadyRenderPipeline(device, &pipelineDescriptor,
- ToMockCreateReadyRenderPipelineCallback, this);
+ wgpuDeviceCreateRenderPipelineAsync(device, &pipelineDescriptor,
+ ToMockCreateRenderPipelineAsyncCallback, this);
}
// Test that registering a callback after wire disconnect calls the callback with
// DeviceLost.
-TEST_F(WireCreateReadyPipelineTest, CreateReadyComputePipelineAfterDisconnect) {
+TEST_F(WireCreatePipelineAsyncTest, CreateComputePipelineAsyncAfterDisconnect) {
WGPUShaderModuleDescriptor csDescriptor{};
WGPUShaderModule csModule = wgpuDeviceCreateShaderModule(device, &csDescriptor);
WGPUShaderModule apiCsModule = api.GetNewShaderModule();
@@ -321,15 +321,15 @@
GetWireClient()->Disconnect();
- EXPECT_CALL(*mockCreateReadyComputePipelineCallback,
- Call(WGPUCreateReadyPipelineStatus_DeviceLost, nullptr, _, this))
+ EXPECT_CALL(*mockCreateComputePipelineAsyncCallback,
+ Call(WGPUCreatePipelineAsyncStatus_DeviceLost, nullptr, _, this))
.Times(1);
- wgpuDeviceCreateReadyComputePipeline(device, &descriptor,
- ToMockCreateReadyComputePipelineCallback, this);
+ wgpuDeviceCreateComputePipelineAsync(device, &descriptor,
+ ToMockCreateComputePipelineAsyncCallback, this);
}
-TEST_F(WireCreateReadyPipelineTest, DeviceDeletedBeforeCallback) {
+TEST_F(WireCreatePipelineAsyncTest, DeviceDeletedBeforeCallback) {
WGPUShaderModuleDescriptor vertexDescriptor = {};
WGPUShaderModule module = wgpuDeviceCreateShaderModule(device, &vertexDescriptor);
WGPUShaderModule apiModule = api.GetNewShaderModule();
@@ -344,14 +344,14 @@
fragmentStage.entryPoint = "main";
pipelineDescriptor.fragmentStage = &fragmentStage;
- wgpuDeviceCreateReadyRenderPipeline(device, &pipelineDescriptor,
- ToMockCreateReadyRenderPipelineCallback, this);
+ wgpuDeviceCreateRenderPipelineAsync(device, &pipelineDescriptor,
+ ToMockCreateRenderPipelineAsyncCallback, this);
- EXPECT_CALL(api, OnDeviceCreateReadyRenderPipeline(apiDevice, _, _, _));
+ EXPECT_CALL(api, OnDeviceCreateRenderPipelineAsync(apiDevice, _, _, _));
FlushClient();
- EXPECT_CALL(*mockCreateReadyRenderPipelineCallback,
- Call(WGPUCreateReadyPipelineStatus_DeviceDestroyed, nullptr, _, this))
+ EXPECT_CALL(*mockCreateRenderPipelineAsyncCallback,
+ Call(WGPUCreatePipelineAsyncStatus_DeviceDestroyed, nullptr, _, this))
.Times(1);
wgpuDeviceRelease(device);