webgpu: Move errorscopes to WGPU thread (#32304)

* Prepare errorscopes logic in wgpu_thread

* remove scope_id from ipc

* new GPUErrors per spec

* remove cotent timeline error_scope

* fixup poperrorscope types

* device_scope -> gpu_error and nice errors

* Handle errors detection more elegantly

* good expectations

* new expectations

* Make error_scope.errors Vec as per spec
This commit is contained in:
Samson 2024-05-22 18:47:35 +02:00 committed by GitHub
parent 9f32809671
commit 794110ebe5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
37 changed files with 3401 additions and 725 deletions

View file

@ -270,17 +270,14 @@ impl GPUCommandEncoderMethods for GPUCommandEncoder {
.insert(DomRoot::from_ref(destination));
self.channel
.0
.send((
None,
WebGPURequest::CopyBufferToBuffer {
command_encoder_id: self.encoder.0,
source_id: source.id().0,
source_offset,
destination_id: destination.id().0,
destination_offset,
size,
},
))
.send(WebGPURequest::CopyBufferToBuffer {
command_encoder_id: self.encoder.0,
source_id: source.id().0,
source_offset,
destination_id: destination.id().0,
destination_offset,
size,
})
.expect("Failed to send CopyBufferToBuffer");
}
@ -302,17 +299,12 @@ impl GPUCommandEncoderMethods for GPUCommandEncoder {
self.channel
.0
.send((
None,
WebGPURequest::CopyBufferToTexture {
command_encoder_id: self.encoder.0,
source: convert_ic_buffer(source),
destination: convert_ic_texture(destination),
copy_size: convert_texture_size_to_wgt(&convert_texture_size_to_dict(
&copy_size,
)),
},
))
.send(WebGPURequest::CopyBufferToTexture {
command_encoder_id: self.encoder.0,
source: convert_ic_buffer(source),
destination: convert_ic_texture(destination),
copy_size: convert_texture_size_to_wgt(&convert_texture_size_to_dict(&copy_size)),
})
.expect("Failed to send CopyBufferToTexture");
}
@ -334,17 +326,12 @@ impl GPUCommandEncoderMethods for GPUCommandEncoder {
self.channel
.0
.send((
None,
WebGPURequest::CopyTextureToBuffer {
command_encoder_id: self.encoder.0,
source: convert_ic_texture(source),
destination: convert_ic_buffer(destination),
copy_size: convert_texture_size_to_wgt(&convert_texture_size_to_dict(
&copy_size,
)),
},
))
.send(WebGPURequest::CopyTextureToBuffer {
command_encoder_id: self.encoder.0,
source: convert_ic_texture(source),
destination: convert_ic_buffer(destination),
copy_size: convert_texture_size_to_wgt(&convert_texture_size_to_dict(&copy_size)),
})
.expect("Failed to send CopyTextureToBuffer");
}
@ -362,17 +349,12 @@ impl GPUCommandEncoderMethods for GPUCommandEncoder {
self.channel
.0
.send((
None,
WebGPURequest::CopyTextureToTexture {
command_encoder_id: self.encoder.0,
source: convert_ic_texture(source),
destination: convert_ic_texture(destination),
copy_size: convert_texture_size_to_wgt(&convert_texture_size_to_dict(
&copy_size,
)),
},
))
.send(WebGPURequest::CopyTextureToTexture {
command_encoder_id: self.encoder.0,
source: convert_ic_texture(source),
destination: convert_ic_texture(destination),
copy_size: convert_texture_size_to_wgt(&convert_texture_size_to_dict(&copy_size)),
})
.expect("Failed to send CopyTextureToTexture");
}
@ -380,16 +362,13 @@ impl GPUCommandEncoderMethods for GPUCommandEncoder {
fn Finish(&self, descriptor: &GPUCommandBufferDescriptor) -> DomRoot<GPUCommandBuffer> {
self.channel
.0
.send((
self.device.use_current_scope(),
WebGPURequest::CommandEncoderFinish {
command_encoder_id: self.encoder.0,
device_id: self.device.id().0,
is_error: !self.valid.get(),
// TODO(zakorgy): We should use `_descriptor` here after it's not empty
// and the underlying wgpu-core struct is serializable
},
))
.send(WebGPURequest::CommandEncoderFinish {
command_encoder_id: self.encoder.0,
device_id: self.device.id().0,
is_error: !self.valid.get(),
// 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;