Fixing some style related issues in WebGPU.

Changed the Requests/Response from tuples to named struct variants and also sorted in alphabetical order.
Replaced the ID generator functions from `globalscope` with a single function,
which returns a `RefMut` and can call the appropriate method to generate resource IDs.
This commit is contained in:
Istvan Miklos 2020-02-05 11:32:52 +01:00
parent 0f9b04680a
commit 000a5d543d
10 changed files with 561 additions and 472 deletions

View file

@ -87,14 +87,14 @@ impl GPUCommandEncoderMethods for GPUCommandEncoder {
.insert(DomRoot::from_ref(destination));
self.channel
.0
.send(WebGPURequest::CopyBufferToBuffer(
self.encoder.0,
source.id().0,
.send(WebGPURequest::CopyBufferToBuffer {
command_encoder_id: self.encoder.0,
source_id: source.id().0,
source_offset,
destination.id().0,
destination_id: destination.id().0,
destination_offset,
size,
))
})
.expect("Failed to send CopyBufferToBuffer");
}
@ -103,12 +103,12 @@ impl GPUCommandEncoderMethods for GPUCommandEncoder {
let (sender, receiver) = ipc::channel().unwrap();
self.channel
.0
.send(WebGPURequest::CommandEncoderFinish(
.send(WebGPURequest::CommandEncoderFinish {
sender,
self.encoder.0,
command_encoder_id: self.encoder.0,
// TODO(zakorgy): We should use `_descriptor` here after it's not empty
// and the underlying wgpu-core struct is serializable
))
})
.expect("Failed to send Finish");
let buffer = receiver.recv().unwrap();