Skip to content

Commit b9bd37a

Browse files
authored
Fix issues #570, #575 (#576)
1 parent c7c2d85 commit b9bd37a

File tree

4 files changed

+27
-25
lines changed

4 files changed

+27
-25
lines changed

.github/workflows/ci.yml

+8-8
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
- name: Set up Rust toolchain
4242
id: setup-rust
4343
run: |
44-
rustup toolchain install 1.72 -c clippy -t ${{ matrix.target }}
44+
rustup toolchain install 1.76 -c clippy -t ${{ matrix.target }}
4545
4646
- name: Install cargo-nextest and cargo-llvm-cov
4747
uses: taiki-e/install-action@v2
@@ -56,21 +56,21 @@ jobs:
5656

5757
- name: build
5858
run: |
59-
cargo +1.72 build --target ${{ matrix.target }} --profile ci
59+
cargo +1.76 build --target ${{ matrix.target }} --profile ci
6060
if: matrix.target != 'wasm32-unknown-unknown'
6161

6262
- name: clippy (rend3-gltf featureless)
6363
run: |
64-
cargo +1.72 clippy --target ${{ matrix.target }} --profile ci -p rend3-gltf --no-default-features
64+
cargo +1.76 clippy --target ${{ matrix.target }} --profile ci -p rend3-gltf --no-default-features
6565
6666
- name: clippy
6767
run: |
68-
cargo +1.72 clippy --target ${{ matrix.target }} --profile ci
68+
cargo +1.76 clippy --target ${{ matrix.target }} --profile ci
6969
if: matrix.target != 'wasm32-unknown-unknown'
7070

7171
- name: doc
7272
run: |
73-
cargo +1.72 doc --target ${{ matrix.target }} --profile ci --no-deps
73+
cargo +1.76 doc --target ${{ matrix.target }} --profile ci --no-deps
7474
if: matrix.target != 'wasm32-unknown-unknown'
7575

7676
- name: download test resources
@@ -80,7 +80,7 @@ jobs:
8080
8181
- name: test
8282
run: |
83-
cargo +1.72 nextest run --target ${{ matrix.target }} --cargo-profile ci --no-fail-fast
83+
cargo +1.76 nextest run --target ${{ matrix.target }} --cargo-profile ci --no-fail-fast
8484
if: matrix.target != 'wasm32-unknown-unknown'
8585

8686
- uses: actions/upload-artifact@v4
@@ -101,11 +101,11 @@ jobs:
101101
- name: Set up Rust toolchain
102102
id: setup-rust
103103
run: |
104-
rustup toolchain install 1.72 -c rustfmt
104+
rustup toolchain install 1.76 -c rustfmt
105105
106106
- name: format
107107
run: |
108-
cargo +1.72 fmt --check
108+
cargo +1.76 fmt --check
109109
110110
cargo-deny:
111111
runs-on: ubuntu-latest

rend3-framework/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ pollster = "0.3"
3434
console_error_panic_hook = "0.1"
3535
console_log = "1"
3636
js-sys = "0.3"
37-
reqwest = "0.11"
3837
once_cell = "1.8"
3938
wasm-bindgen = "0.2.87"
4039
wasm-bindgen-futures = "0.4"

rend3-framework/src/assets.rs

-13
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,6 @@ pub enum AssetError {
1212
#[source]
1313
error: std::io::Error,
1414
},
15-
#[error("Could not read {path} from the network")]
16-
#[cfg(target_arch = "wasm32")]
17-
NetworkError {
18-
path: SsoString,
19-
#[source]
20-
error: reqwest::Error,
21-
},
22-
#[error("Reading {path} from the network returned non-success status code {status}")]
23-
#[cfg(target_arch = "wasm32")]
24-
NetworkStatusError {
25-
path: SsoString,
26-
status: reqwest::StatusCode,
27-
},
2815
}
2916

3017
pub enum AssetPath<'a> {

rend3-framework/src/lib.rs

+19-3
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,14 @@ pub trait App<T: 'static = ()> {
7171
console_log::init().unwrap();
7272

7373
#[cfg(all(not(target_arch = "wasm32"), not(target_os = "android")))]
74-
env_logger::builder()
74+
if let Err(e) = env_logger::builder()
7575
.filter_module("rend3", log::LevelFilter::Info)
7676
.parse_default_env()
77-
.init();
77+
.try_init()
78+
{
79+
eprintln!("Error registering logger from Rend3 framework: {:?}", e);
80+
// probably ran two runs in sequence and initialized twice
81+
};
7882
}
7983

8084
fn register_panic_hook(&mut self) {
@@ -134,15 +138,27 @@ pub trait App<T: 'static = ()> {
134138
1.0
135139
}
136140

141+
/// Set up the rendering environment. Called once at startup.
137142
fn setup(&mut self, context: SetupContext<'_, T>) {
138143
let _ = context;
139144
}
140145

146+
/// Handle a non-redraw event.
141147
fn handle_event(&mut self, context: EventContext<'_, T>, event: Event<T>) {
142148
let _ = (context, event);
143149
}
144150

151+
/// Handle a redraw event.
145152
fn handle_redraw(&mut self, context: RedrawContext<'_, T>);
153+
154+
/// Called after each redraw for post-processing, if needed.
155+
/// By default, this queues another redraw.
156+
/// That behavior is not appropriate on some platforms.
157+
/// Ref: Issue 570.
158+
/// This gives the application the option of overriding that behavior.
159+
fn handle_redraw_done(&mut self, window: &Window) {
160+
window.request_redraw(); // just queue a redraw.
161+
}
146162
}
147163

148164
pub fn lock<T>(lock: &parking_lot::Mutex<T>) -> parking_lot::MutexGuard<'_, T> {
@@ -369,7 +385,7 @@ pub async fn async_start<A: App<T> + 'static, T: 'static>(mut app: A, window_bui
369385

370386
surface_texture.present();
371387

372-
window.request_redraw();
388+
app.handle_redraw_done(&window); // standard action is to redraw, but that can be overridden.
373389
} else {
374390
app.handle_event(
375391
EventContext {

0 commit comments

Comments
 (0)