Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/trunk' into cw/fix-timeout-handling
Browse files Browse the repository at this point in the history
# Conflicts:
#	wgpu/src/lib.rs
  • Loading branch information
cwfitzgerald committed Feb 10, 2025
2 parents 51f9ee9 + 7aaa0c3 commit e1ccc10
Show file tree
Hide file tree
Showing 13 changed files with 1,535 additions and 889 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,15 @@ By @cwfitzgerald in [#7030](https://github.com/gfx-rs/wgpu/pull/7030).
- Rename `instance_id` and `instance_custom_index` to `instance_index` and `instance_custom_data` by @Vecvec in
[#6780](https://github.com/gfx-rs/wgpu/pull/6780)
##### Split up `Features` internally
Internally split up the `Features` struct and recombine them internally using a macro. There should be no breaking
changes from this. This means there are also namespaces (as well as the old `Features::*`) for all wgpu specific
features and webgpu feature (`FeaturesWGPU` and `FeaturesWebGPU` respectively) and `Features::from_internal_flags` which
allow you to be explicit about whether features you need are available on the web too.
By @Vecvec in [#6905](https://github.com/gfx-rs/wgpu/pull/6905), [#7086](https://github.com/gfx-rs/wgpu/pull/7086)
##### Refactored internal trace path parameter
Refactored some functions to handle the internal trace path as a string to avoid possible issues with `no_std` support.
Expand Down Expand Up @@ -165,6 +174,10 @@ By @brodycj in [#6924](https://github.com/gfx-rs/wgpu/pull/6924).
- Added a hello window example. By @laycookie in [#6992](https://github.com/gfx-rs/wgpu/pull/6992).
### Examples
- Call `pre_present_notify()` before presenting. By @kjarosh in [#7074](https://github.com/gfx-rs/wgpu/pull/7074).
## v24.0.0 (2025-01-15)
### Major changes
Expand Down
94 changes: 62 additions & 32 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ noise = "0.9"
nv-flip = "0.1"
obj = "0.10"
# NOTE: once_cell/std is *required* for some commonly-used features, selecting this per crate
once_cell = { version = "1.20.2", default-features = false }
once_cell = { version = "1.20.3", default-features = false }
# Firefox has 3.4.0 vendored, so we allow that version in our dependencies
ordered-float = { version = ">=3,<=4.6", default-features = false }
parking_lot = "0.12.1"
Expand Down
1 change: 1 addition & 0 deletions examples/features/src/framework.rs
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ async fn start<E: Example>(title: &str) {
.unwrap()
.render(&view, &context.device, &context.queue);

window_loop.window.pre_present_notify();
frame.present();

window_loop.window.request_redraw();
Expand Down
1 change: 1 addition & 0 deletions examples/features/src/hello_triangle/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ async fn run(event_loop: EventLoop<()>, window: Window) {
}

queue.submit(Some(encoder.finish()));
window.pre_present_notify();
frame.present();
}
WindowEvent::CloseRequested => target.exit(),
Expand Down
1 change: 1 addition & 0 deletions examples/features/src/hello_windows/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ async fn run(event_loop: EventLoop<()>, viewports: Vec<(Arc<Window>, wgpu::Color
}

queue.submit(Some(encoder.finish()));
viewport.desc.window.pre_present_notify();
frame.present();
}
}
Expand Down
38 changes: 17 additions & 21 deletions examples/features/src/shadow/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{f32::consts, iter, ops::Range, sync::Arc};
use std::{f32::consts, iter, ops::Range};

use bytemuck::{Pod, Zeroable};
use wgpu::util::{align_to, DeviceExt};
Expand Down Expand Up @@ -80,8 +80,8 @@ struct Entity {
mx_world: glam::Mat4,
rotation_speed: f32,
color: wgpu::Color,
vertex_buf: Arc<wgpu::Buffer>,
index_buf: Arc<wgpu::Buffer>,
vertex_buf: wgpu::Buffer,
index_buf: wgpu::Buffer,
index_format: wgpu::IndexFormat,
index_count: usize,
uniform_offset: wgpu::DynamicOffset,
Expand Down Expand Up @@ -221,21 +221,17 @@ impl crate::framework::Example for Example {
// Create the vertex and index buffers
let vertex_size = size_of::<Vertex>();
let (cube_vertex_data, cube_index_data) = create_cube();
let cube_vertex_buf = Arc::new(device.create_buffer_init(
&wgpu::util::BufferInitDescriptor {
label: Some("Cubes Vertex Buffer"),
contents: bytemuck::cast_slice(&cube_vertex_data),
usage: wgpu::BufferUsages::VERTEX,
},
));
let cube_vertex_buf = device.create_buffer_init(&wgpu::util::BufferInitDescriptor {
label: Some("Cubes Vertex Buffer"),
contents: bytemuck::cast_slice(&cube_vertex_data),
usage: wgpu::BufferUsages::VERTEX,
});

let cube_index_buf = Arc::new(device.create_buffer_init(
&wgpu::util::BufferInitDescriptor {
label: Some("Cubes Index Buffer"),
contents: bytemuck::cast_slice(&cube_index_data),
usage: wgpu::BufferUsages::INDEX,
},
));
let cube_index_buf = device.create_buffer_init(&wgpu::util::BufferInitDescriptor {
label: Some("Cubes Index Buffer"),
contents: bytemuck::cast_slice(&cube_index_data),
usage: wgpu::BufferUsages::INDEX,
});

let (plane_vertex_data, plane_index_data) = create_plane(7);
let plane_vertex_buf = device.create_buffer_init(&wgpu::util::BufferInitDescriptor {
Expand Down Expand Up @@ -306,8 +302,8 @@ impl crate::framework::Example for Example {
mx_world: glam::Mat4::IDENTITY,
rotation_speed: 0.0,
color: wgpu::Color::WHITE,
vertex_buf: Arc::new(plane_vertex_buf),
index_buf: Arc::new(plane_index_buf),
vertex_buf: plane_vertex_buf,
index_buf: plane_index_buf,
index_format,
index_count: plane_index_data.len(),
uniform_offset: 0,
Expand All @@ -327,8 +323,8 @@ impl crate::framework::Example for Example {
mx_world,
rotation_speed: cube.rotation,
color: wgpu::Color::GREEN,
vertex_buf: Arc::clone(&cube_vertex_buf),
index_buf: Arc::clone(&cube_index_buf),
vertex_buf: cube_vertex_buf.clone(),
index_buf: cube_index_buf.clone(),
index_format,
index_count: cube_index_data.len(),
uniform_offset: ((i + 1) * uniform_alignment as usize) as _,
Expand Down
3 changes: 2 additions & 1 deletion examples/features/src/uniform_values/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ impl WgpuContext {
}

async fn run(event_loop: EventLoop<()>, window: Arc<Window>) {
let mut wgpu_context = Some(WgpuContext::new(window).await);
let mut wgpu_context = Some(WgpuContext::new(window.clone()).await);
// (6)
let mut state = Some(AppState::default());
let main_window_id = wgpu_context.as_ref().unwrap().window.id();
Expand Down Expand Up @@ -330,6 +330,7 @@ async fn run(event_loop: EventLoop<()>, window: Arc<Window>) {
render_pass.draw(0..3, 0..1);
}
wgpu_context_ref.queue.submit(Some(encoder.finish()));
window.pre_present_notify();
frame.present();
}
_ => {}
Expand Down
Loading

0 comments on commit e1ccc10

Please sign in to comment.