-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Started to implement Vulkan correlation.
For now, only device enumeration works. macOS (Metal) version is just a basic stub.
- Loading branch information
Showing
4 changed files
with
403 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
use nalgebra::Matrix3; | ||
use std::{error, fmt}; | ||
|
||
use crate::data::Grid; | ||
|
||
use super::{CorrelationDirection, ProjectionMode}; | ||
|
||
pub enum CorrelationDirection { | ||
Forward, | ||
Reverse, | ||
} | ||
|
||
pub struct GpuContext {} | ||
|
||
impl GpuContext { | ||
pub fn new( | ||
_: (usize, usize), | ||
_: (usize, usize), | ||
_: ProjectionMode, | ||
_: Matrix3<f64>, | ||
_: bool, | ||
) -> Result<GpuContext, Box<dyn error::Error>> { | ||
Err(GpuError::new("Compiled without GPU support").into()) | ||
} | ||
|
||
pub fn get_device_name(&self) -> &'static str { | ||
"undefined" | ||
} | ||
|
||
pub fn cross_check_filter(&mut self, _: f32, _: CorrelationDirection) {} | ||
|
||
pub fn complete_process( | ||
&mut self, | ||
) -> Result<Grid<Option<super::Match>>, Box<dyn error::Error>> { | ||
Err(GpuError::new("Compiled without GPU support").into()) | ||
} | ||
|
||
pub fn correlate_images<PL: super::ProgressListener>( | ||
&mut self, | ||
_: &Grid<u8>, | ||
_: &Grid<u8>, | ||
_: f32, | ||
_: bool, | ||
_: Option<&PL>, | ||
_: CorrelationDirection, | ||
) -> Result<(), Box<dyn error::Error>> { | ||
Err(GpuError::new("Compiled without GPU support").into()) | ||
} | ||
} | ||
|
||
#[derive(Debug)] | ||
pub struct GpuError { | ||
msg: &'static str, | ||
} | ||
|
||
impl GpuError { | ||
fn new(msg: &'static str) -> GpuError { | ||
GpuError { msg } | ||
} | ||
} | ||
|
||
impl std::error::Error for GpuError {} | ||
|
||
impl fmt::Display for GpuError { | ||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | ||
write!(f, "{}", self.msg) | ||
} | ||
} |
Oops, something went wrong.