Fuzzer: Wait for all commands to complete before destroying the wire
Bug: chromium:1074739 Change-Id: I32591efe42559299234053f112a2f846d43612ab Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21366 Commit-Queue: Austin Eng <enga@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
a1800c04f3
commit
02beecaec5
|
@ -90,6 +90,7 @@ static_library("dawn_wire_server_fuzzer_common") {
|
|||
"${dawn_root}/src/dawn:dawncpp",
|
||||
"${dawn_root}/src/dawn_native:dawn_native_static",
|
||||
"${dawn_root}/src/dawn_wire:dawn_wire_static",
|
||||
"${dawn_root}/src/utils:dawn_utils",
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "dawn/webgpu_cpp.h"
|
||||
#include "dawn_native/DawnNative.h"
|
||||
#include "dawn_wire/WireServer.h"
|
||||
#include "utils/SystemUtils.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
|
@ -149,8 +150,17 @@ int DawnWireServerFuzzer::Run(const uint8_t* data,
|
|||
|
||||
wireServer->HandleCommands(reinterpret_cast<const char*>(data), size);
|
||||
|
||||
// Fake waiting for all previous commands before destroying the server.
|
||||
device.Tick();
|
||||
// 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.GetDefaultQueue();
|
||||
wgpu::Fence fence = queue.CreateFence();
|
||||
queue.Signal(fence, 1u);
|
||||
while (fence.GetCompletedValue() != 1u) {
|
||||
device.Tick();
|
||||
utils::USleep(100);
|
||||
}
|
||||
}
|
||||
|
||||
// Destroy the server before the device because it needs to free all objects.
|
||||
wireServer = nullptr;
|
||||
|
|
Loading…
Reference in New Issue