Add QueueBase::MakeError
Bug: dawn:68, chromium:1042598
Change-Id: I1cf97e29ecadb520e2641ea01ac6dcf7e908bbd3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15221
Commit-Queue: Natasha Lee <natlee@microsoft.com>
Reviewed-by: Austin Eng <enga@chromium.org>
diff --git a/src/dawn_native/Device.cpp b/src/dawn_native/Device.cpp
index d2aab65..66ffc93 100644
--- a/src/dawn_native/Device.cpp
+++ b/src/dawn_native/Device.cpp
@@ -517,10 +517,7 @@
QueueBase* result = nullptr;
if (ConsumedError(CreateQueueInternal(&result))) {
- // If queue creation failure ever becomes possible, we should implement MakeError and
- // friends for them.
- UNREACHABLE();
- return nullptr;
+ return QueueBase::MakeError(this);
}
return result;
diff --git a/src/dawn_native/Queue.cpp b/src/dawn_native/Queue.cpp
index 803f299..4492f53 100644
--- a/src/dawn_native/Queue.cpp
+++ b/src/dawn_native/Queue.cpp
@@ -32,6 +32,19 @@
QueueBase::QueueBase(DeviceBase* device) : ObjectBase(device) {
}
+ QueueBase::QueueBase(DeviceBase* device, ObjectBase::ErrorTag tag) : ObjectBase(device, tag) {
+ }
+
+ // static
+ QueueBase* QueueBase::MakeError(DeviceBase* device) {
+ return new QueueBase(device, ObjectBase::kError);
+ }
+
+ MaybeError QueueBase::SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) {
+ UNREACHABLE();
+ return {};
+ }
+
void QueueBase::Submit(uint32_t commandCount, CommandBufferBase* const* commands) {
DeviceBase* device = GetDevice();
if (device->ConsumedError(device->ValidateIsAlive())) {
diff --git a/src/dawn_native/Queue.h b/src/dawn_native/Queue.h
index 4adec04..fd9d291 100644
--- a/src/dawn_native/Queue.h
+++ b/src/dawn_native/Queue.h
@@ -27,14 +27,17 @@
public:
QueueBase(DeviceBase* device);
+ static QueueBase* MakeError(DeviceBase* device);
+
// Dawn API
void Submit(uint32_t commandCount, CommandBufferBase* const* commands);
void Signal(Fence* fence, uint64_t signalValue);
Fence* CreateFence(const FenceDescriptor* descriptor);
private:
- virtual MaybeError SubmitImpl(uint32_t commandCount,
- CommandBufferBase* const* commands) = 0;
+ QueueBase(DeviceBase* device, ObjectBase::ErrorTag tag);
+
+ virtual MaybeError SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands);
MaybeError ValidateSubmit(uint32_t commandCount, CommandBufferBase* const* commands);
MaybeError ValidateSignal(const Fence* fence, uint64_t signalValue);