Deprecate fences.
The are replaced by Queue::OnSubmittedWorkDone. Only Queue::CreateFence is deprecated since all other fence-related calls require a fence to work. Also ports a number of uses of fences in test harness to use Queue::OnSubmittedWorkDone instead. Bug: chromium:1177476 Change-Id: I479415f72b08158a3484013e00db8facd11e6f33 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/42660 Auto-Submit: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Brandon Jones <bajones@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org> Reviewed-by: Brandon Jones <bajones@chromium.org>
This commit is contained in:
parent
7124cc4e5d
commit
4165c1cd9c
|
@ -237,6 +237,10 @@ namespace dawn_native {
|
|||
}
|
||||
|
||||
Fence* QueueBase::CreateFence(const FenceDescriptor* descriptor) {
|
||||
// TODO(chromium:1177476): Remove once the deprecation period is finished.
|
||||
GetDevice()->EmitDeprecationWarning(
|
||||
"Fences are deprecated, use Queue::OnSubmittedWorkDone instead.");
|
||||
|
||||
if (GetDevice()->ConsumedError(ValidateCreateFence(descriptor))) {
|
||||
return Fence::MakeError(GetDevice());
|
||||
}
|
||||
|
|
|
@ -65,10 +65,6 @@ namespace {
|
|||
return sOriginalDeviceCreateSwapChain(device, surface, &desc);
|
||||
}
|
||||
|
||||
void CommandsCompleteCallback(WGPUFenceCompletionStatus status, void* userdata) {
|
||||
sCommandsComplete = true;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
int DawnWireServerFuzzer::Initialize(int* argc, char*** argv) {
|
||||
|
@ -163,10 +159,8 @@ int DawnWireServerFuzzer::Run(const uint8_t* data,
|
|||
// Wait for all previous commands before destroying the server.
|
||||
// TODO(enga): Improve this when we improve/finalize how processing events happens.
|
||||
{
|
||||
wgpu::Queue queue = device.GetQueue();
|
||||
wgpu::Fence fence = queue.CreateFence();
|
||||
queue.Signal(fence, 1u);
|
||||
fence.OnCompletion(1u, CommandsCompleteCallback, 0);
|
||||
device.GetQueue().OnSubmittedWorkDone(
|
||||
0u, [](WGPUQueueWorkDoneStatus, void*) { sCommandsComplete = true; }, nullptr);
|
||||
while (!sCommandsComplete) {
|
||||
device.Tick();
|
||||
utils::USleep(100);
|
||||
|
|
|
@ -1080,12 +1080,11 @@ void DawnTestBase::FlushWire() {
|
|||
}
|
||||
|
||||
void DawnTestBase::WaitForAllOperations() {
|
||||
wgpu::Queue queue = device.GetQueue();
|
||||
wgpu::Fence fence = queue.CreateFence();
|
||||
|
||||
// Force the currently submitted operations to completed.
|
||||
queue.Signal(fence, 1);
|
||||
while (fence.GetCompletedValue() < 1) {
|
||||
bool done = false;
|
||||
device.GetQueue().OnSubmittedWorkDone(
|
||||
0u, [](WGPUQueueWorkDoneStatus, void* userdata) { *static_cast<bool*>(userdata) = true; },
|
||||
&done);
|
||||
while (!done) {
|
||||
WaitABit();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -164,6 +164,11 @@ TEST_P(DeprecationTests, GetDefaultQueueDeprecation) {
|
|||
EXPECT_EQ(deprecatedQueue.Get(), queue.Get());
|
||||
}
|
||||
|
||||
// Test that fences are deprecated.
|
||||
TEST_P(DeprecationTests, CreateFence) {
|
||||
EXPECT_DEPRECATION_WARNING(queue.CreateFence());
|
||||
}
|
||||
|
||||
DAWN_INSTANTIATE_TEST(DeprecationTests,
|
||||
D3D12Backend(),
|
||||
MetalBackend(),
|
||||
|
|
|
@ -422,17 +422,13 @@ TEST_P(DeviceLostTest, CommandEncoderFinishFails) {
|
|||
TEST_P(DeviceLostTest, CreateFenceFails) {
|
||||
SetCallbackAndLoseForTesting();
|
||||
|
||||
wgpu::FenceDescriptor descriptor;
|
||||
descriptor.initialValue = 0;
|
||||
|
||||
ASSERT_DEVICE_ERROR(queue.CreateFence(&descriptor));
|
||||
EXPECT_DEPRECATION_WARNING(ASSERT_DEVICE_ERROR(queue.CreateFence()));
|
||||
}
|
||||
|
||||
// Test that queue signal fails when device is lost
|
||||
TEST_P(DeviceLostTest, QueueSignalFenceFails) {
|
||||
wgpu::FenceDescriptor descriptor;
|
||||
descriptor.initialValue = 0;
|
||||
wgpu::Fence fence = queue.CreateFence(&descriptor);
|
||||
wgpu::Fence fence;
|
||||
EXPECT_DEPRECATION_WARNING(fence = queue.CreateFence());
|
||||
|
||||
SetCallbackAndLoseForTesting();
|
||||
|
||||
|
@ -444,14 +440,13 @@ TEST_P(DeviceLostTest, QueueSignalFenceFails) {
|
|||
ASSERT_DEVICE_ERROR(fence.OnCompletion(2u, ToMockFenceOnCompletionFails, nullptr));
|
||||
|
||||
// completed value should not have changed from initial value
|
||||
EXPECT_EQ(fence.GetCompletedValue(), descriptor.initialValue);
|
||||
EXPECT_EQ(fence.GetCompletedValue(), 0u);
|
||||
}
|
||||
|
||||
// Test that Fence On Completion fails after device is lost
|
||||
TEST_P(DeviceLostTest, FenceOnCompletionFails) {
|
||||
wgpu::FenceDescriptor descriptor;
|
||||
descriptor.initialValue = 0;
|
||||
wgpu::Fence fence = queue.CreateFence(&descriptor);
|
||||
wgpu::Fence fence;
|
||||
EXPECT_DEPRECATION_WARNING(fence = queue.CreateFence());
|
||||
|
||||
queue.Signal(fence, 2);
|
||||
|
||||
|
@ -469,9 +464,8 @@ TEST_P(DeviceLostTest, FenceOnCompletionFails) {
|
|||
// Test that Fence::OnCompletion callbacks with device lost status when device is lost after calling
|
||||
// OnCompletion
|
||||
TEST_P(DeviceLostTest, FenceOnCompletionBeforeLossFails) {
|
||||
wgpu::FenceDescriptor descriptor;
|
||||
descriptor.initialValue = 0;
|
||||
wgpu::Fence fence = queue.CreateFence(&descriptor);
|
||||
wgpu::Fence fence;
|
||||
EXPECT_DEPRECATION_WARNING(fence = queue.CreateFence());
|
||||
|
||||
queue.Signal(fence, 2);
|
||||
|
||||
|
@ -513,9 +507,8 @@ TEST_P(DeviceLostTest, QueueOnSubmittedWorkDoneBeforeLossFails) {
|
|||
TEST_P(DeviceLostTest, AfterSubmitAndSerial) {
|
||||
queue.Submit(0, nullptr);
|
||||
|
||||
wgpu::FenceDescriptor descriptor;
|
||||
descriptor.initialValue = 0;
|
||||
wgpu::Fence fence = queue.CreateFence(&descriptor);
|
||||
wgpu::Fence fence;
|
||||
EXPECT_DEPRECATION_WARNING(fence = queue.CreateFence());
|
||||
|
||||
queue.Signal(fence, 1);
|
||||
SetCallbackAndLoseForTesting();
|
||||
|
@ -523,9 +516,8 @@ TEST_P(DeviceLostTest, AfterSubmitAndSerial) {
|
|||
|
||||
// Test that when you Signal, then Tick, then device lost, the fence completed value would be 2
|
||||
TEST_P(DeviceLostTest, FenceSignalTickOnCompletion) {
|
||||
wgpu::FenceDescriptor descriptor;
|
||||
descriptor.initialValue = 0;
|
||||
wgpu::Fence fence = queue.CreateFence(&descriptor);
|
||||
wgpu::Fence fence;
|
||||
EXPECT_DEPRECATION_WARNING(fence = queue.CreateFence());
|
||||
|
||||
queue.Signal(fence, 2);
|
||||
WaitForAllOperations();
|
||||
|
|
|
@ -83,7 +83,8 @@ class FenceTests : public DawnTest {
|
|||
TEST_P(FenceTests, SimpleSignal) {
|
||||
wgpu::FenceDescriptor descriptor;
|
||||
descriptor.initialValue = 1u;
|
||||
wgpu::Fence fence = queue.CreateFence(&descriptor);
|
||||
wgpu::Fence fence;
|
||||
EXPECT_DEPRECATION_WARNING(fence = queue.CreateFence(&descriptor));
|
||||
|
||||
// Completed value starts at initial value
|
||||
EXPECT_EQ(fence.GetCompletedValue(), 1u);
|
||||
|
@ -97,7 +98,8 @@ TEST_P(FenceTests, SimpleSignal) {
|
|||
|
||||
// Test callbacks are called in increasing order of fence completion value
|
||||
TEST_P(FenceTests, OnCompletionOrdering) {
|
||||
wgpu::Fence fence = queue.CreateFence();
|
||||
wgpu::Fence fence;
|
||||
EXPECT_DEPRECATION_WARNING(fence = queue.CreateFence());
|
||||
|
||||
queue.Signal(fence, 4);
|
||||
|
||||
|
@ -131,7 +133,8 @@ TEST_P(FenceTests, OnCompletionOrdering) {
|
|||
|
||||
// Test callbacks still occur if Queue::Signal happens multiple times
|
||||
TEST_P(FenceTests, MultipleSignalOnCompletion) {
|
||||
wgpu::Fence fence = queue.CreateFence();
|
||||
wgpu::Fence fence;
|
||||
EXPECT_DEPRECATION_WARNING(fence = queue.CreateFence());
|
||||
|
||||
queue.Signal(fence, 2);
|
||||
queue.Signal(fence, 4);
|
||||
|
@ -145,7 +148,8 @@ TEST_P(FenceTests, MultipleSignalOnCompletion) {
|
|||
|
||||
// Test callbacks still occur if Queue::Signal and fence::OnCompletion happens multiple times
|
||||
TEST_P(FenceTests, SignalOnCompletionWait) {
|
||||
wgpu::Fence fence = queue.CreateFence();
|
||||
wgpu::Fence fence;
|
||||
EXPECT_DEPRECATION_WARNING(fence = queue.CreateFence());
|
||||
|
||||
queue.Signal(fence, 2);
|
||||
queue.Signal(fence, 6);
|
||||
|
@ -163,7 +167,8 @@ TEST_P(FenceTests, SignalOnCompletionWait) {
|
|||
|
||||
// Test callbacks still occur if Queue::Signal and fence::OnCompletion happens multiple times
|
||||
TEST_P(FenceTests, SignalOnCompletionWaitStaggered) {
|
||||
wgpu::Fence fence = queue.CreateFence();
|
||||
wgpu::Fence fence;
|
||||
EXPECT_DEPRECATION_WARNING(fence = queue.CreateFence());
|
||||
|
||||
queue.Signal(fence, 2);
|
||||
|
||||
|
@ -182,7 +187,8 @@ TEST_P(FenceTests, SignalOnCompletionWaitStaggered) {
|
|||
|
||||
// Test all callbacks are called if they are added for the same fence value
|
||||
TEST_P(FenceTests, OnCompletionMultipleCallbacks) {
|
||||
wgpu::Fence fence = queue.CreateFence();
|
||||
wgpu::Fence fence;
|
||||
EXPECT_DEPRECATION_WARNING(fence = queue.CreateFence());
|
||||
|
||||
queue.Signal(fence, 4);
|
||||
|
||||
|
@ -209,11 +215,13 @@ TEST_P(FenceTests, OnCompletionMultipleCallbacks) {
|
|||
// TODO(enga): Enable when fence is removed from fence signal tracker
|
||||
// Currently it holds a reference and is not destructed
|
||||
TEST_P(FenceTests, DISABLED_DestroyBeforeOnCompletionEnd) {
|
||||
wgpu::Fence fence = queue.CreateFence();
|
||||
wgpu::Fence fence;
|
||||
EXPECT_DEPRECATION_WARNING(fence = queue.CreateFence());
|
||||
|
||||
// The fence in this block will be deleted when it goes out of scope
|
||||
{
|
||||
wgpu::Fence testFence = queue.CreateFence();
|
||||
wgpu::Fence testFence;
|
||||
EXPECT_DEPRECATION_WARNING(testFence = queue.CreateFence());
|
||||
|
||||
queue.Signal(testFence, 4);
|
||||
|
||||
|
@ -247,7 +255,8 @@ TEST_P(FenceTests, DISABLED_DestroyBeforeOnCompletionEnd) {
|
|||
// Regression test that validation errors that are tracked client-side are captured
|
||||
// in error scopes.
|
||||
TEST_P(FenceTests, ClientValidationErrorInErrorScope) {
|
||||
wgpu::Fence fence = queue.CreateFence();
|
||||
wgpu::Fence fence;
|
||||
EXPECT_DEPRECATION_WARNING(fence = queue.CreateFence());
|
||||
|
||||
queue.Signal(fence, 4);
|
||||
|
||||
|
|
|
@ -85,7 +85,8 @@ TEST_P(QueueTimelineTests, MapReadSignalOnComplete) {
|
|||
|
||||
mMapReadBuffer.MapAsync(wgpu::MapMode::Read, 0, 0, ToMockMapCallback, this);
|
||||
|
||||
wgpu::Fence fence = queue.CreateFence();
|
||||
wgpu::Fence fence;
|
||||
EXPECT_DEPRECATION_WARNING(fence = queue.CreateFence());
|
||||
|
||||
queue.Signal(fence, 1);
|
||||
fence.OnCompletion(1u, ToMockFenceOnCompletion, this);
|
||||
|
@ -119,7 +120,8 @@ TEST_P(QueueTimelineTests, SignalMapReadOnComplete) {
|
|||
.Times(1);
|
||||
EXPECT_CALL(*mockMapCallback, Call(WGPUBufferMapAsyncStatus_Success, this)).Times(1);
|
||||
|
||||
wgpu::Fence fence = queue.CreateFence();
|
||||
wgpu::Fence fence;
|
||||
EXPECT_DEPRECATION_WARNING(fence = queue.CreateFence());
|
||||
queue.Signal(fence, 2);
|
||||
|
||||
mMapReadBuffer.MapAsync(wgpu::MapMode::Read, 0, 0, ToMockMapCallback, this);
|
||||
|
@ -154,7 +156,8 @@ TEST_P(QueueTimelineTests, SignalOnCompleteMapRead) {
|
|||
.Times(1);
|
||||
EXPECT_CALL(*mockMapCallback, Call(WGPUBufferMapAsyncStatus_Success, this)).Times(1);
|
||||
|
||||
wgpu::Fence fence = queue.CreateFence();
|
||||
wgpu::Fence fence;
|
||||
EXPECT_DEPRECATION_WARNING(fence = queue.CreateFence());
|
||||
queue.Signal(fence, 2);
|
||||
|
||||
fence.OnCompletion(2u, ToMockFenceOnCompletion, this);
|
||||
|
@ -182,7 +185,8 @@ TEST_P(QueueTimelineTests, SurroundWithFenceSignals) {
|
|||
EXPECT_CALL(*mockFenceOnCompletionCallback, Call(WGPUFenceCompletionStatus_Success, this + 8))
|
||||
.Times(1);
|
||||
|
||||
wgpu::Fence fence = queue.CreateFence();
|
||||
wgpu::Fence fence;
|
||||
EXPECT_DEPRECATION_WARNING(fence = queue.CreateFence());
|
||||
queue.Signal(fence, 2);
|
||||
queue.Signal(fence, 4);
|
||||
|
||||
|
|
|
@ -237,24 +237,31 @@ void DawnPerfTestBase::DoRunLoop(double maxRunTime) {
|
|||
mCpuTime = 0;
|
||||
mRunning = true;
|
||||
|
||||
wgpu::FenceDescriptor desc = {};
|
||||
uint64_t signaledFenceValue = 0;
|
||||
wgpu::Fence fence = mTest->queue.CreateFence(&desc);
|
||||
uint64_t finishedIterations = 0;
|
||||
uint64_t submittedIterations = 0;
|
||||
|
||||
mTimer->Start();
|
||||
|
||||
// This loop can be canceled by calling AbortTest().
|
||||
while (mRunning) {
|
||||
// Wait if there are too many steps in flight on the GPU.
|
||||
while (signaledFenceValue - fence.GetCompletedValue() >= mMaxStepsInFlight) {
|
||||
while (submittedIterations - finishedIterations >= mMaxStepsInFlight) {
|
||||
mTest->WaitABit();
|
||||
}
|
||||
|
||||
TRACE_EVENT0(platform, General, "Step");
|
||||
double stepStart = mTimer->GetElapsedTime();
|
||||
Step();
|
||||
mCpuTime += mTimer->GetElapsedTime() - stepStart;
|
||||
|
||||
mTest->queue.Signal(fence, ++signaledFenceValue);
|
||||
submittedIterations++;
|
||||
mTest->queue.OnSubmittedWorkDone(
|
||||
0u,
|
||||
[](WGPUQueueWorkDoneStatus, void* userdata) {
|
||||
uint64_t* counter = static_cast<uint64_t*>(userdata);
|
||||
(*counter)++;
|
||||
},
|
||||
&finishedIterations);
|
||||
|
||||
if (mRunning) {
|
||||
++mNumStepsPerformed;
|
||||
|
@ -270,7 +277,7 @@ void DawnPerfTestBase::DoRunLoop(double maxRunTime) {
|
|||
// TODO(enga): When Dawn has multiple backgrounds threads, add a Device::WaitForIdleForTesting()
|
||||
// which waits for all threads to stop doing work. When we output results, there should
|
||||
// be no additional incoming trace events.
|
||||
while (signaledFenceValue != fence.GetCompletedValue()) {
|
||||
while (submittedIterations != finishedIterations) {
|
||||
mTest->WaitABit();
|
||||
}
|
||||
|
||||
|
|
|
@ -149,7 +149,8 @@ TEST_F(ErrorScopeValidationTest, EnclosedQueueSubmit) {
|
|||
device.PushErrorScope(wgpu::ErrorFilter::OutOfMemory);
|
||||
|
||||
queue.Submit(0, nullptr);
|
||||
wgpu::Fence fence = queue.CreateFence();
|
||||
wgpu::Fence fence;
|
||||
EXPECT_DEPRECATION_WARNING(fence = queue.CreateFence());
|
||||
queue.Signal(fence, 1);
|
||||
|
||||
testing::Sequence seq;
|
||||
|
@ -174,7 +175,8 @@ TEST_F(ErrorScopeValidationTest, EnclosedQueueSubmitNested) {
|
|||
device.PushErrorScope(wgpu::ErrorFilter::OutOfMemory);
|
||||
|
||||
queue.Submit(0, nullptr);
|
||||
wgpu::Fence fence = queue.CreateFence();
|
||||
wgpu::Fence fence;
|
||||
EXPECT_DEPRECATION_WARNING(fence = queue.CreateFence());
|
||||
queue.Signal(fence, 1);
|
||||
|
||||
testing::Sequence seq;
|
||||
|
|
|
@ -70,13 +70,14 @@ TEST_F(FenceValidationTest, CreationSuccess) {
|
|||
{
|
||||
wgpu::FenceDescriptor descriptor;
|
||||
descriptor.initialValue = 0;
|
||||
queue.CreateFence(&descriptor);
|
||||
EXPECT_DEPRECATION_WARNING(queue.CreateFence(&descriptor));
|
||||
}
|
||||
}
|
||||
|
||||
// Creation succeeds if no descriptor is provided
|
||||
TEST_F(FenceValidationTest, DefaultDescriptor) {
|
||||
wgpu::Fence fence = queue.CreateFence();
|
||||
wgpu::Fence fence;
|
||||
EXPECT_DEPRECATION_WARNING(fence = queue.CreateFence());
|
||||
EXPECT_EQ(fence.GetCompletedValue(), 0u);
|
||||
}
|
||||
|
||||
|
@ -85,7 +86,8 @@ TEST_F(FenceValidationTest, GetCompletedValue) {
|
|||
{
|
||||
wgpu::FenceDescriptor descriptor;
|
||||
descriptor.initialValue = 1;
|
||||
wgpu::Fence fence = queue.CreateFence(&descriptor);
|
||||
wgpu::Fence fence;
|
||||
EXPECT_DEPRECATION_WARNING(fence = queue.CreateFence(&descriptor));
|
||||
EXPECT_EQ(fence.GetCompletedValue(), 1u);
|
||||
}
|
||||
}
|
||||
|
@ -99,7 +101,8 @@ TEST_F(FenceValidationTest, OnCompletionImmediate) {
|
|||
|
||||
wgpu::FenceDescriptor descriptor;
|
||||
descriptor.initialValue = 1;
|
||||
wgpu::Fence fence = queue.CreateFence(&descriptor);
|
||||
wgpu::Fence fence;
|
||||
EXPECT_DEPRECATION_WARNING(fence = queue.CreateFence(&descriptor));
|
||||
|
||||
EXPECT_CALL(*mockFenceOnCompletionCallback, Call(WGPUFenceCompletionStatus_Success, this + 0))
|
||||
.Times(1);
|
||||
|
@ -114,7 +117,8 @@ TEST_F(FenceValidationTest, OnCompletionImmediate) {
|
|||
TEST_F(FenceValidationTest, OnCompletionLargerThanSignaled) {
|
||||
wgpu::FenceDescriptor descriptor;
|
||||
descriptor.initialValue = 1;
|
||||
wgpu::Fence fence = queue.CreateFence(&descriptor);
|
||||
wgpu::Fence fence;
|
||||
EXPECT_DEPRECATION_WARNING(fence = queue.CreateFence(&descriptor));
|
||||
|
||||
// Cannot signal for values > signaled value
|
||||
EXPECT_CALL(*mockFenceOnCompletionCallback, Call(WGPUFenceCompletionStatus_Error, nullptr))
|
||||
|
@ -137,7 +141,8 @@ TEST_F(FenceValidationTest, GetCompletedValueInsideCallback) {
|
|||
|
||||
wgpu::FenceDescriptor descriptor;
|
||||
descriptor.initialValue = 1;
|
||||
wgpu::Fence fence = queue.CreateFence(&descriptor);
|
||||
wgpu::Fence fence;
|
||||
EXPECT_DEPRECATION_WARNING(fence = queue.CreateFence(&descriptor));
|
||||
|
||||
queue.Signal(fence, 3);
|
||||
fence.OnCompletion(2u, ToMockFenceOnCompletion, nullptr);
|
||||
|
@ -152,7 +157,8 @@ TEST_F(FenceValidationTest, GetCompletedValueInsideCallback) {
|
|||
TEST_F(FenceValidationTest, GetCompletedValueAfterCallback) {
|
||||
wgpu::FenceDescriptor descriptor;
|
||||
descriptor.initialValue = 1;
|
||||
wgpu::Fence fence = queue.CreateFence(&descriptor);
|
||||
wgpu::Fence fence;
|
||||
EXPECT_DEPRECATION_WARNING(fence = queue.CreateFence(&descriptor));
|
||||
|
||||
queue.Signal(fence, 2);
|
||||
fence.OnCompletion(2u, ToMockFenceOnCompletion, nullptr);
|
||||
|
@ -166,7 +172,8 @@ TEST_F(FenceValidationTest, GetCompletedValueAfterCallback) {
|
|||
TEST_F(FenceValidationTest, SignalError) {
|
||||
wgpu::FenceDescriptor descriptor;
|
||||
descriptor.initialValue = 1;
|
||||
wgpu::Fence fence = queue.CreateFence(&descriptor);
|
||||
wgpu::Fence fence;
|
||||
EXPECT_DEPRECATION_WARNING(fence = queue.CreateFence(&descriptor));
|
||||
|
||||
// value < fence signaled value
|
||||
ASSERT_DEVICE_ERROR(queue.Signal(fence, 0));
|
||||
|
@ -178,7 +185,8 @@ TEST_F(FenceValidationTest, SignalError) {
|
|||
TEST_F(FenceValidationTest, SignalSuccess) {
|
||||
wgpu::FenceDescriptor descriptor;
|
||||
descriptor.initialValue = 1;
|
||||
wgpu::Fence fence = queue.CreateFence(&descriptor);
|
||||
wgpu::Fence fence;
|
||||
EXPECT_DEPRECATION_WARNING(fence = queue.CreateFence(&descriptor));
|
||||
|
||||
// Success
|
||||
queue.Signal(fence, 2);
|
||||
|
@ -198,7 +206,8 @@ TEST_F(FenceValidationTest, DISABLED_SignalWrongQueue) {
|
|||
|
||||
wgpu::FenceDescriptor descriptor;
|
||||
descriptor.initialValue = 1;
|
||||
wgpu::Fence fence = queue.CreateFence(&descriptor);
|
||||
wgpu::Fence fence;
|
||||
EXPECT_DEPRECATION_WARNING(fence = queue.CreateFence(&descriptor));
|
||||
|
||||
ASSERT_DEVICE_ERROR(queue2.Signal(fence, 2));
|
||||
}
|
||||
|
@ -210,7 +219,8 @@ TEST_F(FenceValidationTest, DISABLED_SignalWrongQueueDoesNotUpdateValue) {
|
|||
|
||||
wgpu::FenceDescriptor descriptor;
|
||||
descriptor.initialValue = 1;
|
||||
wgpu::Fence fence = queue.CreateFence(&descriptor);
|
||||
wgpu::Fence fence;
|
||||
EXPECT_DEPRECATION_WARNING(fence = queue.CreateFence(&descriptor));
|
||||
|
||||
ASSERT_DEVICE_ERROR(queue2.Signal(fence, 2));
|
||||
|
||||
|
|
|
@ -131,12 +131,13 @@ void ValidationTest::FlushWire() {
|
|||
}
|
||||
|
||||
void ValidationTest::WaitForAllOperations(const wgpu::Device& device) {
|
||||
wgpu::Queue queue = device.GetQueue();
|
||||
wgpu::Fence fence = queue.CreateFence();
|
||||
bool done = false;
|
||||
device.GetQueue().OnSubmittedWorkDone(
|
||||
0u, [](WGPUQueueWorkDoneStatus, void* userdata) { *static_cast<bool*>(userdata) = true; },
|
||||
&done);
|
||||
|
||||
// Force the currently submitted operations to completed.
|
||||
queue.Signal(fence, 1);
|
||||
while (fence.GetCompletedValue() < 1) {
|
||||
while (!done) {
|
||||
device.Tick();
|
||||
FlushWire();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue