mirror of
https://github.com/servo/servo.git
synced 2025-09-30 08:39:16 +01:00
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:
parent
9f32809671
commit
794110ebe5
37 changed files with 3401 additions and 725 deletions
|
@ -111,7 +111,7 @@ pub struct GPUCanvasContext {
|
|||
impl GPUCanvasContext {
|
||||
fn new_inherited(canvas: HTMLCanvasElementOrOffscreenCanvas, channel: WebGPU) -> Self {
|
||||
let (sender, receiver) = ipc::channel().unwrap();
|
||||
if let Err(e) = channel.0.send((None, WebGPURequest::CreateContext(sender))) {
|
||||
if let Err(e) = channel.0.send(WebGPURequest::CreateContext(sender)) {
|
||||
warn!("Failed to send CreateContext ({:?})", e);
|
||||
}
|
||||
let external_id = receiver.recv().unwrap();
|
||||
|
@ -153,14 +153,11 @@ impl GPUCanvasContext {
|
|||
.wgpu_id_hub()
|
||||
.lock()
|
||||
.create_command_encoder_id(texture_id.backend());
|
||||
if let Err(e) = self.channel.0.send((
|
||||
None,
|
||||
WebGPURequest::SwapChainPresent {
|
||||
external_id: self.context_id.0,
|
||||
texture_id,
|
||||
encoder_id,
|
||||
},
|
||||
)) {
|
||||
if let Err(e) = self.channel.0.send(WebGPURequest::SwapChainPresent {
|
||||
external_id: self.context_id.0,
|
||||
texture_id,
|
||||
encoder_id,
|
||||
}) {
|
||||
warn!(
|
||||
"Failed to send UpdateWebrenderData({:?}) ({})",
|
||||
self.context_id, e
|
||||
|
@ -275,17 +272,14 @@ impl GPUCanvasContextMethods for GPUCanvasContext {
|
|||
|
||||
self.channel
|
||||
.0
|
||||
.send((
|
||||
None,
|
||||
WebGPURequest::CreateSwapChain {
|
||||
device_id: descriptor.device.id().0,
|
||||
buffer_ids,
|
||||
external_id: self.context_id.0,
|
||||
sender,
|
||||
image_desc,
|
||||
image_data,
|
||||
},
|
||||
))
|
||||
.send(WebGPURequest::CreateSwapChain {
|
||||
device_id: descriptor.device.id().0,
|
||||
buffer_ids,
|
||||
external_id: self.context_id.0,
|
||||
sender,
|
||||
image_desc,
|
||||
image_data,
|
||||
})
|
||||
.expect("Failed to create WebGPU SwapChain");
|
||||
|
||||
self.texture
|
||||
|
@ -298,13 +292,10 @@ impl GPUCanvasContextMethods for GPUCanvasContext {
|
|||
/// <https://gpuweb.github.io/gpuweb/#dom-gpucanvascontext-unconfigure>
|
||||
fn Unconfigure(&self) {
|
||||
if let Some(image_key) = self.webrender_image.take() {
|
||||
if let Err(e) = self.channel.0.send((
|
||||
None,
|
||||
WebGPURequest::DestroySwapChain {
|
||||
external_id: self.context_id.0,
|
||||
image_key,
|
||||
},
|
||||
)) {
|
||||
if let Err(e) = self.channel.0.send(WebGPURequest::DestroySwapChain {
|
||||
external_id: self.context_id.0,
|
||||
image_key,
|
||||
}) {
|
||||
warn!(
|
||||
"Failed to send DestroySwapChain-ImageKey({:?}) ({})",
|
||||
image_key, e
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue