Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions crates/reco-autocam/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ ort = ["reco-detect/ort"]
cuda = ["reco-detect/cuda"]
tensorrt = ["reco-detect/tensorrt"]
coreml = ["reco-detect/coreml"]
directml = ["reco-detect/directml"]
load-dynamic = ["reco-detect/load-dynamic"]
tensorrt-native = ["reco-detect/tensorrt-native"]
ncnn = ["reco-detect/ncnn"]
Expand Down
8 changes: 7 additions & 1 deletion crates/reco-core/src/gpu/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,13 @@ impl GpuContext {
/// Checks `WGPU_BACKEND` first (user override). Otherwise uses
/// platform defaults: DX12 on Windows, Vulkan on Linux, Metal
/// on macOS.
fn select_backends() -> wgpu::Backends {
///
/// Public so windowed consumers (reco-gui, rig-calib) that let Slint
/// create the shared `wgpu::Instance` can apply the same policy via
/// `WGPUConfiguration::Automatic::backends`, instead of falling back to
/// Slint's own default (which tries Vulkan first on Windows and can hit
/// driver/loader bugs this function's platform defaults are chosen to avoid).
pub fn select_backends() -> wgpu::Backends {
if let Ok(val) = std::env::var("WGPU_BACKEND") {
match val.to_lowercase().as_str() {
"vulkan" | "vk" => return wgpu::Backends::VULKAN,
Expand Down
1 change: 1 addition & 0 deletions crates/reco-detect/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ ort = ["dep:ort", "dep:dirs"]
cuda = ["ort", "ort/cuda"]
tensorrt = ["ort", "ort/tensorrt"]
coreml = ["ort", "ort/coreml"]
directml = ["ort", "ort/directml"]
load-dynamic = ["ort", "ort/load-dynamic", "dep:libloading"]
tensorrt-native = []
ncnn = []
Expand Down
11 changes: 11 additions & 0 deletions crates/reco-gui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ tensorrt-native = ["autocam", "reco-autocam/tensorrt-native"]
ncnn = ["autocam", "reco-autocam/ncnn"]
cuda = ["autocam", "reco-autocam/cuda"]
coreml = ["autocam", "reco-autocam/coreml"]
directml = ["autocam", "reco-autocam/directml"]
load-dynamic = ["autocam", "reco-autocam/load-dynamic"]
profiling = ["reco-core/profiling", "reco-io/profiling", "reco-calibrate/profiling"]
# Headless dev/test preload + auto-export hook (RECO_AUTOLOAD/RECO_AUTOEXPORT).
Expand Down Expand Up @@ -61,5 +62,15 @@ tracing = { workspace = true }
tracing-subscriber = { workspace = true }
tracing-log = { workspace = true }

# DirectML EP (Windows-only, see reco-detect/src/ort_session.rs) needs the
# `directml` cargo feature on `ort` compiled in, or it silently no-ops back
# to CPU inference at runtime (the "its corresponding Cargo feature is not
# enabled" ort::ep warning) despite logging as if it succeeded. Enabled
# here rather than in the cross-platform `default` feature list above so
# non-Windows builds aren't affected.
[target.'cfg(windows)'.dependencies]
reco-detect = { path = "../reco-detect", default-features = false, features = ["directml"] }
reco-autocam = { path = "../reco-autocam", optional = true, default-features = false, features = ["directml"] }

[build-dependencies]
slint-build = "1.15"
1 change: 1 addition & 0 deletions crates/reco-gui/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1490,6 +1490,7 @@ fn main() -> anyhow::Result<()> {
let mut config = slint::wgpu_28::WGPUConfiguration::default();
if let slint::wgpu_28::WGPUConfiguration::Automatic(ref mut settings) = config {
settings.device_required_limits = reco_core::wgpu::Limits::downlevel_defaults();
settings.backends = reco_core::gpu::GpuContext::select_backends();
}
config
})
Expand Down
32 changes: 27 additions & 5 deletions crates/reco-obs/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,17 @@ fn main() {
.clang_arg(format!("-I{include_dir}"))
// libobs headers are C, and we want standard types (not ptrdiff).
.clang_arg("-std=c11")
// On Windows, bindgen's clang runs in MSVC-compatibility mode
// (`_MSC_VER` defined), which is required for the rest of the
// libobs/Windows headers to parse correctly. But it also flips
// `util/util_uint64.h`'s `util_mul_div64` into a branch that
// calls `_udiv128` - an MSVC 2019+ intrinsic clang's own
// `intrin.h` shim doesn't declare, so parsing fails. Rather than
// drop MSVC-compat mode (which breaks clang's SSE/SSE2 intrinsic
// headers pulled in transitively), shim just this one call away:
// bindgen doesn't need the `static inline` body to be correct or
// linkable, only for the header to parse.
.clang_arg("-D_udiv128(hi,lo,div,rem)=0")
// Only generate bindings for items we actually use. Bindgen
// pulls transitive types automatically, so the struct fields
// are covered even if the field type isn't in the allowlist.
Expand Down Expand Up @@ -152,13 +163,24 @@ fn main() {
// logger through a fixed-arity entry point. libobs is loaded
// into the process by OBS before any plugin, so the shim's
// `blog(...)` reference resolves at plugin load time without
// us needing to `-lobs` here. `cc` picks up system headers
// automatically on Linux/macOS.
// us needing to `-lobs` here.
let shim_path = PathBuf::from("src/blog_shim.c");
println!("cargo:rerun-if-changed={}", shim_path.display());
cc::Build::new()
.file(&shim_path)
.include(&include_dir)
let mut shim_build = cc::Build::new();
shim_build.file(&shim_path).include(&include_dir);
// The shim includes `<obs/util/base.h>` (the Debian libobs-dev
// layout: headers rooted under an `obs/` folder). On Linux/macOS
// this resolves for free because `/usr/include` - the usual parent
// of `/usr/include/obs` - is already on the compiler's default
// system search path. Windows has no such default, so add the
// parent of `include_dir` explicitly wherever the layout follows
// that `.../obs` convention (harmless no-op add on Linux/macOS).
if include_dir.ends_with("obs")
&& let Some(parent) = PathBuf::from(&include_dir).parent()
{
shim_build.include(parent);
}
shim_build
.flag_if_supported("-std=c11")
// OBS ships headers that rely on GNU extensions (typeof
// etc.) on Linux. `-D_GNU_SOURCE` avoids any surprises.
Expand Down
Loading