diff --git a/docs/envvars.rst b/docs/envvars.rst index 0c0c0e49f2d..ae1ba9ac207 100644 --- a/docs/envvars.rst +++ b/docs/envvars.rst @@ -915,6 +915,8 @@ Rusticl environment variables a comma-separated list of features to enable. Those are disabled by default as they might not be stable enough or break OpenCL conformance. + - ``fp64`` enables OpenCL double support + .. envvar:: RUSTICL_DEBUG a comma-separated list of debug channels to enable. diff --git a/src/gallium/frontends/rusticl/core/device.rs b/src/gallium/frontends/rusticl/core/device.rs index 35711d303aa..bd2d0da0e3f 100644 --- a/src/gallium/frontends/rusticl/core/device.rs +++ b/src/gallium/frontends/rusticl/core/device.rs @@ -1,6 +1,7 @@ use crate::api::icd::*; use crate::api::util::*; use crate::core::format::*; +use crate::core::platform::*; use crate::core::util::*; use crate::core::version::*; use crate::impl_cl_type_trait; @@ -582,11 +583,11 @@ impl Device { } pub fn doubles_supported(&self) -> bool { - false - /* + if !Platform::features().fp64 { + return false; + } self.screen.param(pipe_cap::PIPE_CAP_DOUBLES) == 1 - */ } pub fn doubles_is_softfp(&self) -> bool { diff --git a/src/gallium/frontends/rusticl/core/platform.rs b/src/gallium/frontends/rusticl/core/platform.rs index c5873e81325..2126dfa510a 100644 --- a/src/gallium/frontends/rusticl/core/platform.rs +++ b/src/gallium/frontends/rusticl/core/platform.rs @@ -21,7 +21,9 @@ pub struct PlatformDebug { pub program: bool, } -pub struct PlatformFeatures {} +pub struct PlatformFeatures { + pub fp64: bool, +} static PLATFORM_ENV_ONCE: Once = Once::new(); static PLATFORM_ONCE: Once = Once::new(); @@ -35,7 +37,7 @@ static mut PLATFORM: Platform = Platform { devs: Vec::new(), }; static mut PLATFORM_DBG: PlatformDebug = PlatformDebug { program: false }; -static mut PLATFORM_FEATURES: PlatformFeatures = PlatformFeatures {}; +static mut PLATFORM_FEATURES: PlatformFeatures = PlatformFeatures { fp64: false }; fn load_env() { let debug = unsafe { &mut PLATFORM_DBG }; @@ -52,6 +54,7 @@ fn load_env() { if let Ok(feature_flags) = env::var("RUSTICL_FEATURES") { for flag in feature_flags.split(',') { match flag { + "fp64" => features.fp64 = true, _ => eprintln!("Unknown RUSTICL_FEATURES flag found: {}", flag), } }