Remove deprecated Wire APIs
Bug: dawn:565 Change-Id: I577532347c79e64b418a93551027e89910c3ce68 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/40480 Commit-Queue: Austin Eng <enga@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Stephen White <senorblanco@chromium.org>
This commit is contained in:
parent
20d5e380b3
commit
7fe5aa2eac
|
@ -142,7 +142,6 @@ wgpu::Device CreateCppDawnDevice() {
|
|||
s2cBuf = new utils::TerribleCommandBuffer();
|
||||
|
||||
dawn_wire::WireServerDescriptor serverDesc = {};
|
||||
serverDesc.device = backendDevice;
|
||||
serverDesc.procs = &backendProcs;
|
||||
serverDesc.serializer = s2cBuf;
|
||||
|
||||
|
@ -153,9 +152,14 @@ wgpu::Device CreateCppDawnDevice() {
|
|||
clientDesc.serializer = c2sBuf;
|
||||
|
||||
wireClient = new dawn_wire::WireClient(clientDesc);
|
||||
cDevice = wireClient->GetDevice();
|
||||
procs = dawn_wire::client::GetProcs();
|
||||
s2cBuf->SetHandler(wireClient);
|
||||
|
||||
auto deviceReservation = wireClient->ReserveDevice();
|
||||
wireServer->InjectDevice(backendDevice, deviceReservation.id,
|
||||
deviceReservation.generation);
|
||||
|
||||
cDevice = deviceReservation.device;
|
||||
} break;
|
||||
}
|
||||
|
||||
|
|
|
@ -689,10 +689,6 @@ namespace dawn_wire {
|
|||
bool DeserializeWGPUDeviceProperties(WGPUDeviceProperties* deviceProperties,
|
||||
const volatile char* deserializeBuffer,
|
||||
size_t deserializeBufferSize) {
|
||||
if (deserializeBufferSize == 0) {
|
||||
// TODO(enga): Remove this after updating Chromium.
|
||||
deserializeBufferSize = SerializedWGPUDevicePropertiesSize(deviceProperties);
|
||||
}
|
||||
const volatile WGPUDevicePropertiesTransfer* transfer = nullptr;
|
||||
if (GetPtrFromBuffer(&deserializeBuffer, &deserializeBufferSize, 1, &transfer) !=
|
||||
DeserializeResult::Success) {
|
||||
|
|
|
@ -25,10 +25,6 @@ namespace dawn_wire {
|
|||
mImpl.reset();
|
||||
}
|
||||
|
||||
WGPUDevice WireClient::GetDevice() const {
|
||||
return mImpl->GetDevice();
|
||||
}
|
||||
|
||||
const volatile char* WireClient::HandleCommands(const volatile char* commands, size_t size) {
|
||||
return mImpl->HandleCommands(commands, size);
|
||||
}
|
||||
|
|
|
@ -18,8 +18,7 @@
|
|||
namespace dawn_wire {
|
||||
|
||||
WireServer::WireServer(const WireServerDescriptor& descriptor)
|
||||
: mImpl(new server::Server(descriptor.device,
|
||||
*descriptor.procs,
|
||||
: mImpl(new server::Server(*descriptor.procs,
|
||||
descriptor.serializer,
|
||||
descriptor.memoryTransferService)) {
|
||||
}
|
||||
|
|
|
@ -84,18 +84,6 @@ namespace dawn_wire { namespace client {
|
|||
}
|
||||
}
|
||||
|
||||
WGPUDevice Client::GetDevice() {
|
||||
// This function is deprecated. The concept of a "default" device on the wire
|
||||
// will be removed in favor of ReserveDevice/InjectDevice.
|
||||
if (mDevice == nullptr) {
|
||||
ReservedDevice reservation = ReserveDevice();
|
||||
mDevice = FromAPI(reservation.device);
|
||||
ASSERT(reservation.id == 1);
|
||||
ASSERT(reservation.generation == 0);
|
||||
}
|
||||
return reinterpret_cast<WGPUDeviceImpl*>(mDevice);
|
||||
}
|
||||
|
||||
ReservedTexture Client::ReserveTexture(WGPUDevice device) {
|
||||
auto* allocation = TextureAllocator().New(this);
|
||||
|
||||
|
|
|
@ -39,8 +39,6 @@ namespace dawn_wire { namespace client {
|
|||
const volatile char* HandleCommandsImpl(const volatile char* commands,
|
||||
size_t size) override;
|
||||
|
||||
WGPUDevice GetDevice();
|
||||
|
||||
MemoryTransferService* GetMemoryTransferService() const {
|
||||
return mMemoryTransferService;
|
||||
}
|
||||
|
@ -76,7 +74,6 @@ namespace dawn_wire { namespace client {
|
|||
|
||||
#include "dawn_wire/client/ClientPrototypes_autogen.inc"
|
||||
|
||||
Device* mDevice = nullptr;
|
||||
ChunkedCommandSerializer mSerializer;
|
||||
WireDeserializeAllocator mAllocator;
|
||||
MemoryTransferService* mMemoryTransferService = nullptr;
|
||||
|
|
|
@ -17,8 +17,7 @@
|
|||
|
||||
namespace dawn_wire { namespace server {
|
||||
|
||||
Server::Server(WGPUDevice device,
|
||||
const DawnProcTable& procs,
|
||||
Server::Server(const DawnProcTable& procs,
|
||||
CommandSerializer* serializer,
|
||||
MemoryTransferService* memoryTransferService)
|
||||
: mSerializer(serializer),
|
||||
|
@ -30,13 +29,6 @@ namespace dawn_wire { namespace server {
|
|||
mOwnedMemoryTransferService = CreateInlineMemoryTransferService();
|
||||
mMemoryTransferService = mOwnedMemoryTransferService.get();
|
||||
}
|
||||
|
||||
// For the deprecated initialization path:
|
||||
// The client-server knowledge is bootstrapped with device 1, generation 0.
|
||||
if (device != nullptr) {
|
||||
bool success = InjectDevice(device, 1, 0);
|
||||
ASSERT(success);
|
||||
}
|
||||
}
|
||||
|
||||
Server::~Server() {
|
||||
|
|
|
@ -151,8 +151,7 @@ namespace dawn_wire { namespace server {
|
|||
|
||||
class Server : public ServerBase {
|
||||
public:
|
||||
Server(WGPUDevice device,
|
||||
const DawnProcTable& procs,
|
||||
Server(const DawnProcTable& procs,
|
||||
CommandSerializer* serializer,
|
||||
MemoryTransferService* memoryTransferService);
|
||||
~Server() override;
|
||||
|
|
|
@ -152,11 +152,12 @@ int DawnWireServerFuzzer::Run(const uint8_t* data,
|
|||
|
||||
DevNull devNull;
|
||||
dawn_wire::WireServerDescriptor serverDesc = {};
|
||||
serverDesc.device = device.Get();
|
||||
serverDesc.procs = &procs;
|
||||
serverDesc.serializer = &devNull;
|
||||
|
||||
std::unique_ptr<dawn_wire::WireServer> wireServer(new dawn_wire::WireServer(serverDesc));
|
||||
wireServer->InjectDevice(device.Get(), 1, 0);
|
||||
device = nullptr; // Server owns the device now.
|
||||
|
||||
wireServer->HandleCommands(reinterpret_cast<const char*>(data), size);
|
||||
|
||||
|
@ -173,9 +174,7 @@ int DawnWireServerFuzzer::Run(const uint8_t* data,
|
|||
}
|
||||
}
|
||||
|
||||
// Destroy the server before the device because it needs to free all objects.
|
||||
wireServer = nullptr;
|
||||
device = nullptr;
|
||||
|
||||
// If we support error injection, and an output directory was provided, output copies of the
|
||||
// original testcase data, prepended with the injected error index.
|
||||
|
|
|
@ -49,10 +49,9 @@ namespace dawn_wire {
|
|||
const WGPUDeviceProperties* deviceProperties,
|
||||
char* serializeBuffer);
|
||||
|
||||
// TODO(enga): Remove the default value after updating Chromium.
|
||||
DAWN_WIRE_EXPORT bool DeserializeWGPUDeviceProperties(WGPUDeviceProperties* deviceProperties,
|
||||
const volatile char* deserializeBuffer,
|
||||
size_t deserializeBufferSize = 0);
|
||||
size_t deserializeBufferSize);
|
||||
|
||||
} // namespace dawn_wire
|
||||
|
||||
|
|
|
@ -54,7 +54,6 @@ namespace dawn_wire {
|
|||
WireClient(const WireClientDescriptor& descriptor);
|
||||
~WireClient() override;
|
||||
|
||||
WGPUDevice GetDevice() const;
|
||||
const volatile char* HandleCommands(const volatile char* commands,
|
||||
size_t size) override final;
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@ namespace dawn_wire {
|
|||
} // namespace server
|
||||
|
||||
struct DAWN_WIRE_EXPORT WireServerDescriptor {
|
||||
WGPUDevice device;
|
||||
const DawnProcTable* procs;
|
||||
CommandSerializer* serializer;
|
||||
server::MemoryTransferService* memoryTransferService = nullptr;
|
||||
|
|
|
@ -71,7 +71,7 @@ namespace {
|
|||
clientDesc.serializer = mC2sBuf.get();
|
||||
mWireClient = std::make_unique<dawn_wire::WireClient>(clientDesc);
|
||||
|
||||
mDevice = wgpu::Device::Acquire(mWireClient->GetDevice());
|
||||
mDevice = wgpu::Device::Acquire(mWireClient->ReserveDevice().device);
|
||||
mProcs = dawn_wire::client::GetProcs();
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -50,12 +50,10 @@ void WireTest::SetUp() {
|
|||
mC2sBuf = std::make_unique<utils::TerribleCommandBuffer>(mWireServer.get());
|
||||
|
||||
WireServerDescriptor serverDesc = {};
|
||||
serverDesc.device = mockDevice;
|
||||
serverDesc.procs = &mockProcs;
|
||||
serverDesc.serializer = mS2cBuf.get();
|
||||
serverDesc.memoryTransferService = GetServerMemoryTransferService();
|
||||
|
||||
EXPECT_CALL(api, DeviceReference(mockDevice));
|
||||
mWireServer.reset(new WireServer(serverDesc));
|
||||
mC2sBuf->SetHandler(mWireServer.get());
|
||||
|
||||
|
@ -66,9 +64,13 @@ void WireTest::SetUp() {
|
|||
mWireClient.reset(new WireClient(clientDesc));
|
||||
mS2cBuf->SetHandler(mWireClient.get());
|
||||
|
||||
device = mWireClient->GetDevice();
|
||||
dawnProcSetProcs(&dawn_wire::client::GetProcs());
|
||||
|
||||
auto deviceReservation = mWireClient->ReserveDevice();
|
||||
EXPECT_CALL(api, DeviceReference(mockDevice));
|
||||
mWireServer->InjectDevice(mockDevice, deviceReservation.id, deviceReservation.generation);
|
||||
|
||||
device = deviceReservation.device;
|
||||
apiDevice = mockDevice;
|
||||
|
||||
// The GetQueue is done on WireClient startup so we expect it now.
|
||||
|
|
Loading…
Reference in New Issue