Null: Properly fake commands being completed on WaitForIdle
Bug: chromium:1068465 Change-Id: I7c01b1c4fed2424a53d30b7e53dabf4d74ed4a73 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19288 Reviewed-by: Austin Eng <enga@chromium.org> Reviewed-by: Kai Ninomiya <kainino@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
93bea5cb50
commit
cd586a92e8
|
@ -188,6 +188,8 @@ namespace dawn_native { namespace null {
|
|||
}
|
||||
|
||||
MaybeError Device::WaitForIdleForDestruction() {
|
||||
// Fake all commands being completed
|
||||
mCompletedSerial = mLastSubmittedSerial;
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
|
@ -441,6 +441,20 @@ TEST_P(DeviceLostTest, FenceOnCompletionBeforeLossFails) {
|
|||
EXPECT_EQ(fence.GetCompletedValue(), 0u);
|
||||
}
|
||||
|
||||
// Regression test for the Null backend not properly setting the completedSerial when
|
||||
// WaitForIdleForDestruction is called, causing the fence signaling to not be retired and an
|
||||
// ASSERT to fire.
|
||||
TEST_P(DeviceLostTest, AfterSubmitAndSerial) {
|
||||
queue.Submit(0, nullptr);
|
||||
|
||||
wgpu::FenceDescriptor descriptor;
|
||||
descriptor.initialValue = 0;
|
||||
wgpu::Fence fence = queue.CreateFence(&descriptor);
|
||||
|
||||
queue.Signal(fence, 1);
|
||||
SetCallbackAndLoseForTesting();
|
||||
}
|
||||
|
||||
// Test that when you Signal, then Tick, then device lost, the fence completed value would be 2
|
||||
TEST_P(DeviceLostTest, FenceSignalTickOnCompletion) {
|
||||
wgpu::FenceDescriptor descriptor;
|
||||
|
@ -471,4 +485,8 @@ TEST_P(DeviceLostTest, LoseForTestingOnce) {
|
|||
device.LoseForTesting();
|
||||
}
|
||||
|
||||
DAWN_INSTANTIATE_TEST(DeviceLostTest, D3D12Backend(), MetalBackend(), VulkanBackend());
|
||||
DAWN_INSTANTIATE_TEST(DeviceLostTest,
|
||||
D3D12Backend(),
|
||||
MetalBackend(),
|
||||
NullBackend(),
|
||||
VulkanBackend());
|
||||
|
|
|
@ -184,7 +184,8 @@ TEST_F(ErrorScopeValidationTest, AsynchronousThenSynchronous) {
|
|||
device.Tick();
|
||||
}
|
||||
|
||||
// Test that if the device is destroyed before the callback occurs, it is called with UNKNOWN.
|
||||
// Test that if the device is destroyed before the callback occurs, it is called with NoError
|
||||
// because all previous operations are waited upon before the destruction returns.
|
||||
TEST_F(ErrorScopeValidationTest, DeviceDestroyedBeforeCallback) {
|
||||
wgpu::Queue queue = device.CreateQueue();
|
||||
|
||||
|
@ -192,6 +193,6 @@ TEST_F(ErrorScopeValidationTest, DeviceDestroyedBeforeCallback) {
|
|||
queue.Submit(0, nullptr);
|
||||
device.PopErrorScope(ToMockDevicePopErrorScopeCallback, this);
|
||||
|
||||
EXPECT_CALL(*mockDevicePopErrorScopeCallback, Call(WGPUErrorType_Unknown, _, this)).Times(1);
|
||||
EXPECT_CALL(*mockDevicePopErrorScopeCallback, Call(WGPUErrorType_NoError, _, this)).Times(1);
|
||||
device = nullptr;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue