Skip to content

Commit c094ee8

Browse files
authored
Merge branch 'emilk:master' into cache_galley_lines
2 parents 17a5f1f + 046034f commit c094ee8

File tree

97 files changed

+1368
-328
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+1368
-328
lines changed

.github/workflows/cargo_machete.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ jobs:
99
- name: Checkout
1010
uses: actions/checkout@v3
1111
- name: Machete
12-
uses: bnjbvr/cargo-machete@main
12+
run: cargo install cargo-machete --locked && cargo machete

.github/workflows/deploy_web_demo.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
with:
4040
profile: minimal
4141
target: wasm32-unknown-unknown
42-
toolchain: 1.77.0
42+
toolchain: 1.79.0
4343
override: true
4444

4545
- uses: Swatinem/rust-cache@v2

.github/workflows/rust.yml

+7-7
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818

1919
- uses: dtolnay/rust-toolchain@master
2020
with:
21-
toolchain: 1.77.0
21+
toolchain: 1.79.0
2222

2323
- name: Install packages (Linux)
2424
if: runner.os == 'Linux'
@@ -83,7 +83,7 @@ jobs:
8383
- uses: actions/checkout@v4
8484
- uses: dtolnay/rust-toolchain@master
8585
with:
86-
toolchain: 1.77.0
86+
toolchain: 1.79.0
8787
targets: wasm32-unknown-unknown
8888

8989
- run: sudo apt-get update && sudo apt-get install libgtk-3-dev libatk1.0-dev
@@ -155,7 +155,7 @@ jobs:
155155
- uses: actions/checkout@v4
156156
- uses: EmbarkStudios/cargo-deny-action@v1
157157
with:
158-
rust-version: "1.77.0"
158+
rust-version: "1.79.0"
159159
log-level: error
160160
command: check
161161
arguments: --target ${{ matrix.target }}
@@ -170,7 +170,7 @@ jobs:
170170

171171
- uses: dtolnay/rust-toolchain@master
172172
with:
173-
toolchain: 1.77.0
173+
toolchain: 1.79.0
174174
targets: aarch64-linux-android
175175

176176
- name: Set up cargo cache
@@ -189,7 +189,7 @@ jobs:
189189

190190
- uses: dtolnay/rust-toolchain@master
191191
with:
192-
toolchain: 1.77.0
192+
toolchain: 1.79.0
193193
targets: aarch64-apple-ios
194194

195195
- name: Set up cargo cache
@@ -208,7 +208,7 @@ jobs:
208208
- uses: actions/checkout@v4
209209
- uses: dtolnay/rust-toolchain@master
210210
with:
211-
toolchain: 1.77.0
211+
toolchain: 1.79.0
212212

213213
- name: Set up cargo cache
214214
uses: Swatinem/rust-cache@v2
@@ -232,7 +232,7 @@ jobs:
232232
lfs: true
233233
- uses: dtolnay/rust-toolchain@master
234234
with:
235-
toolchain: 1.77.0
235+
toolchain: 1.79.0
236236

237237
- name: Set up cargo cache
238238
uses: Swatinem/rust-cache@v2

CODEOWNERS

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
/crates/egui_kittest @lucasmerlin
12
/crates/egui-wgpu @Wumpf

Cargo.lock

