Change ErrorScopeId type to NonZeroU64

And extract it from WebGPURequest
This commit is contained in:
Kunal Mohan 2020-08-03 01:45:29 +05:30
parent 8eff1d74de
commit ce6e09a3aa
17 changed files with 277 additions and 250 deletions

View file

@ -277,16 +277,18 @@ impl GPUCommandEncoderMethods for GPUCommandEncoder {
.insert(DomRoot::from_ref(destination));
self.channel
.0
.send(WebGPURequest::CopyBufferToBuffer {
command_encoder_id: self.encoder.0,
device_id: self.device.id().0,
.send((
scope_id,
source_id: source.id().0,
source_offset,
destination_id: destination.id().0,
destination_offset,
size,
})
WebGPURequest::CopyBufferToBuffer {
command_encoder_id: self.encoder.0,
device_id: self.device.id().0,
source_id: source.id().0,
source_offset,
destination_id: destination.id().0,
destination_offset,
size,
},
))
.expect("Failed to send CopyBufferToBuffer");
}
@ -317,14 +319,18 @@ impl GPUCommandEncoderMethods for GPUCommandEncoder {
self.channel
.0
.send(WebGPURequest::CopyBufferToTexture {
command_encoder_id: self.encoder.0,
device_id: self.device.id().0,
.send((
scope_id,
source: convert_buffer_cv(source),
destination: convert_texture_cv(destination),
copy_size: convert_texture_size_to_wgt(&convert_texture_size_to_dict(&copy_size)),
})
WebGPURequest::CopyBufferToTexture {
command_encoder_id: self.encoder.0,
device_id: self.device.id().0,
source: convert_buffer_cv(source),
destination: convert_texture_cv(destination),
copy_size: convert_texture_size_to_wgt(&convert_texture_size_to_dict(
&copy_size,
)),
},
))
.expect("Failed to send CopyBufferToTexture");
}
@ -355,14 +361,18 @@ impl GPUCommandEncoderMethods for GPUCommandEncoder {
self.channel
.0
.send(WebGPURequest::CopyTextureToBuffer {
command_encoder_id: self.encoder.0,
device_id: self.device.id().0,
.send((
scope_id,
source: convert_texture_cv(source),
destination: convert_buffer_cv(destination),
copy_size: convert_texture_size_to_wgt(&convert_texture_size_to_dict(&copy_size)),
})
WebGPURequest::CopyTextureToBuffer {
command_encoder_id: self.encoder.0,
device_id: self.device.id().0,
source: convert_texture_cv(source),
destination: convert_buffer_cv(destination),
copy_size: convert_texture_size_to_wgt(&convert_texture_size_to_dict(
&copy_size,
)),
},
))
.expect("Failed to send CopyTextureToBuffer");
}
@ -389,14 +399,18 @@ impl GPUCommandEncoderMethods for GPUCommandEncoder {
self.channel
.0
.send(WebGPURequest::CopyTextureToTexture {
command_encoder_id: self.encoder.0,
device_id: self.device.id().0,
.send((
scope_id,
source: convert_texture_cv(source),
destination: convert_texture_cv(destination),
copy_size: convert_texture_size_to_wgt(&convert_texture_size_to_dict(&copy_size)),
})
WebGPURequest::CopyTextureToTexture {
command_encoder_id: self.encoder.0,
device_id: self.device.id().0,
source: convert_texture_cv(source),
destination: convert_texture_cv(destination),
copy_size: convert_texture_size_to_wgt(&convert_texture_size_to_dict(
&copy_size,
)),
},
))
.expect("Failed to send CopyTextureToTexture");
}
@ -404,13 +418,15 @@ impl GPUCommandEncoderMethods for GPUCommandEncoder {
fn Finish(&self, descriptor: &GPUCommandBufferDescriptor) -> DomRoot<GPUCommandBuffer> {
self.channel
.0
.send(WebGPURequest::CommandEncoderFinish {
command_encoder_id: self.encoder.0,
device_id: self.device.id().0,
scope_id: self.device.use_current_scope(),
// TODO(zakorgy): We should use `_descriptor` here after it's not empty
// and the underlying wgpu-core struct is serializable
})
.send((
self.device.use_current_scope(),
WebGPURequest::CommandEncoderFinish {
command_encoder_id: self.encoder.0,
device_id: self.device.id().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");
*self.state.borrow_mut() = GPUCommandEncoderState::Closed;