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>
This commit is contained in:
Natasha Lee 2020-01-17 21:32:08 +00:00 committed by Commit Bot service account
parent 352a589fe0
commit d8f8c29bb2
3 changed files with 19 additions and 6 deletions

View File

@ -517,10 +517,7 @@ namespace dawn_native {
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;

View File

@ -32,6 +32,19 @@ namespace dawn_native {
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())) {

View File

@ -27,14 +27,17 @@ namespace dawn_native {
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);