update wgpu

This commit is contained in:
Kunal Mohan 2020-08-06 00:21:45 +05:30
parent 6e28d7b3ec
commit 01c8b24e9f
3 changed files with 15 additions and 15 deletions

4
Cargo.lock generated
View file

@ -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",

View file

@ -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

View file

@ -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,