Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Wgpu 0.18 #100

Merged
merged 2 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,083 changes: 637 additions & 446 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ default-members = ["neothesia"]
resolver = "2"

[workspace.dependencies]
wgpu = "0.17.1"
glyphon = { git = "https://github.com/grovesNL/glyphon.git", rev = "20f0f8fa80e0d0df4c63634ce9176fa489546ca9" }
wgpu = "0.18"
glyphon = { git = "https://github.com/grovesNL/glyphon.git", rev = "2caa9fc5e5923c1d827d177c3619cab7e9885b85" }
log = "0.4"
bytemuck = { version = "1.5", features = ["derive"] }
env_logger = "0.10"
Expand Down
4 changes: 3 additions & 1 deletion neothesia-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,12 @@ impl Recorder {
resolve_target: None,
ops: wgpu::Operations {
load: wgpu::LoadOp::Clear(bg_color),
store: true,
store: wgpu::StoreOp::Store,
},
})],
depth_stencil_attachment: None,
timestamp_writes: None,
occlusion_query_set: None,
});

self.waterfall.render(&self.transform_uniform, &mut rpass);
Expand Down
12 changes: 6 additions & 6 deletions neothesia/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ oxisynth = { version = "0.0.3", optional = true }
midi-file = { workspace = true }
midi-io = { path = "../midi-io" }

iced_style = {git = "https://github.com/iced-rs/iced.git", rev="bc9bb28b1ccd1248d63ccdfef2f57d7aa837abbb"}
iced_graphics = {git = "https://github.com/iced-rs/iced.git", rev="bc9bb28b1ccd1248d63ccdfef2f57d7aa837abbb"}
iced_core = {git = "https://github.com/iced-rs/iced.git", rev="bc9bb28b1ccd1248d63ccdfef2f57d7aa837abbb"}
iced_runtime = {git = "https://github.com/iced-rs/iced.git", rev="bc9bb28b1ccd1248d63ccdfef2f57d7aa837abbb"}
iced_wgpu = { git = "https://github.com/iced-rs/iced.git", rev="bc9bb28b1ccd1248d63ccdfef2f57d7aa837abbb", features = ["image"] }
iced_widget = { git = "https://github.com/iced-rs/iced.git", rev="bc9bb28b1ccd1248d63ccdfef2f57d7aa837abbb", features = ["image"] }
iced_style = {git = "https://github.com/iced-rs/iced.git", rev="86b877517feb15b2155c6cfef29246a3f281c8ae"}
iced_graphics = {git = "https://github.com/iced-rs/iced.git", rev="86b877517feb15b2155c6cfef29246a3f281c8ae"}
iced_core = {git = "https://github.com/iced-rs/iced.git", rev="86b877517feb15b2155c6cfef29246a3f281c8ae"}
iced_runtime = {git = "https://github.com/iced-rs/iced.git", rev="86b877517feb15b2155c6cfef29246a3f281c8ae"}
iced_wgpu = { git = "https://github.com/iced-rs/iced.git", rev="86b877517feb15b2155c6cfef29246a3f281c8ae", features = ["image"] }
iced_widget = { git = "https://github.com/iced-rs/iced.git", rev="86b877517feb15b2155c6cfef29246a3f281c8ae", features = ["image"] }

[[bin]]
name = "neothesia"
6 changes: 5 additions & 1 deletion neothesia/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,13 @@ impl Neothesia {
resolve_target: None,
ops: wgpu::Operations {
load: wgpu::LoadOp::Clear(bg_color),
store: true,
store: wgpu::StoreOp::Store,
},
})],

depth_stencil_attachment: None,
timestamp_writes: None,
occlusion_query_set: None,
});

self.game_scene.render(&self.target.transform, &mut rpass);
Expand Down Expand Up @@ -277,6 +279,8 @@ fn init(builder: winit::window::WindowBuilder) -> (EventLoop<NeothesiaEvent>, Ta
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
backends: wgpu_jumpstart::default_backends(),
dx12_shader_compiler: wgpu::Dx12Compiler::default(),
flags: wgpu::InstanceFlags::default(),
gles_minor_version: wgpu::Gles3MinorVersion::Automatic,
});

let size = window.inner_size();
Expand Down
16 changes: 11 additions & 5 deletions neothesia/src/scene/menu_scene/iced_menu/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ impl<'a> Step {
PlayerConfig::Human => 2,
};

let color = if (track.has_drums && !track.has_other_than_drums) || !visible {
let color = if !visible {
iced_core::Color::from_rgb8(102, 102, 102)
} else {
let color_id = track.track_color_id % target.config.color_schema.len();
Expand Down Expand Up @@ -500,14 +500,20 @@ impl<'a> Step {
.active(active)
.active_color(color)
.build();

let card = track_card::track_card()
.title(name)
.subtitle(format!("{} Notes", track.notes.len()))
.track_color(color)
.body(body)
.on_icon_press(Message::TrackVisibilityConfig(track.track_id, !visible))
.build();
tracks.push(card.into());
.body(body);

let card = if track.has_drums && !track.has_other_than_drums {
card
} else {
card.on_icon_press(Message::TrackVisibilityConfig(track.track_id, !visible))
};

tracks.push(card.build().into());
}
}

Expand Down
31 changes: 16 additions & 15 deletions neothesia/src/song.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#[derive(Debug, Default, Clone)]
use midi_file::MidiTrack;

#[derive(Debug, Clone)]
pub enum PlayerConfig {
Mute,
#[default]
Auto,
Human,
}
Expand All @@ -13,24 +14,24 @@ pub struct TrackConfig {
pub visible: bool,
}

impl TrackConfig {
fn new(track_id: usize) -> Self {
Self {
track_id,
player: PlayerConfig::default(),
visible: true,
}
}
}

#[derive(Debug, Clone)]
pub struct SongConfig {
pub tracks: Box<[TrackConfig]>,
}

impl SongConfig {
fn new(tracks_count: usize) -> Self {
let tracks: Vec<_> = (0..tracks_count).map(TrackConfig::new).collect();
fn new(tracks: &[MidiTrack]) -> Self {
let tracks: Vec<_> = tracks
.iter()
.map(|t| {
let is_drums = t.has_drums && !t.has_other_than_drums;
TrackConfig {
track_id: t.track_id,
player: PlayerConfig::Auto,
visible: !is_drums,
}
})
.collect();
Self {
tracks: tracks.into(),
}
Expand All @@ -45,7 +46,7 @@ pub struct Song {

impl Song {
pub fn new(file: midi_file::MidiFile) -> Self {
let config = SongConfig::new(file.tracks.len());
let config = SongConfig::new(&file.tracks);
Self { file, config }
}
}
4 changes: 3 additions & 1 deletion wgpu-jumpstart/src/gpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,12 @@ impl Gpu {
b: rgb[2] as f64,
a: 1.0,
}),
store: true,
store: wgpu::StoreOp::Store,
},
})],
depth_stencil_attachment: None,
timestamp_writes: None,
occlusion_query_set: None,
});
}

Expand Down
Loading