Skip to content

Commit

Permalink
WIP: Upgrade wgpu to version 0.18 (#528)
Browse files Browse the repository at this point in the history
* Changes related to upgrading wgpu to version 0.18

* Fixed scene viewer sample for wasm

* Applied auto formatter

* Finish updating to 0.18

* Rust version

* Send/Sync Issues

* Deny

* Cargo nextest

* Improve

---------

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
  • Loading branch information
svermeulen and cwfitzgerald authored Nov 27, 2023
1 parent ed38b90 commit f0df67c
Show file tree
Hide file tree
Showing 42 changed files with 236 additions and 556 deletions.
5 changes: 5 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
[alias]
rend3-doc = ["doc", "--no-deps", "--lib", "--workspace", "--exclude", "scene-viewer", "--exclude", "rend3-cube-example"]

[build]
rustflags = [
"--cfg=web_sys_unstable_apis"
]
37 changes: 16 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,17 @@ jobs:
name: ${{ matrix.name }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Rust toolchain
id: setup-rust
run: |
rustup toolchain install 1.71 -c clippy -t ${{ matrix.target }}
rustup toolchain install 1.72 -c clippy -t ${{ matrix.target }}
- name: Install cargo-nextest and cargo-llvm-cov
uses: taiki-e/install-action@v2
with:
tool: cargo-nextest

- name: caching
uses: Swatinem/rust-cache@v2
Expand All @@ -51,36 +56,26 @@ jobs:

- name: build
run: |
cargo +1.71 build --target ${{ matrix.target }} --profile ci
cargo +1.72 build --target ${{ matrix.target }} --profile ci
if: matrix.target != 'wasm32-unknown-unknown'

- name: build (no imgui)
run: |
cargo +1.71 build --target ${{ matrix.target }} --profile ci --workspace --exclude rend3-imgui --exclude rend3-imgui-example
if: matrix.target == 'wasm32-unknown-unknown'

- name: test
run: |
cargo +1.71 test --target ${{ matrix.target }} --profile ci
cargo +1.72 nextest run --target ${{ matrix.target }} --cargo-profile ci
if: matrix.target != 'wasm32-unknown-unknown'

- name: clippy (rend3-gltf featureless)
run: |
cargo +1.71 clippy --target ${{ matrix.target }} --profile ci -p rend3-gltf --no-default-features
cargo +1.72 clippy --target ${{ matrix.target }} --profile ci -p rend3-gltf --no-default-features
- name: clippy
run: |
cargo +1.71 clippy --target ${{ matrix.target }} --profile ci
cargo +1.72 clippy --target ${{ matrix.target }} --profile ci
if: matrix.target != 'wasm32-unknown-unknown'

- name: clippy (no imgui)
run: |
cargo +1.71 clippy --target ${{ matrix.target }} --profile ci --workspace --exclude rend3-imgui --exclude rend3-imgui-example
if: matrix.target == 'wasm32-unknown-unknown'

- name: doc
run: |
cargo +1.71 doc --target ${{ matrix.target }} --profile ci --no-deps
cargo +1.72 doc --target ${{ matrix.target }} --profile ci --no-deps
if: matrix.target != 'wasm32-unknown-unknown'

- uses: actions/upload-artifact@v3
Expand All @@ -94,21 +89,21 @@ jobs:
cargo-fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Rust toolchain
id: setup-rust
run: |
rustup toolchain install 1.71 -c rustfmt
rustup toolchain install 1.72 -c rustfmt
- name: format
run: |
cargo +1.71 fmt --check
cargo +1.72 fmt --check
cargo-deny:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: EmbarkStudios/cargo-deny-action@v1
with:
log-level: warn
Expand Down
2 changes: 0 additions & 2 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
max_width = 120
use_field_init_shorthand = true
use_try_shorthand = true
imports_granularity = "Crate"
group_imports = "StdExternalCrate"
edition = "2021"
2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ members = [
"examples/cube",
"examples/cube-no-framework",
"examples/egui",
"examples/imgui",
"examples/scene-viewer",
"examples/skinning",
"examples/static-gltf",
Expand All @@ -15,7 +14,6 @@ members = [
"rend3-egui",
"rend3-framework",
"rend3-gltf",
"rend3-imgui",
"rend3-routine",
"rend3-test",
"rend3-types"
Expand Down
8 changes: 4 additions & 4 deletions examples/egui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ path = "src/main.rs"

[dependencies]
# The egui immediate mode gui library
egui = "0.22.0"
egui = "0.24.0"
# Winit integration with egui (turn off the clipboard feature)
egui-winit = { version = "0.22", default-features = false, features = ["links", "wayland"] }
egui-winit = { version = "0.24", default-features = false, features = ["links", "wayland"] }
# logging
env_logger = { version = "0.10", default-features = false, features = ["auto-color", "humantime"] }
# Linear algebra library
Expand All @@ -37,8 +37,8 @@ winit = "0.28"
# Opening URL's
webbrowser = "0.8.2"
# Creating textures
wgpu = "0.16"
wgpu = "0.18"

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
# Winit integration with egui
egui-winit = { version = "0.22", default-features = false, features = ["clipboard", "links", "wayland"] }
egui-winit = { version = "0.24", default-features = false, features = ["clipboard", "links", "wayland"] }
19 changes: 13 additions & 6 deletions examples/egui/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl rend3_framework::App for EguiExample {

fn setup(
&mut self,
event_loop: &winit::event_loop::EventLoop<rend3_framework::UserResizeEvent<()>>,
_event_loop: &winit::event_loop::EventLoop<rend3_framework::UserResizeEvent<()>>,
window: &winit::window::Window,
renderer: &Arc<rend3::Renderer>,
_routines: &Arc<rend3_framework::DefaultRoutines>,
Expand Down Expand Up @@ -104,8 +104,12 @@ impl rend3_framework::App for EguiExample {
// Create the egui context
let context = egui::Context::default();
// Create the winit/egui integration.
let mut platform = egui_winit::State::new(event_loop);
platform.set_pixels_per_point(window.scale_factor() as f32);
let platform = egui_winit::State::new(
egui::ViewportId::default(),
&window,
Some(window.scale_factor() as f32),
None,
);

//Images
let image_bytes = include_bytes!("images/rust-logo-128x128-blk.png");
Expand Down Expand Up @@ -173,7 +177,10 @@ impl rend3_framework::App for EguiExample {
}
ui.label("Want to get rusty?");
if ui
.add(egui::widgets::ImageButton::new(self.rust_logo, egui::Vec2::splat(64.0)))
.add(egui::widgets::ImageButton::new((
self.rust_logo,
egui::Vec2::splat(64.0),
)))
.clicked()
{
webbrowser::open("https://www.rust-lang.org").expect("failed to open URL");
Expand All @@ -185,7 +192,7 @@ impl rend3_framework::App for EguiExample {
let egui::FullOutput {
shapes, textures_delta, ..
} = data.context.end_frame();
let paint_jobs = data.context.tessellate(shapes);
let paint_jobs = data.context.tessellate(shapes, window.scale_factor() as f32);

let input = rend3_egui::Input {
clipped_meshes: &paint_jobs,
Expand Down Expand Up @@ -241,7 +248,7 @@ impl rend3_framework::App for EguiExample {
}
rend3_framework::Event::WindowEvent { event, .. } => {
// Pass the window events to the egui integration.
if data.platform.on_event(&data.context, &event).consumed {
if data.platform.on_window_event(&data.context, &event).consumed {
return;
}

Expand Down
34 changes: 0 additions & 34 deletions examples/imgui/Cargo.toml

This file was deleted.

Binary file removed examples/imgui/screenshot.png
Binary file not shown.
Loading

0 comments on commit f0df67c

Please sign in to comment.