Skip to content

Commit

Permalink
Update to wgpu 0.20
Browse files Browse the repository at this point in the history
  • Loading branch information
jinleili committed Apr 29, 2024
1 parent 9ef75e4 commit 70b98a1
Show file tree
Hide file tree
Showing 12 changed files with 171 additions and 211 deletions.
Binary file not shown.
341 changes: 142 additions & 199 deletions Cargo.lock

Large diffs are not rendered by default.

15 changes: 7 additions & 8 deletions Cargo.toml
Expand Up @@ -6,18 +6,17 @@ default-members = ["wgpu-in-app"]
[workspace.dependencies]
bytemuck = { version = "1.14", features = ["derive"] }
cfg-if = "1.0"
glam = "0.25"
glam = "0.27"
log = "0.4"
noise = { version = "0.8", default-features = false }
pollster = "0.3"
rand = "0.7.2"
wgpu = "0.19.3"
wgpu = "0.20"
# wgpu = { git = "https://github.com/gfx-rs/wgpu", rev = "445fa6019b47079c9d336881dbee1c3be3ed4c38" }
# wgpu = { git = "https://github.com/jinleili/wgpu", branch="visionOS" }
async-executor = "1.6"
winit = { version = "0.29.10" }
winit = { version = "0.29.15" }
raw-window-handle = "0.6"
env_logger = "0.10"
env_logger = "0.11"

# macOS, iOS
libc = "0.2"
Expand All @@ -32,7 +31,7 @@ ndk-sys = "0.4.1"
ash = "0.37.3"

# wasm target
web-sys = "0.3.67"
web-sys = "0.3.69"
wasm-bindgen = "0.2.87"
js-sys = "0.3.67"
wasm-bindgen-futures = "0.4.40"
js-sys = "0.3.69"
wasm-bindgen-futures = "0.4.42"
1 change: 0 additions & 1 deletion app-surface/Cargo.toml
Expand Up @@ -24,7 +24,6 @@ pollster.workspace = true
wgpu.workspace = true

[target.'cfg(any(target_os = "macos", target_os = "windows", target_os = "linux"))'.dependencies]
async-executor.workspace = true
winit.workspace = true

[target.'cfg(target_os = "macos")'.dependencies]
Expand Down
2 changes: 2 additions & 0 deletions app-surface/src/app_surface.rs
Expand Up @@ -79,6 +79,8 @@ impl AppSurface {
backends,
..Default::default()
});
println!("{backends:?}, {instance:?}, {:?}", view_setting.physical_size,);

