1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-26 22:53:14 -04:00
Commit Graph

185 Commits

Author SHA1 Message Date
Grrr
307202ab67 egui_wgpu, added disclaimer, discourages people calling render without update_buffer (#7971)
<!--
Please read the "Making a PR" section of
[`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/main/CONTRIBUTING.md)
before opening a Pull Request!

* Keep your PR:s small and focused.
* The PR title is what ends up in the changelog, so make it descriptive!
* If applicable, add a screenshot or gif.
* If it is a non-trivial addition, consider adding a demo for it to
`egui_demo_lib`, or a new example.
* Do NOT open PR:s from your `master` branch, as that makes it hard for
maintainers to test and add commits to your PR.
* Remember to run `cargo fmt` and `cargo clippy`.
* Open the PR as a draft until you have self-reviewed it and run
`./scripts/check.sh`.
* When you have addressed a PR comment, mark it as resolved.

Please be patient! I will review your PR, but my time is limited!
-->

* Closes <https://github.com/emilk/egui/issues/THE_RELEVANT_ISSUE>
* [x] I have followed the instructions in the PR template

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2026-03-24 13:59:05 +01:00
Andreas Reich
d985bf9b83 Fill in DisplayHandle automatically on web painter just like it's done on winit (#8006)
* Closes https://github.com/emilk/egui/issues/8001
* Follow-up to https://github.com/emilk/egui/pull/7990

Also simplified/shortened the comments around display handle a bit. Lots
a repetition there made it hard to upgrade otherwise.
2026-03-24 12:37:33 +01:00
Emil Ernerfeldt
90217f2ad1 Add error message when calling .render() without .update_buffers() (#8005)
* Closes https://github.com/emilk/egui/issues/7968
2026-03-24 11:54:09 +01:00
Emil Ernerfeldt
7fbd1315ec Include LICENSE files in published crates (#8004)
* Closes https://github.com/emilk/egui/issues/7977
2026-03-24 11:28:49 +01:00
Emil Ernerfeldt
0d2f6cf4e6 Reduce warning level on occluded error 2026-03-23 18:53:32 +01:00
Connor Fitzgerald
a59e803f25 Update to wgpu 29 (#7990)
* [x] I have followed the instructions in the PR template

This updates wgpu to v29 across the egui crate stack.

There a a few API changes due to the requirement to provide a display
handle up front to properly support GLES on linux. I have done my best
to make the api changes as reasonable as possible, but I don't have all
the greater project context, so lmk if things should be done a bit
differently.

I've also updated glow to 0.17 to make cargo deny happy, there are no
source changes. I'm not sure how you want to land these.

---------

Co-authored-by: lucasmerlin <hi@lucasmerlin.me>
2026-03-23 18:21:25 +01:00
SuchAFuriousDeath
41b8f5f4e7 Update wgpu to 28.0.0 (#7853)
Co-authored-by: lucasmerlin <hi@lucasmerlin.me>
2026-03-16 11:56:07 +01:00
Lander Brandt
9bc062c8ee Fix wgpu memory leak leading to panic when window is minimized (#7434) (#7928) 2026-03-05 12:47:57 +01:00
Emil Ernerfeldt
8d98763fe1 Replace #[allow attributes with expect (#7796)
We do have `clippy::allow_attributes` turned on, but it doesn't seem to
work properly
2025-12-19 20:55:50 +01:00
Emil Ernerfeldt
7fe58bbfd4 Forbid uses of unwrap() in the code (#7795) 2025-12-19 20:34:18 +01:00
Emil Ernerfeldt
986c2c0ffb Use explicit Arc::clone to clarify when clones are cheap (#7784) 2025-12-17 17:19:18 +01:00
Emil Ernerfeldt
a0bb4cfef8 Release 0.33.3: update cargo version and changelog 2025-12-11 15:42:15 +01:00
switch
2115ca941b egui-wgpu: attach stencil buffer (#7702) 2025-12-07 23:34:26 +01:00
Emil Ernerfeldt
01770be13e Update changelogs and version for 0.33.2 2025-11-13 15:33:08 +01:00
Stefan Tammer
51b0d0e4b9 [egui-wgpu] Put the capture module behind a feature flag, make the egui dependency optional (#7698)
This PR enables users of `egui-wgpu` to render `epaint` primitives
without having to bring in the complete `egui` crate and all it's
dependencies.

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2025-11-13 11:16:10 +01:00
ASPCartman
c5347f28e4 Fix jittering during window resize on MacOS for WGPU/Metal (#7641)
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2025-11-01 12:55:56 +01:00
Lucas Meurer
96470fabee Release 0.33.0 - egui::Plugin, better kerning, kitdiff viewer (#7622)
## Short bluesky announcement:

We just released egui 0.33.0! 

Highlights:
- `egui::Plugin` a improved way to create and access egui plugins
- [kitdiff](https://github.com/rerun-io/kitdiff), a viewer for
egui_kittest image snapshots (and a general image diff tool)
- better kerning (check the diff on
[kitdiff](https://rerun-io.github.io/kitdiff/?url=https://github.com/emilk/egui/pull/7431))


https://github.com/user-attachments/assets/971f0493-6dae-42e5-8019-58b74cf5d203


## Relaese Changelog:

egui is an easy-to-use immediate mode GUI for Rust that runs on both web
and native.

Try it now: <https://www.egui.rs/>

egui development is sponsored by [Rerun](https://www.rerun.io/), a
startup building an SDK for visualizing streams of multimodal data.

# egui 0.33.0 changelog

Highlights from this release:
- `egui::Plugin` a improved way to create and access egui plugins
- [kitdiff](https://github.com/rerun-io/kitdiff), a viewer for
egui_kittest image snapshots (and a general image diff tool)
- better kerning


### Improved kerning
As a step towards using [parley](https://github.com/linebender/parley)
for font rendering, @valadaptive has refactored the font loading and
rendering code. A result of this (next to the font rendering code being
much nicer now) is improved kerning.
Notice how the c moved away from the k:

![Oct-09-2025
16-21-58](https://github.com/user-attachments/assets/d4a17e87-5e98-40db-a85a-fa77fa77aceb)


### `egui::Plugin` trait
We've added a new trait-based plugin api, meant to replace
`Context::on_begin_pass` and `Context::on_end_pass`.
This makes it a lot easier to handle state in your plugins. Instead of
having to write to egui memory it can live right on your plugin struct.
The trait based api also makes easier to add new hooks that plugins can
use. In addition to `on_begin_pass` and `on_end_pass`, the `Plugin`
trait now has a `input_hook` and `output_hook` which you can use to
inspect / modify the `RawInput` / `FullOutput`.

### kitdiff, a image diff viewer
At rerun we have a ton of snapshots. Some PRs will change most of them
(e.g. [the](https://github.com/rerun-io/rerun/pull/11253/files)
[one](https://rerun-io.github.io/kitdiff/?url=https://github.com/rerun-io/rerun/pull/11253/files)
that updated egui and introduced the kerning improvements, ~500
snapshots changed!).
If you really want to look at every changed snapshot it better be as
efficient as possible, and the experience on github, fiddeling with the
sliders, is kind of frustrating.
In order to fix this, we've made
[kitdiff](https://rerun-io.github.io/kitdiff/).
You can use it locally via 
- `kitdiff files .` will search for .new.png and .diff.png files
- `kitdiff git` will compare the current files to the default branch
(main/master)
Or in the browser via
- going to https://rerun-io.github.io/kitdiff/ and pasting a PR or
github artifact url
- linking to kitdiff via e.g. a github workflow
`https://rerun-io.github.io/kitdiff/?url=<link_to_pr_or_artefact>`

To install kitdiff run `cargo install --git
https://github.com/rerun-io/kitdiff`

Here is a video showing the kerning changes in kitdiff ([try it
yourself](https://rerun-io.github.io/kitdiff/?url=https://github.com/rerun-io/rerun/pull/11253/files)):


https://github.com/user-attachments/assets/74640af1-09ba-435a-9d0c-2cbeee140c8f

###  Migration guide
- `egui::Mutex` now has a timeout as a simple deadlock detection
- If you use a `egui::Mutex` in some place where it's held for longer
than a single frame, you should switch to the std mutex or parking_lot
instead (egui mutexes are wrappers around parking lot)
- `screen_rect` is deprecated
- In order to support safe areas, egui now has `viewport_rect` and
`content_rect`.
- Update all usages of `screen_rect` to `content_rect`, unless you are
sure that you want to draw outside the `safe area` (which would mean
your Ui may be covered by notches, system ui, etc.)
2025-10-09 19:14:14 +02:00
Emil Ernerfeldt
d50287b83c Add taplo.toml for toml formatting (#7618) 2025-10-09 15:38:00 +02:00
Emil Ernerfeldt
47a437403f Use software texture filtering in kittest (#7602) 2025-10-08 16:24:02 +02:00
Emil Ernerfeldt
9cb4e6a54e Create egui_wgpu::RendererOptions (#7601) 2025-10-07 17:06:23 +02:00
Emil Ernerfeldt
86dc9ea64e Inline log format args (#7600) 2025-10-07 16:14:43 +02:00
Andreas Reich
427c0766fd Update wgpu to 27.0.0 (#7580) 2025-10-03 09:54:46 +02:00
Emil Ernerfeldt
bd45406fad Use a lot more let-else (#7582) 2025-10-02 19:47:00 +02:00
Emil Ernerfeldt
18ea9ff0bd Warn if DYLD_LIBRARY_PATH is set and we find no wgpu adapter (#7572)
Co-authored-by: Andreas Reich <andreas@rerun.io>
2025-09-30 15:56:04 +02:00
Kumpelinus
c97c065a57 Update wgpu to 26 and wasm-bindgen to 0.2.100 (#7540)
Co-authored-by: TÖRÖK Attila <torokati44@gmail.com>
Co-authored-by: Andreas Reich <r_andreas2@web.de>
2025-09-21 20:42:00 +02:00
Emil Ernerfeldt
226bdc4c5b 0.32.3 release: Bump version numbers and update changelog (#7536) 2025-09-12 08:18:19 +02:00
Lucas Meurer
34cd613378 Update changelogs and versions for 0.32.2 (#7505) 2025-09-08 10:42:10 +02:00
Emil Ernerfeldt
6a355c3808 Add 0.32.1 to changelogs 2025-08-15 13:42:49 +02:00
Emil Ernerfeldt
3024c39eaf Enable and fix some more clippy lints (#7426)
One can never have too many lints
2025-08-08 09:57:53 +02:00
Lucas Meurer
2c6611d0c6 Enable wgpu default features in eframe / egui_wgpu default features (#7344) 2025-08-05 21:21:00 +02:00
Emil Ernerfeldt
fabd4aa7a5 Release 0.32.0 - Atoms, popups, and better SVG support (#7329) 2025-07-10 16:58:39 +02:00
Emil Ernerfeldt
f46926aaf1 Improve texture filtering by doing it in gamma space (#7311)
* Closes https://github.com/emilk/egui/pull/5839

This makes some transparent images look a lot nicer when blended:


![image](https://github.com/user-attachments/assets/7f370aaf-886a-423c-8391-c378849b63ca)

Cursive text will also look nicer.

This unfortunately changes the contract of what
`register_native_texture` expects

---------

Co-authored-by: Adrian Blumer <blumer.adrian@gmail.com>
2025-07-07 17:46:27 +02:00
valadaptive
7ac137bfc1 Make the font atlas use a color image (#7298)
* [x] I have followed the instructions in the PR template

Splitting this out from the Parley work as requested. This removes
`FontImage` and makes the font atlas use a `ColorImage`. It converts
alpha to coverage at glyph-drawing time, not at delta-upload time.

This doesn't do much now, but will allow for color emoji rendering once
we start using Parley.

I've changed things around so that we pass in `text_alpha_to_coverage`
to the `Fonts` the same way we do with `pixels_per_point` and
`max_texture_side`, reusing the existing code to check if the setting
differs and recreating the font atlas if so. I'm not quite sure why this
wasn't done in the first place.

I've left `ImageData` as an enum for now, in case we want to add support
for more texture pixel formats in the future (which I personally think
would be worthwhile). If you'd like, I can just remove that enum
entirely.
2025-07-04 13:15:48 +02:00
Emil Ernerfeldt
dc79998044 Improve text rendering in light mode (#7290)
This changes how we convert glyph coverage to alpha (and ultimately a
color), but only in light mode.

This is a bit of a hack, because it doesn't fix dark-on-light text in
_dark mode_ (if you have any), but for the common case this PR is a huge
improvement.

You can also tweak this yourself now using
`Visuals::text_alpha_from_coverage` or from the UI (bottom of the
image):


![image](https://github.com/user-attachments/assets/350210d4-c0bb-44b6-84cc-47c2e9d4b9f0)



## Before / After

![widget_gallery_light_x1](https://github.com/user-attachments/assets/21f5a2a0-6b4e-4985-b17f-cd1c7cc01b46)
![widget_gallery_light_x1](https://github.com/user-attachments/assets/5dfec04a-c81c-43ef-8d86-fc48ef7958f1)


## Black text Before/after
If you think the text above looks too weak, it's only because of the
default text color. Here's how it looks like with perfectly `#000000`
black text:


![image](https://github.com/user-attachments/assets/56a4a4f3-c431-4991-b941-a566a4ae94ed)
![Screenshot 2025-07-02 at 13 59
30](https://github.com/user-attachments/assets/df5a91ad-0bb8-4a0f-81a2-50852e7556c1)
2025-07-02 14:58:37 +02:00
Emil Ernerfeldt
b2995dcb83 Use Rust edition 2024 (#7280) 2025-06-30 14:01:57 +02:00
Emil Ernerfeldt
2cf6a3a9a6 Track original SVG size (#7098)
This fixes bugs related to how an `Image` follows the size of an SVG.

We track the "source size" of each image, i.e. the original width/height
of the SVG, which can be different from whatever it was rasterized as.
2025-05-28 08:33:01 +02:00
Matt Keeter
a085d0b3a5 Fix typo in egpu-wgpu/Cargo.toml (#7083) 2025-05-25 16:10:39 +02:00
TÖRÖK Attila
773232b139 Update to wgpu 25 (#6744)
Co-authored-by: Andreas Reich <r_andreas2@web.de>
2025-05-10 13:16:49 +02:00
Emil Ernerfeldt
d0876a1a60 Rename master branch to main (#7034)
For consistency with other repositories, i.e. so I can write `git
checkout main` without worrying which repo I'm browsing.
2025-05-08 09:15:42 +02:00
Emil Ernerfeldt
f9245954eb Enable more clippy lints (#6853)
* Follows https://github.com/emilk/egui/pull/6848
2025-04-24 17:32:50 +02:00
Lucas Meurer
159ccb2fef Release 0.31.1 - text_edit and kittest fixes 2025-03-05 08:37:34 +01:00
Lucas Meurer
5c372a7b36 Release 0.31.0 - Scene container, improved rendering quality 2025-02-04 16:47:56 +01:00
Andreas Reich
30e66e4575 Wgpu resources are no longer wrapped in Arc (since they are now Clone) (#5612)
Co-authored-by: Nicolas <bircni@icloud.com>
2025-01-20 18:06:35 +01:00
TÖRÖK Attila
a5d7cf5bd7 Upgrade to wgpu 24 (#5610) 2025-01-16 17:00:29 +01:00
Emil Ernerfeldt
164f56f554 Fix some clippy issues found by 1.84.0 (#5603) 2025-01-13 08:29:13 +01:00
Andreas Reich
443df84a22 Extend WgpuSetup, egui_kittest now prefers software rasterizers for testing (#5506) 2025-01-08 14:24:58 +01:00
lucasmerlin
46b58e5bcc Add Harness::new_eframe and TestRenderer trait (#5539)
Co-authored-by: Andreas Reich <r_andreas2@web.de>
2025-01-02 17:48:39 +01:00
Emil Ernerfeldt
320377e3ca Release 0.30 - egui_kittest and modals (#5487) 2024-12-16 17:45:35 +01:00
Ted de Munnik
3af907919b Use profiling crate to support more profiler backends (#5150)
Hey! I am not sure if this is something that's been considered before
and decided against (I couldn't find any PR's or issues).

This change removes the internal profiling macros in library crates and
the `puffin` feature and replaces it with similar functions in the
[profiling](https://github.com/aclysma/profiling) crate. This crate
provides a layer of abstraction over various profiler instrumentation
crates and allows library users to pick their favorite (supported)
profiler.

An additional benefit for puffin users is that dependencies of egui are
included in the instrumentation output too (mainly wgpu which uses the
profiling crate), so more details might be available when profiling.

A breaking change is that instead of using the `puffin` feature on egui,
users that want to profile the crate with puffin instead have to enable
the `profile-with-puffin` feature on the profiling crate. Similarly they
could instead choose to use `profile-with-tracy` etc.

I tried to add a 'tracy' feature to egui_demo_app in order to showcase ,
however the /scripts/check.sh currently breaks on mutually exclusive
features (which this introduces), so I decided against including it for
the initial PR. I'm happy to iterate more on this if there is interest
in taking this PR though.

Screenshot showing the additional info for wgpu now available when using
puffin

![image](https://github.com/user-attachments/assets/49fc0e7e-8f88-40cb-a69e-74ca2e3f90f3)
2024-12-16 09:15:54 +01:00
lucasmerlin
6c1d695fc6 Add screenshot support for eframe web (#5438)
This implements web support for taking screenshots in an eframe app (and
adds a nice demo).
It also updates the native screenshot implementation to work with the
wgpu gl backend.

The wgpu implementation is quite different than the native one because
we can't block to wait for the screenshot result, so instead I use a
channel to pass the result to a future frame asynchronously.

* Closes <https://github.com/emilk/egui/issues/5425>
* [x] I have followed the instructions in the PR template


https://github.com/user-attachments/assets/67cad40b-0384-431d-96a3-075cc3cb98fb
2024-12-12 19:17:42 +01:00