Skip to content

Commit 5d8a8e3

Browse files
committed
desktop: Prefer non-sRGB surface formats, bump egui to match
1 parent f46c744 commit 5d8a8e3

File tree

3 files changed

+27
-16
lines changed

3 files changed

+27
-16
lines changed

Cargo.lock

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/src/debug_ui/avm1.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,11 +315,11 @@ fn show_value_type_combo_box<'gc>(
315315
// so just disable the selectable labels to prevent setting to these types.
316316
ui.add_enabled(
317317
false,
318-
egui::SelectableLabel::new(matches!(value, Value::Object(_)), "Object"),
318+
egui::Button::selectable(matches!(value, Value::Object(_)), "Object"),
319319
);
320320
ui.add_enabled(
321321
false,
322-
egui::SelectableLabel::new(matches!(value, Value::MovieClip(_)), "MovieClip"),
322+
egui::Button::selectable(matches!(value, Value::MovieClip(_)), "MovieClip"),
323323
);
324324
});
325325
new

desktop/src/gui/controller.rs

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,23 @@ impl GuiController {
7575
adapter_info.name,
7676
adapter_info.device_type
7777
);
78-
let surface_format = surface
79-
.get_capabilities(&adapter)
80-
.formats
81-
.first()
82-
.cloned()
83-
.expect("At least one format should be supported");
78+
let preferred_formats = [
79+
// by egui
80+
wgpu::TextureFormat::Rgba8Unorm,
81+
wgpu::TextureFormat::Bgra8Unorm,
82+
];
83+
let supported_formats = surface.get_capabilities(&adapter).formats;
84+
let surface_format = preferred_formats
85+
.iter()
86+
.find(|format| supported_formats.contains(format))
87+
.copied()
88+
.unwrap_or_else(|| {
89+
supported_formats
90+
.first()
91+
.copied()
92+
.expect("At least one format should be supported")
93+
});
94+
tracing::info!("Using surface format {:?}", surface_format);
8495
let size = window.inner_size();
8596
surface.configure(
8697
&device,

0 commit comments

Comments
 (0)