cfg_if::cfg_if! {
if #[cfg(target_arch = "wasm32")] {
let surface = if is_offscreen_canvas {
Expand Down
1 change: 0 additions & 1 deletion wgpu-in-app/Cargo.toml
Expand Up @@ -27,7 +27,6 @@ rand.workspace = true
wgpu.workspace = true

[target.'cfg(any(target_os = "macos", target_os = "windows", target_os = "linux"))'.dependencies]
async-executor.workspace = true
winit.workspace = true

[target.'cfg(target_os = "ios")'.dependencies]
Expand Down
7 changes: 5 additions & 2 deletions wgpu-in-app/src/examples/boids.rs
Expand Up @@ -133,6 +133,7 @@ impl Boids {
vertex: wgpu::VertexState {
module: &draw_shader,
entry_point: "main_vs",
compilation_options: Default::default(),
buffers: &[
wgpu::VertexBufferLayout {
array_stride: 4 * 4,
Expand All @@ -149,6 +150,7 @@ impl Boids {
fragment: Some(wgpu::FragmentState {
module: &draw_shader,
entry_point: "main_fs",
compilation_options: Default::default(),
targets: &[Some(config.format.into())],
}),
primitive: wgpu::PrimitiveState::default(),
Expand All @@ -163,6 +165,7 @@ impl Boids {
layout: Some(&compute_pipeline_layout),
module: &compute_shader,
entry_point: "main",
compilation_options: Default::default(),
});

// buffer for the three 2d triangle vertices of each instance
Expand Down Expand Up @@ -273,8 +276,8 @@ impl Example for Boids {
command_encoder.push_debug_group("compute boid movement");
{
// compute pass
let mut cpass = command_encoder
.begin_compute_pass(&wgpu::ComputePassDescriptor::default());
let mut cpass =
command_encoder.begin_compute_pass(&wgpu::ComputePassDescriptor::default());
cpass.set_pipeline(&self.compute_pipeline);
cpass.set_bind_group(0, &self.particle_bind_groups[self.frame_num % 2], &[]);
cpass.dispatch_workgroups(self.work_group_count, 1, 1);
Expand Down
4 changes: 4 additions & 0 deletions wgpu-in-app/src/examples/cube.rs
Expand Up @@ -248,11 +248,13 @@ impl Cube {
vertex: wgpu::VertexState {
module: &shader,
entry_point: "vs_main",
compilation_options: Default::default(),
buffers: &vertex_buffers,
},
fragment: Some(wgpu::FragmentState {
module: &shader,
entry_point: "fs_main",
compilation_options: Default::default(),
targets: &[Some(config.format.into())],
}),
primitive: wgpu::PrimitiveState {
Expand All @@ -274,11 +276,13 @@ impl Cube {
vertex: wgpu::VertexState {
module: &shader,
entry_point: "vs_main",
compilation_options: Default::default(),
buffers: &vertex_buffers,
},
fragment: Some(wgpu::FragmentState {
module: &shader,
entry_point: "fs_wire",
compilation_options: Default::default(),
targets: &[Some(wgpu::ColorTargetState {
format: config.format,
blend: Some(wgpu::BlendState {
Expand Down
2 changes: 2 additions & 0 deletions wgpu-in-app/src/examples/hdr_image_view.rs
Expand Up @@ -118,11 +118,13 @@ impl HDRImageView {
vertex: wgpu::VertexState {
module: &shader_module,
entry_point: "vs_main",
compilation_options: Default::default(),
buffers: &pipeline_vertex_buffers,
},
fragment: Some(wgpu::FragmentState {
module: &shader_module,
entry_point: "fs_main",
compilation_options: Default::default(),
targets: &[Some(wgpu::ColorTargetState {
format: hdr_pixel_format,
blend: None,
Expand Down
2 changes: 2 additions & 0 deletions wgpu-in-app/src/examples/msaa_line.rs
Expand Up @@ -153,6 +153,7 @@ impl MSAALine {
vertex: wgpu::VertexState {
module: shader,
entry_point: "vs_main",
compilation_options: Default::default(),
buffers: &[wgpu::VertexBufferLayout {
array_stride: std::mem::size_of::<Vertex>() as wgpu::BufferAddress,
step_mode: wgpu::VertexStepMode::Vertex,
Expand All @@ -162,6 +163,7 @@ impl MSAALine {
fragment: Some(wgpu::FragmentState {
module: shader,
entry_point: "fs_main",
compilation_options: Default::default(),
targets: &[Some(config.format.add_srgb_suffix().into())],
}),
primitive: wgpu::PrimitiveState {
Expand Down
3 changes: 3 additions & 0 deletions wgpu-in-app/src/examples/shadow.rs
Expand Up @@ -499,6 +499,7 @@ impl Shadow {
vertex: wgpu::VertexState {
module: &shader,
entry_point: "vs_bake",
compilation_options: Default::default(),
buffers: &[vb_desc.clone()],
},
fragment: None,
Expand Down Expand Up @@ -627,11 +628,13 @@ impl Shadow {
vertex: wgpu::VertexState {
module: &shader,
entry_point: "vs_main",
compilation_options: Default::default(),
buffers: &[vb_desc],
},
fragment: Some(wgpu::FragmentState {
module: &shader,
entry_point: "fs_main",
compilation_options: Default::default(),
targets: &[Some(config.format.into())],
}),
primitive: wgpu::PrimitiveState {
Expand Down
4 changes: 4 additions & 0 deletions wgpu-in-app/src/examples/water.rs
Expand Up @@ -337,6 +337,7 @@ impl Water {
vertex: wgpu::VertexState {
module: &water_module,
entry_point: "vs_main",
compilation_options: Default::default(),
// Layout of our vertices. This should match the structs
// which are uploaded to the GPU. This should also be
// ensured by tagging on either a `#[repr(C)]` onto a
Expand All @@ -352,6 +353,7 @@ impl Water {
fragment: Some(wgpu::FragmentState {
module: &water_module,
entry_point: "fs_main",
compilation_options: Default::default(),
// Describes how the colour will be interpolated
// and assigned to the output attachment.
targets: &[Some(wgpu::ColorTargetState {
Expand Down Expand Up @@ -406,6 +408,7 @@ impl Water {
vertex: wgpu::VertexState {
module: &terrain_module,
entry_point: "vs_main",
compilation_options: Default::default(),
buffers: &[wgpu::VertexBufferLayout {
array_stride: terrain_vertex_size as wgpu::BufferAddress,
step_mode: wgpu::VertexStepMode::Vertex,
Expand All @@ -415,6 +418,7 @@ impl Water {
fragment: Some(wgpu::FragmentState {
module: &terrain_module,
entry_point: "fs_main",
compilation_options: Default::default(),
targets: &[Some(config.format.into())],
}),
primitive: wgpu::PrimitiveState {
Expand Down

0 comments on commit 70b98a1

Please sign in to comment.