Skip to content

Commit

Permalink
Update wgpu to v22
Browse files Browse the repository at this point in the history
  • Loading branch information
jinleili committed Jul 19, 2024
1 parent 6509b00 commit 91ed41f
Show file tree
Hide file tree
Showing 15 changed files with 99 additions and 111 deletions.
Binary file not shown.
174 changes: 75 additions & 99 deletions Cargo.lock

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ members = ["wgpu-in-app", "app-surface", "cargo-so"]
default-members = ["wgpu-in-app"]

[workspace.dependencies]
bytemuck = { version = "1.14", features = ["derive"] }
bytemuck = { version = "1.16", features = ["derive"] }
cfg-if = "1.0"
glam = "0.27"
glam = "0.28"
log = "0.4"
noise = { version = "0.8", default-features = false }
pollster = "0.3"
rand = "0.7.2"
wgpu = "0.20"
wgpu = "22.0"
# wgpu = { git = "https://github.com/gfx-rs/wgpu", rev = "445fa6019b47079c9d336881dbee1c3be3ed4c38" }
# wgpu = { git = "https://github.com/jinleili/wgpu", branch="visionOS" }
winit = { version = "0.29.15" }
Expand All @@ -24,11 +24,11 @@ objc = "0.2.7"
core-graphics = "0.23.1"

# android target
android_logger = "0.13"
android_logger = "0.14"
jni = "0.21"
jni_fn = "0.1"
ndk-sys = "0.4.1"
ash = "0.37.3"
ash = "0.38"

# wasm target
web-sys = "0.3.69"
Expand Down
2 changes: 1 addition & 1 deletion app-surface/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "app-surface"
authors = ["jinleili"]
description = "Integrate wgpu into your existing iOS and Android apps."
edition = "2021"
version = "0.4.4"
version = "1.0.0"
rust-version = "1.76"
repository = "https://github.com/jinleili/wgpu-in-app"
keywords = ["android", "SurfaceView", "ios", "macos", "wgpu"]
Expand Down
8 changes: 4 additions & 4 deletions app-surface/src/ios.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,19 +97,19 @@ impl AppSurface {
}

fn get_scale_factor(obj: *mut Object) -> f32 {
let mut scale_factor: CGFloat = 1.0;
let mut _scale_factor: CGFloat = 1.0;
#[cfg(target_os = "macos")]
unsafe {
let window: *mut Object = msg_send![obj, window];
if !window.is_null() {
scale_factor = msg_send![window, backingScaleFactor];
_scale_factor = msg_send![window, backingScaleFactor];
}
};

#[cfg(target_os = "ios")]
{
scale_factor = unsafe { msg_send![obj, contentScaleFactor] };
_scale_factor = unsafe { msg_send![obj, contentScaleFactor] };
}

scale_factor as f32
_scale_factor as f32
}
1 change: 1 addition & 0 deletions app-surface/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ async fn request_device(
label: None,
required_features: adapter.features(),
required_limits: adapter.limits(),
memory_hints: wgpu::MemoryHints::Performance,
},
None,
)
Expand Down
2 changes: 1 addition & 1 deletion wgpu-in-app/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "wgpu-in-app"
authors = ["jinleili"]
version = "0.3.0"
version = "1.0.0"
edition = "2021"
rust-version = "1.76"

Expand Down
2 changes: 2 additions & 0 deletions wgpu-in-app/src/examples/boids.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ impl Boids {
depth_stencil: None,
multisample: wgpu::MultisampleState::default(),
multiview: None,
cache: None,
});

// create compute pipeline
Expand All @@ -166,6 +167,7 @@ impl Boids {
module: &compute_shader,
entry_point: "main",
compilation_options: Default::default(),
cache: None,
});

// buffer for the three 2d triangle vertices of each instance
Expand Down
2 changes: 2 additions & 0 deletions wgpu-in-app/src/examples/cube.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ impl Cube {
depth_stencil: None,
multisample: wgpu::MultisampleState::default(),
multiview: None,
cache: None,
});

let pipeline_wire = if device
Expand Down Expand Up @@ -305,6 +306,7 @@ impl Cube {
depth_stencil: None,
multisample: wgpu::MultisampleState::default(),
multiview: None,
cache: None,
});
Some(pipeline_wire)
} else {
Expand Down
1 change: 1 addition & 0 deletions wgpu-in-app/src/examples/hdr_image_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ impl HDRImageView {
depth_stencil: None,
multisample: wgpu::MultisampleState::default(),
multiview: None,
cache: None,
});

Self {
Expand Down
1 change: 1 addition & 0 deletions wgpu-in-app/src/examples/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use app_surface::AppSurface;

#[allow(dead_code)]
pub trait Example {
fn resize(&mut self, _app_surface: &AppSurface) {}
fn enter_frame(&mut self, app_surface: &AppSurface);
Expand Down
1 change: 1 addition & 0 deletions wgpu-in-app/src/examples/msaa_line.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ impl MSAALine {
..Default::default()
},
multiview: None,
cache: None,
});
let mut encoder =
device.create_render_bundle_encoder(&wgpu::RenderBundleEncoderDescriptor {
Expand Down
2 changes: 1 addition & 1 deletion wgpu-in-app/src/examples/point_gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ impl HexTerrainMesh {
let width = q_given_r(radius);
let half_width = (width / 2) as isize;
let mut map = HashMap::new();
let mut max = std::f32::NEG_INFINITY;
let mut max = f32::NEG_INFINITY;
for i in -half_width..=half_width {
let x_o = i as f32;
for j in -half_width..=half_width {
Expand Down
2 changes: 2 additions & 0 deletions wgpu-in-app/src/examples/shadow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,7 @@ impl Shadow {
}),
multisample: wgpu::MultisampleState::default(),
multiview: None,
cache: None,
});

Pass {
Expand Down Expand Up @@ -651,6 +652,7 @@ impl Shadow {
}),
multisample: wgpu::MultisampleState::default(),
multiview: None,
cache: None,
});

Pass {
Expand Down
2 changes: 2 additions & 0 deletions wgpu-in-app/src/examples/water.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,7 @@ impl Water {
// No multisampling is used.
multisample: wgpu::MultisampleState::default(),
multiview: None,
cache: None,
});

// Same idea as the water pipeline.
Expand Down Expand Up @@ -435,6 +436,7 @@ impl Water {
}),
multisample: wgpu::MultisampleState::default(),
multiview: None,
cache: None,
});

Self {
Expand Down

0 comments on commit 91ed41f

Please sign in to comment.