diff --git a/schemsearch-cli/src/main.rs b/schemsearch-cli/src/main.rs index 0b8154a..6a08320 100755 --- a/schemsearch-cli/src/main.rs +++ b/schemsearch-cli/src/main.rs @@ -169,10 +169,10 @@ fn main() { .value_parser(|s: &str| s.parse::().map_err(|e| e.to_string())), ) .arg( - Arg::new("force-cpu") - .help("Force CPU Matching, skip OpenCL checks") + Arg::new("opencl") + .help("Use OpenCL Checker") .short('c') - .long("force-cpu") + .long("opencl") .action(ArgAction::SetTrue), ) .about("Searches for a pattern in a schematic") @@ -221,7 +221,7 @@ fn main() { ignore_entities: matches.get_flag("ignore-entities"), threshold: *matches.get_one::("threshold").expect("Couldn't get threshold"), invalid_nbt: matches.get_flag("invalid-nbt"), - use_cpu: matches.get_flag("force-cpu"), + opencl: matches.get_flag("opencl"), }; let pattern = match matches.get_one::("pattern") { diff --git a/schemsearch-common/src/lib.rs b/schemsearch-common/src/lib.rs index 8c0b1e8..dcae49f 100644 --- a/schemsearch-common/src/lib.rs +++ b/schemsearch-common/src/lib.rs @@ -9,7 +9,7 @@ pub struct SearchBehavior { pub ignore_entities: bool, pub threshold: f32, pub invalid_nbt: bool, - pub use_cpu: bool, + pub opencl: bool, } impl Default for SearchBehavior { @@ -22,7 +22,7 @@ impl Default for SearchBehavior { ignore_entities: false, threshold: 0.9, invalid_nbt: false, - use_cpu: false, + opencl: false, } } } diff --git a/schemsearch-lib/src/search.rs b/schemsearch-lib/src/search.rs index e94a55d..da5f88d 100755 --- a/schemsearch-lib/src/search.rs +++ b/schemsearch-lib/src/search.rs @@ -1,17 +1,10 @@ -use lazy_static::lazy_static; use math::round::ceil; use schemsearch_common::Match; use schemsearch_files::SpongeSchematic; -use schemsearch_ocl_matcher::{ocl_available, ocl_search}; +use schemsearch_ocl_matcher::ocl_search; use crate::{SearchBehavior}; use crate::pattern_mapper::{match_palette, match_palette_adapt}; -lazy_static! { - static ref OPENCL_AVAILABLE: bool = { - ocl_available() - }; -} - pub fn search( schem: SpongeSchematic, pattern_schem: &SpongeSchematic, @@ -48,7 +41,7 @@ pub fn search( let schem_height = schem.height as usize; let schem_length = schem.length as usize; - if !search_behavior.use_cpu && *OPENCL_AVAILABLE { + if search_behavior.opencl { return ocl_search(schem_data.as_slice(), [schem_width, schem_height, schem_length], pattern_schem.block_data.as_slice(), [pattern_width, pattern_height, pattern_length], *air_id, search_behavior).unwrap() }