+8-8
Original file line numberDiff line numberDiff line change
@@ -2239,7 +2239,7 @@ checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc"
22392239
[[package]]
22402240
name = "kittest"
22412241
version = "0.1.0"
2242-
source = "git+https://github.com/rerun-io/kittest?branch=main#63c5b7d58178900e523428ca5edecbba007a2702"
2242+
source = "git+https://github.com/rerun-io/kittest?branch=main#06e01f17fed36a997e1541f37b2d47e3771d7533"
22432243
dependencies = [
22442244
"accesskit",
22452245
"accesskit_consumer",
@@ -4356,9 +4356,9 @@ checksum = "53a85b86a771b1c87058196170769dd264f66c0782acf1ae6cc51bfd64b39082"
43564356

43574357
[[package]]
43584358
name = "wgpu"
4359-
version = "23.0.0"
4359+
version = "23.0.1"
43604360
source = "registry+https://github.com/rust-lang/crates.io-index"
4361-
checksum = "76ab52f2d3d18b70d5ab8dd270a1cff3ebe6dbe4a7d13c1cc2557138a9777fdc"
4361+
checksum = "80f70000db37c469ea9d67defdc13024ddf9a5f1b89cb2941b812ad7cde1735a"
43624362
dependencies = [
43634363
"arrayvec",
43644364
"cfg_aliases 0.1.1",
@@ -4381,9 +4381,9 @@ dependencies = [
43814381

43824382
[[package]]
43834383
name = "wgpu-core"
4384-
version = "23.0.0"
4384+
version = "23.0.1"
43854385
source = "registry+https://github.com/rust-lang/crates.io-index"
4386-
checksum = "0e0c68e7b6322a03ee5b83fcd92caeac5c2a932f6457818179f4652ad2a9c065"
4386+
checksum = "d63c3c478de8e7e01786479919c8769f62a22eec16788d8c2ac77ce2c132778a"
43874387
dependencies = [
43884388
"arrayvec",
43894389
"bit-vec 0.8.0",
@@ -4406,9 +4406,9 @@ dependencies = [
44064406

44074407
[[package]]
44084408
name = "wgpu-hal"
4409-
version = "23.0.0"
4409+
version = "23.0.1"
44104410
source = "registry+https://github.com/rust-lang/crates.io-index"
4411-
checksum = "de6e7266b869de56c7e3ed72a954899f71d14fec6cc81c102b7530b92947601b"
4411+
checksum = "89364b8a0b211adc7b16aeaf1bd5ad4a919c1154b44c9ce27838213ba05fd821"
44124412
dependencies = [
44134413
"android_system_properties",
44144414
"arrayvec",
@@ -4478,7 +4478,7 @@ version = "0.1.9"
44784478
source = "registry+https://github.com/rust-lang/crates.io-index"
44794479
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
44804480
dependencies = [
4481-
"windows-sys 0.59.0",
4481+
"windows-sys 0.48.0",
44824482
]
44834483

44844484
[[package]]

Cargo.toml

+14-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ members = [
2323
[workspace.package]
2424
edition = "2021"
2525
license = "MIT OR Apache-2.0"
26-
rust-version = "1.77"
26+
rust-version = "1.79"
2727
version = "0.29.1"
2828

2929

@@ -145,6 +145,7 @@ disallowed_types = "warn" # See clippy.toml
145145
doc_link_with_quotes = "warn"
146146
doc_markdown = "warn"
147147
empty_enum = "warn"
148+
empty_enum_variants_with_brackets = "warn"
148149
enum_glob_use = "warn"
149150
equatable_if_let = "warn"
150151
exit = "warn"
@@ -169,6 +170,8 @@ inefficient_to_string = "warn"
169170
infinite_loop = "warn"
170171
into_iter_without_iter = "warn"
171172
invalid_upcast_comparisons = "warn"
173+
iter_filter_is_ok = "warn"
174+
iter_filter_is_some = "warn"
172175
iter_not_returning_iterator = "warn"
173176
iter_on_empty_collections = "warn"
174177
iter_on_single_items = "warn"
@@ -185,6 +188,7 @@ macro_use_imports = "warn"
185188
manual_assert = "warn"
186189
manual_clamp = "warn"
187190
manual_instant_elapsed = "warn"
191+
manual_is_variant_and = "warn"
188192
manual_let_else = "warn"
189193
manual_ok_or = "warn"
190194
manual_string_new = "warn"
@@ -202,6 +206,7 @@ mismatching_type_param_order = "warn"
202206
missing_enforced_import_renames = "warn"
203207
missing_errors_doc = "warn"
204208
missing_safety_doc = "warn"
209+
mixed_attributes_style = "warn"
205210
mut_mut = "warn"
206211
mutex_integer = "warn"
207212
needless_borrow = "warn"
@@ -211,21 +216,25 @@ needless_pass_by_ref_mut = "warn"
211216
needless_pass_by_value = "warn"
212217
negative_feature_names = "warn"
213218
nonstandard_macro_braces = "warn"
219+
option_as_ref_cloned = "warn"
214220
option_option = "warn"
215221
path_buf_push_overwrite = "warn"
216222
print_stderr = "warn"
217223
ptr_as_ptr = "warn"
218224
ptr_cast_constness = "warn"
225+
pub_underscore_fields = "warn"
219226
pub_without_shorthand = "warn"
220227
rc_mutex = "warn"
221228
readonly_write_lock = "warn"
222229
redundant_type_annotations = "warn"
230+
ref_as_ptr = "warn"
223231
ref_option_ref = "warn"
224232
ref_patterns = "warn"
225233
rest_pat_in_fully_bound_structs = "warn"
226234
same_functions_in_if_condition = "warn"
227235
semicolon_if_nothing_returned = "warn"
228236
single_match_else = "warn"
237+
str_split_at_newline = "warn"
229238
str_to_string = "warn"
230239
string_add = "warn"
231240
string_add_assign = "warn"
@@ -261,12 +270,15 @@ zero_sized_map_values = "warn"
261270

262271
# TODO(emilk): enable more of these lints:
263272
iter_over_hash_type = "allow"
264-
let_underscore_untyped = "allow"
265273
missing_assert_message = "allow"
266274
should_panic_without_expect = "allow"
267275
too_many_lines = "allow"
268276
unwrap_used = "allow" # TODO(emilk): We really wanna warn on this one
269277

278+
# These are meh:
279+
assigning_clones = "allow" # No please
280+
let_underscore_must_use = "allow"
281+
let_underscore_untyped = "allow"
270282
manual_range_contains = "allow" # this one is just worse imho
271283
self_named_module_files = "allow" # Disabled waiting on https://github.com/rust-lang/rust-clippy/issues/9602
272284
significant_drop_tightening = "allow" # Too many false positives

clippy.toml

+5-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# -----------------------------------------------------------------------------
44
# Section identical to scripts/clippy_wasm/clippy.toml:
55

6-
msrv = "1.77"
6+
msrv = "1.79"
77

88
allow-unwrap-in-tests = true
99

@@ -69,9 +69,12 @@ disallowed-types = [
6969

7070
# Allow-list of words for markdown in docstrings https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
7171
doc-valid-idents = [
72-
# You must also update the same list in the root `clippy.toml`!
72+
# You must also update the same list in `scripts/clippy_wasm/clippy.toml`!
7373
"AccessKit",
7474
"WebGL",
75+
"WebGL1",
76+
"WebGL2",
7577
"WebGPU",
78+
"VirtualBox",
7679
"..",
7780
]

crates/ecolor/src/color32.rs

+15
Original file line numberDiff line numberDiff line change
@@ -269,3 +269,18 @@ impl Color32 {
269269
)
270270
}
271271
}
272+
273+
impl std::ops::Mul for Color32 {
274+
type Output = Self;
275+
276+
/// Fast gamma-space multiplication.
277+
#[inline]
278+
fn mul(self, other: Self) -> Self {
279+
Self([
280+
fast_round(self[0] as f32 * other[0] as f32 / 255.0),
281+
fast_round(self[1] as f32 * other[1] as f32 / 255.0),
282+
fast_round(self[2] as f32 * other[2] as f32 / 255.0),
283+
fast_round(self[3] as f32 * other[3] as f32 / 255.0),
284+
])
285+
}
286+
}

crates/eframe/src/epi.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ pub struct WebOptions {
439439
/// Unused by webgl context as of writing.
440440
pub depth_buffer: u8,
441441

442-
/// Which version of WebGl context to select
442+
/// Which version of WebGL context to select
443443
///
444444
/// Default: [`WebGlContextOption::BestFirst`].
445445
#[cfg(feature = "glow")]

crates/eframe/src/native/event_loop_context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ impl EventLoopGuard {
1414
cell.get().is_none(),
1515
"Attempted to set a new event loop while one is already set"
1616
);
17-
cell.set(Some(event_loop as *const ActiveEventLoop));
17+
cell.set(Some(std::ptr::from_ref::<ActiveEventLoop>(event_loop)));
1818
});
1919
Self
2020
}

crates/eframe/src/native/glow_integration.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -661,13 +661,14 @@ impl<'app> GlowWinitRunning<'app> {
661661
{
662662
for action in viewport.actions_requested.drain() {
663663
match action {
664-
ActionRequested::Screenshot => {
664+
ActionRequested::Screenshot(user_data) => {
665665
let screenshot = painter.read_screen_rgba(screen_size_in_pixels);
666666
egui_winit
667667
.egui_input_mut()
668668
.events
669669
.push(egui::Event::Screenshot {
670670
viewport_id,
671+
user_data,
671672
image: screenshot.into(),
672673
});
673674
}
@@ -943,7 +944,7 @@ impl GlutinWindowContext {
943944
// we might want to expose this option to users in the future. maybe using an env var or using native_options.
944945
//
945946
// The justification for FallbackEgl over PreferEgl is at https://github.com/emilk/egui/pull/2526#issuecomment-1400229576 .
946-
.with_preference(glutin_winit::ApiPreference::PreferEgl)
947+
.with_preference(glutin_winit::ApiPreference::FallbackEgl)
947948
.with_window_attributes(Some(egui_winit::create_winit_window_attributes(
948949
egui_ctx,
949950
event_loop,

crates/eframe/src/native/wgpu_integration.rs

+32-13
Original file line numberDiff line numberDiff line change
@@ -643,10 +643,16 @@ impl<'app> WgpuWinitRunning<'app> {
643643

644644
let clipped_primitives = egui_ctx.tessellate(shapes, pixels_per_point);
645645

646-
let screenshot_requested = viewport
647-
.actions_requested
648-
.take(&ActionRequested::Screenshot)
649-
.is_some();
646+
let mut screenshot_commands = vec![];
647+
viewport.actions_requested.retain(|cmd| {
648+
if let ActionRequested::Screenshot(info) = cmd {
649+
screenshot_commands.push(info.clone());
650+
false
651+
} else {
652+
true
653+
}
654+
});
655+
let screenshot_requested = !screenshot_commands.is_empty();
650656
let (vsync_secs, screenshot) = painter.paint_and_update_textures(
651657
viewport_id,
652658
pixels_per_point,
@@ -655,19 +661,32 @@ impl<'app> WgpuWinitRunning<'app> {
655661
&textures_delta,
656662
screenshot_requested,
657663
);
658-
if let Some(screenshot) = screenshot {
659-
egui_winit
660-
.egui_input_mut()
661-
.events
662-
.push(egui::Event::Screenshot {
663-
viewport_id,
664-
image: screenshot.into(),
665-
});
664+
match (screenshot_requested, screenshot) {
665+
(false, None) => {}
666+
(true, Some(screenshot)) => {
667+
let screenshot = Arc::new(screenshot);
668+
for user_data in screenshot_commands {
669+
egui_winit
670+
.egui_input_mut()
671+
.events
672+
.push(egui::Event::Screenshot {
673+
viewport_id,
674+
user_data,
675+
image: screenshot.clone(),
676+
});
677+
}
678+
}
679+
(true, None) => {
680+
log::error!("Bug in egui_wgpu: screenshot requested, but no screenshot was taken");
681+
}
682+
(false, Some(_)) => {
683+
log::warn!("Bug in egui_wgpu: Got screenshot without requesting it");
684+
}
666685
}
667686

668687
for action in viewport.actions_requested.drain() {
669688
match action {
670-
ActionRequested::Screenshot => {
689+
ActionRequested::Screenshot { .. } => {
671690
// already handled above
672691
}
673692
ActionRequested::Cut => {

0 commit comments

Comments
 (0)