Skip to content

Commit 86acb53

Browse files
committed
[update] default backend to also be optional.
1 parent 47abd92 commit 86acb53

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

crates/lambda-rs-platform/Cargo.toml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ mockall = "=0.11.3"
2929

3030
[features]
3131
default=["shaderc/build-from-source"]
32-
detect-platform=[]
32+
detect-platform=["dep:default_backend"]
3333
winit-windowing=[]
3434
gfx-with-opengl=["dep:gfx-backend-gl"]
3535
gfx-with-vulkan=["dep:gfx-backend-vulkan"]
@@ -41,14 +41,17 @@ gfx-with-dx12=["dep:gfx-backend-dx12"]
4141
crate-type = ["cdylib", "rlib"]
4242
incremental = true
4343

44-
[target.'cfg(all(unix, not(target_os = "macos")))'.dependencies.gfx-backend-gl]
44+
[target.'cfg(all(unix, not(target_os = "macos")))'.dependencies.default_backend]
4545
package = "gfx-backend-gl"
4646
version = "=0.9.0"
47+
optional = true
4748

48-
[target.'cfg(all(target_os = "macos"))'.dependencies.gfx-backend-metal]
49+
[target.'cfg(all(target_os = "macos"))'.dependencies.default_backend]
4950
package = "gfx-backend-metal"
5051
version = "=0.9.0"
52+
optional = true
5153

52-
[target.'cfg(all(windows))'.dependencies.gfx-backend-dx12]
54+
[target.'cfg(all(windows))'.depedencies.default_backend]
5355
package = "gfx-backend-dx12"
5456
version = "=0.9.0"
57+
optional = true

crates/lambda-rs-platform/src/gfx/api.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ if #[cfg(feature = "gfx-with-gl")] {
1212
pub use gfx_backend_dx11 as RenderingAPI;
1313
} else if #[cfg(feature = "gfx-with-dx12")] {
1414
pub use gfx_backend_dx12 as RenderingAPI;
15-
} else if #[cfg(all(feature = "detect-platform", windows))] {
16-
pub use gfx_backend_dx12 as RenderingAPI;
15+
} else if #[cfg(all(feature = "detect-platform"))] {
16+
pub use default_backend as RenderingAPI;
1717
} else if #[cfg(all(feature = "detect-platform", target_os = "macos"))] {
1818
pub use gfx_backend_metal as RenderingAPI;
1919
} else if #[cfg(all(feature = "detect-platform", unix, not(target_os = "macos")))] {
2020
pub use gfx_backend_gl as RenderingAPI;
2121
} else {
22-
compile_error!("No supported GPU API found for the current platform.");
22+
panic!("No supported GPU API found for the current platform.");
2323
}
2424
}

crates/lambda-rs/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ name = "lambda"
1212
path = "src/lib.rs"
1313

1414
[dependencies]
15-
lambda-rs-platform = { path = "../lambda-rs-platform", version = "2023.1.26" }
15+
lambda-rs-platform = { path = "../lambda-rs-platform", version = "2023.1.26"}
1616

1717
[dev-dependencies]
1818
cargo-audit = "0.16.0"

0 commit comments

Comments
 (0)