From 34f55208068df062c6497a38d0189591dca045a1 Mon Sep 17 00:00:00 2001 From: Andreas Reich Date: Fri, 3 Jan 2025 10:30:29 +0100 Subject: [PATCH] always enable dx12 for egui_kittest's wgpu feature --- Cargo.lock | 29 ++++++++++++++++++++++++++++- crates/egui-wgpu/src/lib.rs | 2 +- crates/egui_demo_lib/Cargo.toml | 1 - crates/egui_kittest/Cargo.toml | 11 +++++++++-- 4 files changed, 38 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 009aeb73130b..fc8655dcc016 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1348,7 +1348,6 @@ dependencies = [ "egui_kittest", "serde", "unicode_names2", - "wgpu", ] [[package]] @@ -1926,6 +1925,18 @@ dependencies = [ "bitflags 2.6.0", ] +[[package]] +name = "gpu-allocator" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c151a2a5ef800297b4e79efa4f4bec035c5f51d5ae587287c9b952bdf734cacd" +dependencies = [ + "log", + "presser", + "thiserror", + "windows", +] + [[package]] name = "gpu-descriptor" version = "0.3.0" @@ -3109,6 +3120,12 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "presser" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa" + [[package]] name = "proc-macro-crate" version = "3.2.0" @@ -3262,6 +3279,12 @@ dependencies = [ "getrandom", ] +[[package]] +name = "range-alloc" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8a99fddc9f0ba0a85884b8d14e3592853e787d581ca1816c91349b10e4eeab" + [[package]] name = "raw-window-handle" version = "0.5.2" @@ -4512,6 +4535,7 @@ dependencies = [ "android_system_properties", "arrayvec", "ash", + "bit-set 0.8.0", "bitflags 2.6.0", "block", "bytemuck", @@ -4520,6 +4544,7 @@ dependencies = [ "glow 0.14.2", "glutin_wgl_sys", "gpu-alloc", + "gpu-allocator", "gpu-descriptor", "js-sys", "khronos-egl", @@ -4533,6 +4558,7 @@ dependencies = [ "once_cell", "parking_lot", "profiling", + "range-alloc", "raw-window-handle 0.6.2", "renderdoc-sys", "rustc-hash", @@ -4542,6 +4568,7 @@ dependencies = [ "web-sys", "wgpu-types", "windows", + "windows-core 0.58.0", ] [[package]] diff --git a/crates/egui-wgpu/src/lib.rs b/crates/egui-wgpu/src/lib.rs index 2a1d34889cbb..8eba6f60e42d 100644 --- a/crates/egui-wgpu/src/lib.rs +++ b/crates/egui-wgpu/src/lib.rs @@ -303,7 +303,7 @@ pub enum WgpuSetup { /// supported backends, power preferences, and device description. /// /// By default can also be configured with the environment variables: - /// * `WGPU_BACKEND`: `vulkan`, `dx11`, `dx12`, `metal`, `opengl`, `webgpu` + /// * `WGPU_BACKEND`: `vulkan`, `dx12`, `metal`, `opengl`, `webgpu` /// * `WGPU_POWER_PREF`: `low`, `high` or `none` /// * `WGPU_TRACE`: Path to a file to output a wgpu trace file. CreateNew(WgpuSetupCreateNew), diff --git a/crates/egui_demo_lib/Cargo.toml b/crates/egui_demo_lib/Cargo.toml index b494e18a99b6..047ed3059fff 100644 --- a/crates/egui_demo_lib/Cargo.toml +++ b/crates/egui_demo_lib/Cargo.toml @@ -57,7 +57,6 @@ serde = { workspace = true, optional = true } [dev-dependencies] criterion.workspace = true egui_kittest = { workspace = true, features = ["wgpu", "snapshot"] } -wgpu = { workspace = true, features = ["metal"] } egui = { workspace = true, features = ["default_fonts"] } [[bench]] diff --git a/crates/egui_kittest/Cargo.toml b/crates/egui_kittest/Cargo.toml index 4f52d4aef71c..1e4af19e6218 100644 --- a/crates/egui_kittest/Cargo.toml +++ b/crates/egui_kittest/Cargo.toml @@ -20,7 +20,13 @@ include = ["../LICENSE-APACHE", "../LICENSE-MIT", "**/*.rs", "Cargo.toml"] [features] # Adds a wgpu-based test renderer. -wgpu = ["dep:egui-wgpu", "dep:pollster", "dep:image", "eframe?/wgpu"] +wgpu = [ + "dep:egui-wgpu", + "dep:pollster", + "dep:image", + "dep:wgpu", + "eframe?/wgpu", +] # Adds a dify-based image snapshot utility. snapshot = ["dep:dify", "dep:image", "image/png"] @@ -38,6 +44,8 @@ eframe = { workspace = true, optional = true } egui-wgpu = { workspace = true, optional = true } pollster = { workspace = true, optional = true } image = { workspace = true, optional = true } +# Enable DX12 because it always comes with a software rasterizer. +wgpu = { workspace = true, features = ["metal", "dx12"], optional = true } # snapshot dependencies dify = { workspace = true, optional = true } @@ -48,7 +56,6 @@ document-features = { workspace = true, optional = true } [dev-dependencies] egui = { workspace = true, features = ["default_fonts"] } image = { workspace = true, features = ["png"] } -wgpu = { workspace = true, features = ["metal"] } [lints] workspace = true