mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
[rs] Unwrap errors from transfer API
This commit is contained in:
@@ -27,14 +27,14 @@ vulkan = ["wgc/gfx-backend-vulkan"]
|
||||
package = "wgpu-core"
|
||||
version = "0.5"
|
||||
git = "https://github.com/gfx-rs/wgpu"
|
||||
rev = "01cf22c25adef14ee296af8d827fad3760a70a45"
|
||||
rev = "8a038ba66e70f47dac87ae767588d433eb22d0d0"
|
||||
features = ["raw-window-handle"]
|
||||
|
||||
[dependencies.wgt]
|
||||
package = "wgpu-types"
|
||||
version = "0.5"
|
||||
git = "https://github.com/gfx-rs/wgpu"
|
||||
rev = "01cf22c25adef14ee296af8d827fad3760a70a45"
|
||||
rev = "8a038ba66e70f47dac87ae767588d433eb22d0d0"
|
||||
|
||||
[dependencies]
|
||||
arrayvec = "0.5"
|
||||
|
||||
@@ -57,7 +57,7 @@ impl framework::Example for Example {
|
||||
|
||||
let compute_bind_group_layout =
|
||||
device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
||||
bindings: &[
|
||||
entries: &[
|
||||
wgpu::BindGroupLayoutEntry::new(
|
||||
0,
|
||||
wgpu::ShaderStage::COMPUTE,
|
||||
|
||||
@@ -134,7 +134,7 @@ impl framework::Example for Example {
|
||||
// Create pipeline layout
|
||||
let bind_group_layout = device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
||||
label: None,
|
||||
bindings: &[
|
||||
entries: &[
|
||||
wgpu::BindGroupLayoutEntry::new(
|
||||
0,
|
||||
wgpu::ShaderStage::VERTEX,
|
||||
|
||||
@@ -59,7 +59,7 @@ async fn execute_gpu(numbers: Vec<u32>) -> Vec<u32> {
|
||||
|
||||
let bind_group_layout = device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
||||
label: None,
|
||||
bindings: &[wgpu::BindGroupLayoutEntry::new(
|
||||
entries: &[wgpu::BindGroupLayoutEntry::new(
|
||||
0,
|
||||
wgpu::ShaderStage::COMPUTE,
|
||||
wgpu::BindingType::StorageBuffer {
|
||||
|
||||
@@ -81,7 +81,7 @@ impl Example {
|
||||
mip_count: u32,
|
||||
) {
|
||||
let bind_group_layout = device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
||||
bindings: &[
|
||||
entries: &[
|
||||
wgpu::BindGroupLayoutEntry::new(
|
||||
0,
|
||||
wgpu::ShaderStage::FRAGMENT,
|
||||
@@ -221,7 +221,7 @@ impl framework::Example for Example {
|
||||
|
||||
// Create pipeline layout
|
||||
let bind_group_layout = device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
||||
bindings: &[
|
||||
entries: &[
|
||||
wgpu::BindGroupLayoutEntry::new(
|
||||
0,
|
||||
wgpu::ShaderStage::VERTEX,
|
||||
|
||||
@@ -242,7 +242,7 @@ impl framework::Example for Example {
|
||||
|
||||
let local_bind_group_layout =
|
||||
device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
||||
bindings: &[wgpu::BindGroupLayoutEntry::new(
|
||||
entries: &[wgpu::BindGroupLayoutEntry::new(
|
||||
0,
|
||||
wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
||||
wgpu::BindingType::UniformBuffer {
|
||||
@@ -430,7 +430,7 @@ impl framework::Example for Example {
|
||||
// Create pipeline layout
|
||||
let bind_group_layout =
|
||||
device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
||||
bindings: &[wgpu::BindGroupLayoutEntry::new(
|
||||
entries: &[wgpu::BindGroupLayoutEntry::new(
|
||||
0, // global
|
||||
wgpu::ShaderStage::VERTEX,
|
||||
wgpu::BindingType::UniformBuffer {
|
||||
@@ -513,7 +513,7 @@ impl framework::Example for Example {
|
||||
// Create pipeline layout
|
||||
let bind_group_layout =
|
||||
device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
||||
bindings: &[
|
||||
entries: &[
|
||||
wgpu::BindGroupLayoutEntry::new(
|
||||
0, // global
|
||||
wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
||||
|
||||
@@ -44,7 +44,7 @@ impl framework::Example for Skybox {
|
||||
queue: &wgpu::Queue,
|
||||
) -> Self {
|
||||
let bind_group_layout = device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
||||
bindings: &[
|
||||
entries: &[
|
||||
wgpu::BindGroupLayoutEntry::new(
|
||||
0,
|
||||
wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
||||
|
||||
@@ -143,7 +143,7 @@ impl framework::Example for Example {
|
||||
|
||||
let bind_group_layout =
|
||||
device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
||||
bindings: &[wgpu::BindGroupLayoutEntry::new(
|
||||
entries: &[wgpu::BindGroupLayoutEntry::new(
|
||||
0,
|
||||
wgpu::ShaderStage::FRAGMENT,
|
||||
wgpu::BindingType::UniformBuffer {
|
||||
@@ -250,7 +250,7 @@ impl framework::Example for Example {
|
||||
|
||||
let bind_group_layout = device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
||||
label: Some("bind group layout"),
|
||||
bindings: &[
|
||||
entries: &[
|
||||
wgpu::BindGroupLayoutEntry {
|
||||
count: Some(2),
|
||||
..wgpu::BindGroupLayoutEntry::new(
|
||||
|
||||
@@ -351,7 +351,7 @@ impl framework::Example for Example {
|
||||
let water_bind_group_layout =
|
||||
device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
||||
label: Some("Water Bind Group Layout"),
|
||||
bindings: &[
|
||||
entries: &[
|
||||
// Uniform variables such as projection/view.
|
||||
wgpu::BindGroupLayoutEntry::new(
|
||||
0,
|
||||
@@ -395,7 +395,7 @@ impl framework::Example for Example {
|
||||
let terrain_bind_group_layout =
|
||||
device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
||||
label: Some("Terrain Bind Group Layout"),
|
||||
bindings: &[
|
||||
entries: &[
|
||||
// Regular uniform variables like view/projection.
|
||||
wgpu::BindGroupLayoutEntry::new(
|
||||
0,
|
||||
|
||||
@@ -570,7 +570,7 @@ impl crate::Context for Context {
|
||||
&bm::BindGroupDescriptor {
|
||||
label: desc.label,
|
||||
layout: desc.layout.id,
|
||||
bindings: &bindings,
|
||||
entries: &bindings,
|
||||
},
|
||||
PhantomData
|
||||
))
|
||||
@@ -898,6 +898,7 @@ impl crate::Context for Context {
|
||||
destination_offset,
|
||||
copy_size
|
||||
))
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn command_encoder_copy_buffer_to_texture(
|
||||
@@ -913,6 +914,7 @@ impl crate::Context for Context {
|
||||
&map_texture_copy_view(destination),
|
||||
©_size
|
||||
))
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn command_encoder_copy_texture_to_buffer(
|
||||
@@ -928,6 +930,7 @@ impl crate::Context for Context {
|
||||
&map_buffer_copy_view(destination),
|
||||
©_size
|
||||
))
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn command_encoder_copy_texture_to_texture(
|
||||
@@ -943,6 +946,7 @@ impl crate::Context for Context {
|
||||
&map_texture_copy_view(destination),
|
||||
©_size
|
||||
))
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn command_encoder_begin_compute_pass(
|
||||
|
||||
@@ -827,7 +827,7 @@ impl crate::Context for Context {
|
||||
use web_sys::GpuBindingType as bt;
|
||||
|
||||
let mapped_bindings = desc
|
||||
.bindings
|
||||
.entries
|
||||
.iter()
|
||||
.map(|bind| {
|
||||
let mapped_type = match bind.ty {
|
||||
|
||||
Reference in New Issue
Block a user