diff --git a/src/dawn/native/CreatePipelineAsyncTask.cpp b/src/dawn/native/CreatePipelineAsyncTask.cpp index e7319abc27..2ed3e67c46 100644 --- a/src/dawn/native/CreatePipelineAsyncTask.cpp +++ b/src/dawn/native/CreatePipelineAsyncTask.cpp @@ -26,82 +26,85 @@ namespace dawn::native { -CreatePipelineAsyncCallbackTaskBase::CreatePipelineAsyncCallbackTaskBase(std::string errorMessage, - void* userdata) - : mErrorMessage(errorMessage), mUserData(userdata) {} +CreatePipelineAsyncCallbackTaskBase::CreatePipelineAsyncCallbackTaskBase(void* userdata) + : mStatus(WGPUCreatePipelineAsyncStatus_Success), mUserData(userdata) {} + +CreatePipelineAsyncCallbackTaskBase::CreatePipelineAsyncCallbackTaskBase( + WGPUCreatePipelineAsyncStatus status, + std::string errorMessage, + void* userdata) + : mErrorMessage(errorMessage), mStatus(status), mUserData(userdata) {} CreatePipelineAsyncCallbackTaskBase::~CreatePipelineAsyncCallbackTaskBase() = default; CreateComputePipelineAsyncCallbackTask::CreateComputePipelineAsyncCallbackTask( Ref pipeline, + WGPUCreateComputePipelineAsyncCallback callback, + void* userdata) + : CreatePipelineAsyncCallbackTaskBase(userdata), + mPipeline(std::move(pipeline)), + mCreateComputePipelineAsyncCallback(callback) {} + +CreateComputePipelineAsyncCallbackTask::CreateComputePipelineAsyncCallbackTask( + WGPUCreatePipelineAsyncStatus status, std::string errorMessage, WGPUCreateComputePipelineAsyncCallback callback, void* userdata) - : CreatePipelineAsyncCallbackTaskBase(errorMessage, userdata), - mPipeline(std::move(pipeline)), + : CreatePipelineAsyncCallbackTaskBase(status, errorMessage, userdata), mCreateComputePipelineAsyncCallback(callback) {} CreateComputePipelineAsyncCallbackTask::~CreateComputePipelineAsyncCallbackTask() = default; void CreateComputePipelineAsyncCallbackTask::Finish() { ASSERT(mCreateComputePipelineAsyncCallback != nullptr); - - if (mPipeline.Get() != nullptr) { - mCreateComputePipelineAsyncCallback(WGPUCreatePipelineAsyncStatus_Success, - ToAPI(mPipeline.Detach()), "", mUserData); - } else { - mCreateComputePipelineAsyncCallback(WGPUCreatePipelineAsyncStatus_Error, nullptr, - mErrorMessage.c_str(), mUserData); - } + mCreateComputePipelineAsyncCallback(mStatus, ToAPI(mPipeline.Detach()), mErrorMessage.c_str(), + mUserData); } void CreateComputePipelineAsyncCallbackTask::HandleShutDown() { ASSERT(mCreateComputePipelineAsyncCallback != nullptr); - mCreateComputePipelineAsyncCallback(WGPUCreatePipelineAsyncStatus_DeviceDestroyed, nullptr, "Device destroyed before callback", mUserData); } void CreateComputePipelineAsyncCallbackTask::HandleDeviceLoss() { ASSERT(mCreateComputePipelineAsyncCallback != nullptr); - mCreateComputePipelineAsyncCallback(WGPUCreatePipelineAsyncStatus_DeviceLost, nullptr, "Device lost before callback", mUserData); } CreateRenderPipelineAsyncCallbackTask::CreateRenderPipelineAsyncCallbackTask( Ref pipeline, + WGPUCreateRenderPipelineAsyncCallback callback, + void* userdata) + : CreatePipelineAsyncCallbackTaskBase(userdata), + mPipeline(std::move(pipeline)), + mCreateRenderPipelineAsyncCallback(callback) {} + +CreateRenderPipelineAsyncCallbackTask::CreateRenderPipelineAsyncCallbackTask( + WGPUCreatePipelineAsyncStatus status, std::string errorMessage, WGPUCreateRenderPipelineAsyncCallback callback, void* userdata) - : CreatePipelineAsyncCallbackTaskBase(errorMessage, userdata), - mPipeline(std::move(pipeline)), + : CreatePipelineAsyncCallbackTaskBase(status, errorMessage, userdata), mCreateRenderPipelineAsyncCallback(callback) {} CreateRenderPipelineAsyncCallbackTask::~CreateRenderPipelineAsyncCallbackTask() = default; void CreateRenderPipelineAsyncCallbackTask::Finish() { ASSERT(mCreateRenderPipelineAsyncCallback != nullptr); - - if (mPipeline.Get() != nullptr) { - mCreateRenderPipelineAsyncCallback(WGPUCreatePipelineAsyncStatus_Success, - ToAPI(mPipeline.Detach()), "", mUserData); - } else { - mCreateRenderPipelineAsyncCallback(WGPUCreatePipelineAsyncStatus_Error, nullptr, - mErrorMessage.c_str(), mUserData); - } + mCreateRenderPipelineAsyncCallback(mStatus, ToAPI(mPipeline.Detach()), mErrorMessage.c_str(), + mUserData); } void CreateRenderPipelineAsyncCallbackTask::HandleShutDown() { ASSERT(mCreateRenderPipelineAsyncCallback != nullptr); - mCreateRenderPipelineAsyncCallback(WGPUCreatePipelineAsyncStatus_DeviceDestroyed, nullptr, "Device destroyed before callback", mUserData); } void CreateRenderPipelineAsyncCallbackTask::HandleDeviceLoss() { ASSERT(mCreateRenderPipelineAsyncCallback != nullptr); - mCreateRenderPipelineAsyncCallback(WGPUCreatePipelineAsyncStatus_DeviceLost, nullptr, "Device lost before callback", mUserData); } @@ -128,14 +131,16 @@ void CreateComputePipelineAsyncTask::Run() { eventLabel); MaybeError maybeError = mComputePipeline->Initialize(); - std::string errorMessage; if (maybeError.IsError()) { - mComputePipeline = nullptr; - errorMessage = maybeError.AcquireError()->GetMessage(); + std::unique_ptr error = maybeError.AcquireError(); + WGPUCreatePipelineAsyncStatus status = + CreatePipelineAsyncStatusFromErrorType(error->GetType()); + device->GetCallbackTaskManager()->AddCallbackTask( + std::make_unique(status, error->GetMessage(), + mCallback, mUserdata)); + } else { + device->AddComputePipelineAsyncCallbackTask(mComputePipeline, mCallback, mUserdata); } - - device->AddComputePipelineAsyncCallbackTask(mComputePipeline, errorMessage, mCallback, - mUserdata); } void CreateComputePipelineAsyncTask::RunAsync( @@ -180,13 +185,16 @@ void CreateRenderPipelineAsyncTask::Run() { eventLabel); MaybeError maybeError = mRenderPipeline->Initialize(); - std::string errorMessage; if (maybeError.IsError()) { - mRenderPipeline = nullptr; - errorMessage = maybeError.AcquireError()->GetMessage(); + std::unique_ptr error = maybeError.AcquireError(); + WGPUCreatePipelineAsyncStatus status = + CreatePipelineAsyncStatusFromErrorType(error->GetType()); + device->GetCallbackTaskManager()->AddCallbackTask( + std::make_unique(status, error->GetMessage(), + mCallback, mUserdata)); + } else { + device->AddRenderPipelineAsyncCallbackTask(mRenderPipeline, mCallback, mUserdata); } - - device->AddRenderPipelineAsyncCallbackTask(mRenderPipeline, errorMessage, mCallback, mUserdata); } void CreateRenderPipelineAsyncTask::RunAsync(std::unique_ptr task) { diff --git a/src/dawn/native/CreatePipelineAsyncTask.h b/src/dawn/native/CreatePipelineAsyncTask.h index f461c1d180..98be85fabf 100644 --- a/src/dawn/native/CreatePipelineAsyncTask.h +++ b/src/dawn/native/CreatePipelineAsyncTask.h @@ -33,16 +33,23 @@ class ShaderModuleBase; struct FlatComputePipelineDescriptor; struct CreatePipelineAsyncCallbackTaskBase : CallbackTask { - CreatePipelineAsyncCallbackTaskBase(std::string errorMessage, void* userData); + explicit CreatePipelineAsyncCallbackTaskBase(void* userData); + CreatePipelineAsyncCallbackTaskBase(WGPUCreatePipelineAsyncStatus status, + std::string errorMessage, + void* userData); ~CreatePipelineAsyncCallbackTaskBase() override; protected: std::string mErrorMessage; + WGPUCreatePipelineAsyncStatus mStatus; void* mUserData; }; struct CreateComputePipelineAsyncCallbackTask : CreatePipelineAsyncCallbackTaskBase { CreateComputePipelineAsyncCallbackTask(Ref pipeline, + WGPUCreateComputePipelineAsyncCallback callback, + void* userdata); + CreateComputePipelineAsyncCallbackTask(WGPUCreatePipelineAsyncStatus status, std::string errorMessage, WGPUCreateComputePipelineAsyncCallback callback, void* userdata); @@ -59,6 +66,9 @@ struct CreateComputePipelineAsyncCallbackTask : CreatePipelineAsyncCallbackTaskB struct CreateRenderPipelineAsyncCallbackTask : CreatePipelineAsyncCallbackTaskBase { CreateRenderPipelineAsyncCallbackTask(Ref pipeline, + WGPUCreateRenderPipelineAsyncCallback callback, + void* userdata); + CreateRenderPipelineAsyncCallbackTask(WGPUCreatePipelineAsyncStatus status, std::string errorMessage, WGPUCreateRenderPipelineAsyncCallback callback, void* userdata); diff --git a/src/dawn/native/Device.cpp b/src/dawn/native/Device.cpp index 9723e11ff3..b042919777 100644 --- a/src/dawn/native/Device.cpp +++ b/src/dawn/native/Device.cpp @@ -1074,9 +1074,10 @@ void DeviceBase::APICreateComputePipelineAsync(const ComputePipelineDescriptor* // callback. if (maybeResult.IsError()) { std::unique_ptr error = maybeResult.AcquireError(); + WGPUCreatePipelineAsyncStatus status = + CreatePipelineAsyncStatusFromErrorType(error->GetType()); // TODO(crbug.com/dawn/1122): Call callbacks only on wgpuInstanceProcessEvents - callback(WGPUCreatePipelineAsyncStatus_Error, nullptr, error->GetMessage().c_str(), - userdata); + callback(status, nullptr, error->GetMessage().c_str(), userdata); } } PipelineLayoutBase* DeviceBase::APICreatePipelineLayout( @@ -1117,9 +1118,10 @@ void DeviceBase::APICreateRenderPipelineAsync(const RenderPipelineDescriptor* de // callback. if (maybeResult.IsError()) { std::unique_ptr error = maybeResult.AcquireError(); + WGPUCreatePipelineAsyncStatus status = + CreatePipelineAsyncStatusFromErrorType(error->GetType()); // TODO(crbug.com/dawn/1122): Call callbacks only on wgpuInstanceProcessEvents - callback(WGPUCreatePipelineAsyncStatus_Error, nullptr, error->GetMessage().c_str(), - userdata); + callback(status, nullptr, error->GetMessage().c_str(), userdata); } } RenderBundleEncoder* DeviceBase::APICreateRenderBundleEncoder( @@ -1516,21 +1518,19 @@ MaybeError DeviceBase::CreateComputePipelineAsync(const ComputePipelineDescripto void DeviceBase::InitializeComputePipelineAsyncImpl(Ref computePipeline, WGPUCreateComputePipelineAsyncCallback callback, void* userdata) { - Ref result; - std::string errorMessage; - MaybeError maybeError = computePipeline->Initialize(); if (maybeError.IsError()) { std::unique_ptr error = maybeError.AcquireError(); - errorMessage = error->GetMessage(); + WGPUCreatePipelineAsyncStatus status = + CreatePipelineAsyncStatusFromErrorType(error->GetType()); + mCallbackTaskManager->AddCallbackTask( + std::make_unique(status, error->GetMessage(), + callback, userdata)); } else { - result = AddOrGetCachedComputePipeline(std::move(computePipeline)); + mCallbackTaskManager->AddCallbackTask( + std::make_unique( + AddOrGetCachedComputePipeline(std::move(computePipeline)), callback, userdata)); } - - std::unique_ptr callbackTask = - std::make_unique(std::move(result), errorMessage, - callback, userdata); - mCallbackTaskManager->AddCallbackTask(std::move(callbackTask)); } // This function is overwritten with the async version on the backends @@ -1538,21 +1538,19 @@ void DeviceBase::InitializeComputePipelineAsyncImpl(Ref com void DeviceBase::InitializeRenderPipelineAsyncImpl(Ref renderPipeline, WGPUCreateRenderPipelineAsyncCallback callback, void* userdata) { - Ref result; - std::string errorMessage; - MaybeError maybeError = renderPipeline->Initialize(); if (maybeError.IsError()) { std::unique_ptr error = maybeError.AcquireError(); - errorMessage = error->GetMessage(); + WGPUCreatePipelineAsyncStatus status = + CreatePipelineAsyncStatusFromErrorType(error->GetType()); + mCallbackTaskManager->AddCallbackTask( + std::make_unique(status, error->GetMessage(), + callback, userdata)); } else { - result = AddOrGetCachedRenderPipeline(std::move(renderPipeline)); + mCallbackTaskManager->AddCallbackTask( + std::make_unique( + AddOrGetCachedRenderPipeline(std::move(renderPipeline)), callback, userdata)); } - - std::unique_ptr callbackTask = - std::make_unique(std::move(result), errorMessage, - callback, userdata); - mCallbackTaskManager->AddCallbackTask(std::move(callbackTask)); } ResultOrError> DeviceBase::CreatePipelineLayout( @@ -1792,7 +1790,6 @@ dawn::platform::WorkerTaskPool* DeviceBase::GetWorkerTaskPool() const { void DeviceBase::AddComputePipelineAsyncCallbackTask( Ref pipeline, - std::string errorMessage, WGPUCreateComputePipelineAsyncCallback callback, void* userdata) { // CreateComputePipelineAsyncWaitableCallbackTask is declared as an internal class as it @@ -1804,21 +1801,19 @@ void DeviceBase::AddComputePipelineAsyncCallbackTask( // TODO(dawn:529): call AddOrGetCachedComputePipeline() asynchronously in // CreateComputePipelineAsyncTaskImpl::Run() when the front-end pipeline cache is // thread-safe. - if (mPipeline.Get() != nullptr) { - mPipeline = mPipeline->GetDevice()->AddOrGetCachedComputePipeline(mPipeline); - } + ASSERT(mPipeline != nullptr); + mPipeline = mPipeline->GetDevice()->AddOrGetCachedComputePipeline(mPipeline); CreateComputePipelineAsyncCallbackTask::Finish(); } }; mCallbackTaskManager->AddCallbackTask( - std::make_unique( - std::move(pipeline), errorMessage, callback, userdata)); + std::make_unique(std::move(pipeline), + callback, userdata)); } void DeviceBase::AddRenderPipelineAsyncCallbackTask(Ref pipeline, - std::string errorMessage, WGPUCreateRenderPipelineAsyncCallback callback, void* userdata) { // CreateRenderPipelineAsyncWaitableCallbackTask is declared as an internal class as it @@ -1840,8 +1835,8 @@ void DeviceBase::AddRenderPipelineAsyncCallbackTask(Ref pipe }; mCallbackTaskManager->AddCallbackTask( - std::make_unique( - std::move(pipeline), errorMessage, callback, userdata)); + std::make_unique(std::move(pipeline), + callback, userdata)); } PipelineCompatibilityToken DeviceBase::GetNextPipelineCompatibilityToken() { diff --git a/src/dawn/native/Device.h b/src/dawn/native/Device.h index e7f6690fe7..b97d2d98df 100644 --- a/src/dawn/native/Device.h +++ b/src/dawn/native/Device.h @@ -379,11 +379,9 @@ class DeviceBase : public RefCountedWithExternalCount { dawn::platform::WorkerTaskPool* GetWorkerTaskPool() const; void AddComputePipelineAsyncCallbackTask(Ref pipeline, - std::string errorMessage, WGPUCreateComputePipelineAsyncCallback callback, void* userdata); void AddRenderPipelineAsyncCallbackTask(Ref pipeline, - std::string errorMessage, WGPUCreateRenderPipelineAsyncCallback callback, void* userdata); diff --git a/src/dawn/native/Pipeline.cpp b/src/dawn/native/Pipeline.cpp index 85a985b5b3..873899948b 100644 --- a/src/dawn/native/Pipeline.cpp +++ b/src/dawn/native/Pipeline.cpp @@ -139,6 +139,18 @@ MaybeError ValidateProgrammableStage(DeviceBase* device, return {}; } +WGPUCreatePipelineAsyncStatus CreatePipelineAsyncStatusFromErrorType(InternalErrorType error) { + switch (error) { + case InternalErrorType::Validation: + return WGPUCreatePipelineAsyncStatus_ValidationError; + case InternalErrorType::DeviceLost: + return WGPUCreatePipelineAsyncStatus_DeviceLost; + case InternalErrorType::Internal: + case InternalErrorType::OutOfMemory: + return WGPUCreatePipelineAsyncStatus_InternalError; + } +} + // PipelineBase PipelineBase::PipelineBase(DeviceBase* device, diff --git a/src/dawn/native/Pipeline.h b/src/dawn/native/Pipeline.h index 0a88c81459..212ebb4445 100644 --- a/src/dawn/native/Pipeline.h +++ b/src/dawn/native/Pipeline.h @@ -40,6 +40,8 @@ MaybeError ValidateProgrammableStage(DeviceBase* device, const PipelineLayoutBase* layout, SingleShaderStage stage); +WGPUCreatePipelineAsyncStatus CreatePipelineAsyncStatusFromErrorType(InternalErrorType error); + struct ProgrammableStage { Ref module; std::string entryPoint; diff --git a/src/dawn/tests/end2end/CreatePipelineAsyncTests.cpp b/src/dawn/tests/end2end/CreatePipelineAsyncTests.cpp index 1f2fdd94d2..627d3b28d4 100644 --- a/src/dawn/tests/end2end/CreatePipelineAsyncTests.cpp +++ b/src/dawn/tests/end2end/CreatePipelineAsyncTests.cpp @@ -213,7 +213,8 @@ TEST_P(CreatePipelineAsyncTest, CreateComputePipelineFailed) { &csDesc, [](WGPUCreatePipelineAsyncStatus status, WGPUComputePipeline returnPipeline, const char* message, void* userdata) { - EXPECT_EQ(WGPUCreatePipelineAsyncStatus::WGPUCreatePipelineAsyncStatus_Error, status); + EXPECT_EQ(WGPUCreatePipelineAsyncStatus::WGPUCreatePipelineAsyncStatus_ValidationError, + status); CreatePipelineAsyncTask* task = static_cast(userdata); task->computePipeline = wgpu::ComputePipeline::Acquire(returnPipeline); @@ -341,7 +342,8 @@ TEST_P(CreatePipelineAsyncTest, CreateRenderPipelineFailed) { &renderPipelineDescriptor, [](WGPUCreatePipelineAsyncStatus status, WGPURenderPipeline returnPipeline, const char* message, void* userdata) { - EXPECT_EQ(WGPUCreatePipelineAsyncStatus::WGPUCreatePipelineAsyncStatus_Error, status); + EXPECT_EQ(WGPUCreatePipelineAsyncStatus::WGPUCreatePipelineAsyncStatus_ValidationError, + status); CreatePipelineAsyncTask* task = static_cast(userdata); task->renderPipeline = wgpu::RenderPipeline::Acquire(returnPipeline); diff --git a/src/dawn/tests/unittests/native/CreatePipelineAsyncTaskTests.cpp b/src/dawn/tests/unittests/native/CreatePipelineAsyncTaskTests.cpp index 3583b792a1..dc03f0abee 100644 --- a/src/dawn/tests/unittests/native/CreatePipelineAsyncTaskTests.cpp +++ b/src/dawn/tests/unittests/native/CreatePipelineAsyncTaskTests.cpp @@ -22,7 +22,7 @@ class CreatePipelineAsyncTaskTests : public DawnNativeTest {}; // A regression test for a null pointer issue in CreateRenderPipelineAsyncTask::Run(). // See crbug.com/dawn/1310 for more details. -TEST_F(CreatePipelineAsyncTaskTests, InitializationErrorInCreateRenderPipelineAsync) { +TEST_F(CreatePipelineAsyncTaskTests, InitializationValidationErrorInCreateRenderPipelineAsync) { dawn::native::DeviceBase* deviceBase = reinterpret_cast(device.Get()); Ref renderPipelineMock = @@ -36,7 +36,35 @@ TEST_F(CreatePipelineAsyncTaskTests, InitializationErrorInCreateRenderPipelineAs renderPipelineMock, [](WGPUCreatePipelineAsyncStatus status, WGPURenderPipeline returnPipeline, const char* message, void* userdata) { - EXPECT_EQ(WGPUCreatePipelineAsyncStatus::WGPUCreatePipelineAsyncStatus_Error, status); + EXPECT_EQ(WGPUCreatePipelineAsyncStatus::WGPUCreatePipelineAsyncStatus_ValidationError, + status); + }, + nullptr); + + asyncTask.Run(); + device.Tick(); + + EXPECT_CALL(*renderPipelineMock.Get(), DestroyImpl).Times(1); +} + +// Test that Internal error are converted to the InternalError status in async pipeline creation +// callbacks. +TEST_F(CreatePipelineAsyncTaskTests, InitializationInternalErrorInCreateRenderPipelineAsync) { + dawn::native::DeviceBase* deviceBase = + reinterpret_cast(device.Get()); + Ref renderPipelineMock = + AcquireRef(new dawn::native::RenderPipelineMock(deviceBase)); + + ON_CALL(*renderPipelineMock.Get(), Initialize) + .WillByDefault(testing::Return(testing::ByMove( + DAWN_MAKE_ERROR(dawn::native::InternalErrorType::Internal, "Initialization Error")))); + + dawn::native::CreateRenderPipelineAsyncTask asyncTask( + renderPipelineMock, + [](WGPUCreatePipelineAsyncStatus status, WGPURenderPipeline returnPipeline, + const char* message, void* userdata) { + EXPECT_EQ(WGPUCreatePipelineAsyncStatus::WGPUCreatePipelineAsyncStatus_InternalError, + status); }, nullptr); @@ -48,7 +76,7 @@ TEST_F(CreatePipelineAsyncTaskTests, InitializationErrorInCreateRenderPipelineAs // A regression test for a null pointer issue in CreateComputePipelineAsyncTask::Run(). // See crbug.com/dawn/1310 for more details. -TEST_F(CreatePipelineAsyncTaskTests, InitializationErrorInCreateComputePipelineAsync) { +TEST_F(CreatePipelineAsyncTaskTests, InitializationValidationErrorInCreateComputePipelineAsync) { dawn::native::DeviceBase* deviceBase = reinterpret_cast(device.Get()); Ref computePipelineMock = @@ -62,7 +90,35 @@ TEST_F(CreatePipelineAsyncTaskTests, InitializationErrorInCreateComputePipelineA computePipelineMock, [](WGPUCreatePipelineAsyncStatus status, WGPUComputePipeline returnPipeline, const char* message, void* userdata) { - EXPECT_EQ(WGPUCreatePipelineAsyncStatus::WGPUCreatePipelineAsyncStatus_Error, status); + EXPECT_EQ(WGPUCreatePipelineAsyncStatus::WGPUCreatePipelineAsyncStatus_ValidationError, + status); + }, + nullptr); + + asyncTask.Run(); + device.Tick(); + + EXPECT_CALL(*computePipelineMock.Get(), DestroyImpl).Times(1); +} + +// Test that Internal error are converted to the InternalError status in async pipeline creation +// callbacks. +TEST_F(CreatePipelineAsyncTaskTests, InitializationInternalErrorInCreateComputePipelineAsync) { + dawn::native::DeviceBase* deviceBase = + reinterpret_cast(device.Get()); + Ref computePipelineMock = + AcquireRef(new dawn::native::ComputePipelineMock(deviceBase)); + + ON_CALL(*computePipelineMock.Get(), Initialize) + .WillByDefault(testing::Return(testing::ByMove( + DAWN_MAKE_ERROR(dawn::native::InternalErrorType::Internal, "Initialization Error")))); + + dawn::native::CreateComputePipelineAsyncTask asyncTask( + computePipelineMock, + [](WGPUCreatePipelineAsyncStatus status, WGPUComputePipeline returnPipeline, + const char* message, void* userdata) { + EXPECT_EQ(WGPUCreatePipelineAsyncStatus::WGPUCreatePipelineAsyncStatus_InternalError, + status); }, nullptr); diff --git a/src/dawn/tests/unittests/validation/MultipleDeviceTests.cpp b/src/dawn/tests/unittests/validation/MultipleDeviceTests.cpp index 3498f1da04..cb12a477b1 100644 --- a/src/dawn/tests/unittests/validation/MultipleDeviceTests.cpp +++ b/src/dawn/tests/unittests/validation/MultipleDeviceTests.cpp @@ -75,7 +75,7 @@ TEST_F(MultipleDeviceTest, ValidatesSameDeviceCreatePipelineAsync) { StrictMock> creationCallback; EXPECT_CALL(creationCallback, - Call(WGPUCreatePipelineAsyncStatus_Error, nullptr, _, this + 1)) + Call(WGPUCreatePipelineAsyncStatus_ValidationError, nullptr, _, this + 1)) .Times(1); device.CreateComputePipelineAsync(&pipelineDesc, creationCallback.Callback(), creationCallback.MakeUserdata(this + 1)); diff --git a/src/dawn/tests/unittests/wire/WireCreatePipelineAsyncTests.cpp b/src/dawn/tests/unittests/wire/WireCreatePipelineAsyncTests.cpp index 5c81fe3fb7..7486e030db 100644 --- a/src/dawn/tests/unittests/wire/WireCreatePipelineAsyncTests.cpp +++ b/src/dawn/tests/unittests/wire/WireCreatePipelineAsyncTests.cpp @@ -145,13 +145,15 @@ TEST_F(WireCreatePipelineAsyncTest, CreateComputePipelineAsyncError) { EXPECT_CALL(api, OnDeviceCreateComputePipelineAsync(apiDevice, _, _, _)) .WillOnce(InvokeWithoutArgs([&]() { api.CallDeviceCreateComputePipelineAsyncCallback( - apiDevice, WGPUCreatePipelineAsyncStatus_Error, nullptr, "Some error message"); + apiDevice, WGPUCreatePipelineAsyncStatus_ValidationError, nullptr, + "Some error message"); })); FlushClient(); - EXPECT_CALL(*mockCreateComputePipelineAsyncCallback, - Call(WGPUCreatePipelineAsyncStatus_Error, _, StrEq("Some error message"), this)) + EXPECT_CALL( + *mockCreateComputePipelineAsyncCallback, + Call(WGPUCreatePipelineAsyncStatus_ValidationError, _, StrEq("Some error message"), this)) .Times(1); FlushServer(); @@ -211,13 +213,15 @@ TEST_F(WireCreatePipelineAsyncTest, CreateRenderPipelineAsyncError) { EXPECT_CALL(api, OnDeviceCreateRenderPipelineAsync(apiDevice, _, _, _)) .WillOnce(InvokeWithoutArgs([&]() { api.CallDeviceCreateRenderPipelineAsyncCallback( - apiDevice, WGPUCreatePipelineAsyncStatus_Error, nullptr, "Some error message"); + apiDevice, WGPUCreatePipelineAsyncStatus_ValidationError, nullptr, + "Some error message"); })); FlushClient(); - EXPECT_CALL(*mockCreateRenderPipelineAsyncCallback, - Call(WGPUCreatePipelineAsyncStatus_Error, _, StrEq("Some error message"), this)) + EXPECT_CALL( + *mockCreateRenderPipelineAsyncCallback, + Call(WGPUCreatePipelineAsyncStatus_ValidationError, _, StrEq("Some error message"), this)) .Times(1); FlushServer();