From 01c8b24e9fdb3812f7c8e788a503071395387d6f Mon Sep 17 00:00:00 2001 From: Kunal Mohan Date: Thu, 6 Aug 2020 00:21:45 +0530 Subject: [PATCH] update wgpu --- Cargo.lock | 4 ++-- components/script/dom/gputexture.rs | 5 +++-- components/webgpu/lib.rs | 21 ++++++++++----------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 286fb644bfa..24bcfab54ed 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6945,7 +6945,7 @@ dependencies = [ [[package]] name = "wgpu-core" version = "0.5.0" -source = "git+https://github.com/gfx-rs/wgpu#872a6c4c2bab5591838219c34e0cbf5fa9c2ec85" +source = "git+https://github.com/gfx-rs/wgpu#8057acf120f9944056a6b5de6cf326f18ae7671d" dependencies = [ "arrayvec 0.5.1", "bitflags", @@ -6972,7 +6972,7 @@ dependencies = [ [[package]] name = "wgpu-types" version = "0.5.0" -source = "git+https://github.com/gfx-rs/wgpu#872a6c4c2bab5591838219c34e0cbf5fa9c2ec85" +source = "git+https://github.com/gfx-rs/wgpu#8057acf120f9944056a6b5de6cf326f18ae7671d" dependencies = [ "bitflags", "serde", diff --git a/components/script/dom/gputexture.rs b/components/script/dom/gputexture.rs index 64b56e82607..977aa0efc7c 100644 --- a/components/script/dom/gputexture.rs +++ b/components/script/dom/gputexture.rs @@ -16,6 +16,7 @@ use crate::dom::globalscope::GlobalScope; use crate::dom::gpudevice::{convert_texture_format, convert_texture_view_dimension, GPUDevice}; use crate::dom::gputextureview::GPUTextureView; use dom_struct::dom_struct; +use std::num::NonZeroU32; use std::string::String; use webgpu::{wgt, WebGPU, WebGPURequest, WebGPUTexture, WebGPUTextureView}; @@ -152,9 +153,9 @@ impl GPUTextureMethods for GPUTexture { GPUTextureAspect::Depth_only => wgt::TextureAspect::DepthOnly, }, base_mip_level: descriptor.baseMipLevel, - level_count: descriptor.mipLevelCount.as_ref().copied(), + level_count: descriptor.mipLevelCount.and_then(NonZeroU32::new), base_array_layer: descriptor.baseArrayLayer, - array_layer_count: descriptor.arrayLayerCount.as_ref().copied(), + array_layer_count: descriptor.arrayLayerCount.and_then(NonZeroU32::new), }; let texture_view_id = self diff --git a/components/webgpu/lib.rs b/components/webgpu/lib.rs index 7e20e30d4d6..451dbb9fed1 100644 --- a/components/webgpu/lib.rs +++ b/components/webgpu/lib.rs @@ -744,7 +744,7 @@ impl<'a> WGPU<'a> { }, WebGPURequest::DestroyBuffer(buffer) => { let global = &self.global; - gfx_select!(buffer => global.buffer_destroy(buffer, false)); + gfx_select!(buffer => global.buffer_drop(buffer, false)); }, WebGPURequest::DestroySwapChain { external_id, @@ -758,10 +758,10 @@ impl<'a> WGPU<'a> { .unwrap(); let global = &self.global; for b_id in data.available_buffer_ids.iter() { - gfx_select!(b_id => global.buffer_destroy(*b_id, false)); + gfx_select!(b_id => global.buffer_drop(*b_id, false)); } for b_id in data.queued_buffer_ids.iter() { - gfx_select!(b_id => global.buffer_destroy(*b_id, false)); + gfx_select!(b_id => global.buffer_drop(*b_id, false)); } for b_id in data.unassigned_buffer_ids.iter() { if let Err(e) = self.script_sender.send(WebGPUMsg::FreeBuffer(*b_id)) { @@ -775,7 +775,7 @@ impl<'a> WGPU<'a> { }, WebGPURequest::DestroyTexture(texture) => { let global = &self.global; - gfx_select!(texture => global.texture_destroy(texture)); + gfx_select!(texture => global.texture_drop(texture)); }, WebGPURequest::Exit(sender) => { if let Err(e) = self.script_sender.send(WebGPUMsg::Exit) { @@ -823,15 +823,13 @@ impl<'a> WGPU<'a> { options, ids, } => { - let adapter_id = match self.global.pick_adapter( + let adapter_id = match self.global.request_adapter( &options, wgpu::instance::AdapterInputs::IdSet(&ids, |id| id.backend()), ) { - Some(id) => id, - None => { - if let Err(e) = - sender.send(Err("Failed to get webgpu adapter".to_string())) - { + Ok(id) => id, + Err(w) => { + if let Err(e) = sender.send(Err(format!("{:?}", w))) { warn!( "Failed to send response to WebGPURequest::RequestAdapter ({})", e @@ -843,7 +841,8 @@ impl<'a> WGPU<'a> { let adapter = WebGPUAdapter(adapter_id); self.adapters.push(adapter); let global = &self.global; - let info = gfx_select!(adapter_id => global.adapter_get_info(adapter_id)); + let info = + gfx_select!(adapter_id => global.adapter_get_info(adapter_id)).unwrap(); if let Err(e) = sender.send(Ok(WebGPUResponse::RequestAdapter { adapter_name: info.name, adapter_id: adapter,