diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 926eb96..e4f8bbe 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -185,45 +185,45 @@ jobs: name: windows-build-artifacts path: target/release/fe.exe - build-mac: - runs-on: macos-latest - - steps: - - uses: actions/checkout@v1 - - - name: Cache Cargo registry - uses: actions/cache@v1 - with: - path: ~/.cargo/registry - key: ${{ runner.os }}-stable-cargo-registry-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-stable-cargo-registry- - - - name: Cache Cargo index - uses: actions/cache@v1 - with: - path: ~/.cargo/git - key: ${{ runner.os }}-stable-cargo-index-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-stable-cargo-index- - - - name: Cache Cargo build - uses: actions/cache@v1 - with: - path: target/debug - key: ${{ runner.os }}-stable-debug-target-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-stable-debug-target- - - - name: Install Rust - run: | - rustup update ${{ matrix.rust }} --no-self-update - rustup default ${{ matrix.rust }} - - name: Build - run: cargo build --release - - - name: Upload build artifacts - uses: actions/upload-artifact@v1 - with: - name: macos-build-artifacts - path: target/release/fe +# build-mac: +# runs-on: macos-latest +# +# steps: +# - uses: actions/checkout@v1 +# +# - name: Cache Cargo registry +# uses: actions/cache@v1 +# with: +# path: ~/.cargo/registry +# key: ${{ runner.os }}-stable-cargo-registry-${{ hashFiles('**/Cargo.lock') }} +# restore-keys: | +# ${{ runner.os }}-stable-cargo-registry- +# +# - name: Cache Cargo index +# uses: actions/cache@v1 +# with: +# path: ~/.cargo/git +# key: ${{ runner.os }}-stable-cargo-index-${{ hashFiles('**/Cargo.lock') }} +# restore-keys: | +# ${{ runner.os }}-stable-cargo-index- +# +# - name: Cache Cargo build +# uses: actions/cache@v1 +# with: +# path: target/debug +# key: ${{ runner.os }}-stable-debug-target-${{ hashFiles('**/Cargo.lock') }} +# restore-keys: | +# ${{ runner.os }}-stable-debug-target- +# +# - name: Install Rust +# run: | +# rustup update ${{ matrix.rust }} --no-self-update +# rustup default ${{ matrix.rust }} +# - name: Build +# run: cargo build --release +# +# - name: Upload build artifacts +# uses: actions/upload-artifact@v1 +# with: +# name: macos-build-artifacts +# path: target/release/fe diff --git a/Cargo.lock b/Cargo.lock index 6da5c6f..38f09f9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -319,7 +319,7 @@ checksum = "4da9a32f3fed317401fa3c862968128267c3106685286e15d5aaa3d7389c2f60" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -426,9 +426,9 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.37" +version = "0.4.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a0d04d43504c61aa6c7531f1871dd0d418d91130162063b789da00fd7057a5e" +checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" dependencies = [ "android-tzdata", "iana-time-zone", @@ -467,7 +467,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -478,9 +478,9 @@ checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" [[package]] name = "clipboard-win" -version = "5.3.0" +version = "5.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d517d4b86184dbb111d3556a10f1c8a04da7428d2987bf1081602bf11c3aa9ee" +checksum = "79f4473f5144e20d9aceaf2972478f06ddf687831eafeeb434fbaf0acc4144ad" dependencies = [ "error-code", ] @@ -947,6 +947,7 @@ dependencies = [ "ferrite-core", "glyphon", "pollster", + "tracing", "wgpu", "winit", ] @@ -1100,7 +1101,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -1848,7 +1849,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -2023,7 +2024,7 @@ dependencies = [ "phf_shared", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -2098,9 +2099,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.79" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" +checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba" dependencies = [ "unicode-ident", ] @@ -2186,9 +2187,9 @@ checksum = "f60fcc7d6849342eff22c4350c8b9a989ee8ceabc4b481253e8946b9fe83d684" [[package]] name = "ratatui" -version = "0.26.1" +version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcb12f8fbf6c62614b0d56eb352af54f6a22410c3b079eb53ee93c7b97dd31d8" +checksum = "a564a852040e82671dc50a37d88f3aa83bbc690dfc6844cfe7a2591620206a80" dependencies = [ "bitflags 2.5.0", "cassowary", @@ -2437,29 +2438,29 @@ checksum = "58bf37232d3bb9a2c4e641ca2a11d83b5062066f88df7fed36c28772046d65ba" [[package]] name = "serde" -version = "1.0.197" +version = "1.0.198" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" +checksum = "9846a40c979031340571da2545a4e5b7c4163bdae79b301d5f86d03979451fcc" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.197" +version = "1.0.198" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" +checksum = "e88edab869b01783ba905e7d0153f9fc1a6505a96e4ad3018011eedb838566d9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] name = "serde_json" -version = "1.0.115" +version = "1.0.116" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12dc5c46daa8e9fdf4f5e71b6cf9a53f2487da0e86e55808e2d35539666497dd" +checksum = "3e17db7126d17feb94eb3fad46bf1a96b034e8aacbc2e775fe81505f8b0b2813" dependencies = [ "itoa", "ryu", @@ -2604,12 +2605,12 @@ dependencies = [ [[package]] name = "stability" -version = "0.1.1" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebd1b177894da2a2d9120208c3386066af06a488255caabc5de8ddca22dbc3ce" +checksum = "2ff9eaf853dec4c8802325d8b6d3dffa86cc707fd7a1a4cdbf416e13b061787a" dependencies = [ "quote", - "syn 1.0.109", + "syn 2.0.59", ] [[package]] @@ -2655,7 +2656,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -2704,9 +2705,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.58" +version = "2.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44cfb93f38070beee36b3fef7d4f5a16f27751d94b187b666a5cc5e9b0d30687" +checksum = "4a6531ffc7b071655e4ce2e04bd464c4830bb585a61cabb96cf808f05172615a" dependencies = [ "proc-macro2", "quote", @@ -2758,7 +2759,7 @@ checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -2886,7 +2887,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -3302,7 +3303,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", "wasm-bindgen-shared", ] @@ -3336,7 +3337,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -4008,5 +4009,5 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] diff --git a/crates/ferrite-gui/Cargo.toml b/crates/ferrite-gui/Cargo.toml index 407c3d8..6e183e0 100644 --- a/crates/ferrite-gui/Cargo.toml +++ b/crates/ferrite-gui/Cargo.toml @@ -5,10 +5,11 @@ edition = "2021" [dependencies] anyhow = { workspace = true } +cgmath = "0.18.0" ferrite-cli = { workspace = true } ferrite-core = { workspace = true } +glyphon = "0.5.0" pollster = "0.3.0" +tracing = { workspace = true } wgpu = "0.19.3" winit = "0.29.15" -glyphon = "0.5.0" -cgmath = "0.18.0" diff --git a/crates/ferrite-gui/src/lib.rs b/crates/ferrite-gui/src/lib.rs index 16338fd..20ecd48 100644 --- a/crates/ferrite-gui/src/lib.rs +++ b/crates/ferrite-gui/src/lib.rs @@ -1,4 +1,4 @@ -use std::{iter, sync::Arc, time::Instant}; +use std::{env, iter, sync::Arc, time::Instant}; use anyhow::Result; use event_loop_wrapper::EventLoopProxyWrapper; @@ -61,14 +61,31 @@ impl GuiApp { ); let size = window.inner_size(); - let instance = wgpu::Instance::new(wgpu::InstanceDescriptor { - backends: wgpu::Backends::all(), + let mut backends = if cfg!(windows) { + wgpu::Backends::DX12 + } else if cfg!(macos) { + wgpu::Backends::PRIMARY + } else { + wgpu::Backends::all() + }; + + if let Ok(gpu_backend) = env::var("FERRITE_GPU_BACKEND") { + backends = wgpu::util::parse_backends_from_comma_list(&gpu_backend); + } else if let Ok(gpu_backend) = env::var("WGPU_BACKEND") { + backends = wgpu::util::parse_backends_from_comma_list(&gpu_backend); + }; + + let instance_descriptor = wgpu::InstanceDescriptor { + backends, ..Default::default() - }); + }; + + let instance = wgpu::Instance::new(instance_descriptor); + let surface = instance.create_surface(window.clone()).unwrap(); let adapter = instance .request_adapter(&wgpu::RequestAdapterOptions { - power_preference: wgpu::PowerPreference::HighPerformance, + power_preference: wgpu::PowerPreference::None, compatible_surface: Some(&surface), force_fallback_adapter: false, })