mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 11:18:08 +02:00
rusticl/platform: add RUSTICL_FEATURES boilerplate
Signed-off-by: Karol Herbst <kherbst@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22649>
This commit is contained in:
parent
389a199993
commit
b90d1cfbfe
2 changed files with 22 additions and 0 deletions
|
|
@ -910,6 +910,11 @@ Rusticl environment variables
|
||||||
- ``RUSTICL_ENABLE=iris:1,radeonsi:0,2`` (enables second iris and first
|
- ``RUSTICL_ENABLE=iris:1,radeonsi:0,2`` (enables second iris and first
|
||||||
and third radeonsi device)
|
and third radeonsi device)
|
||||||
|
|
||||||
|
.. envvar:: RUSTICL_FEATURES
|
||||||
|
|
||||||
|
a comma-separated list of features to enable. Those are disabled by default
|
||||||
|
as they might not be stable enough or break OpenCL conformance.
|
||||||
|
|
||||||
.. envvar:: RUSTICL_DEBUG
|
.. envvar:: RUSTICL_DEBUG
|
||||||
|
|
||||||
a comma-separated list of debug channels to enable.
|
a comma-separated list of debug channels to enable.
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,8 @@ pub struct PlatformDebug {
|
||||||
pub program: bool,
|
pub program: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub struct PlatformFeatures {}
|
||||||
|
|
||||||
static PLATFORM_ENV_ONCE: Once = Once::new();
|
static PLATFORM_ENV_ONCE: Once = Once::new();
|
||||||
static PLATFORM_ONCE: Once = Once::new();
|
static PLATFORM_ONCE: Once = Once::new();
|
||||||
|
|
||||||
|
|
@ -33,6 +35,7 @@ static mut PLATFORM: Platform = Platform {
|
||||||
devs: Vec::new(),
|
devs: Vec::new(),
|
||||||
};
|
};
|
||||||
static mut PLATFORM_DBG: PlatformDebug = PlatformDebug { program: false };
|
static mut PLATFORM_DBG: PlatformDebug = PlatformDebug { program: false };
|
||||||
|
static mut PLATFORM_FEATURES: PlatformFeatures = PlatformFeatures {};
|
||||||
|
|
||||||
fn load_env() {
|
fn load_env() {
|
||||||
let debug = unsafe { &mut PLATFORM_DBG };
|
let debug = unsafe { &mut PLATFORM_DBG };
|
||||||
|
|
@ -44,6 +47,15 @@ fn load_env() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let features = unsafe { &mut PLATFORM_FEATURES };
|
||||||
|
if let Ok(feature_flags) = env::var("RUSTICL_FEATURES") {
|
||||||
|
for flag in feature_flags.split(',') {
|
||||||
|
match flag {
|
||||||
|
_ => eprintln!("Unknown RUSTICL_FEATURES flag found: {}", flag),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Platform {
|
impl Platform {
|
||||||
|
|
@ -62,6 +74,11 @@ impl Platform {
|
||||||
unsafe { &PLATFORM_DBG }
|
unsafe { &PLATFORM_DBG }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn features() -> &'static PlatformFeatures {
|
||||||
|
debug_assert!(PLATFORM_ENV_ONCE.is_completed());
|
||||||
|
unsafe { &PLATFORM_FEATURES }
|
||||||
|
}
|
||||||
|
|
||||||
fn init(&mut self) {
|
fn init(&mut self) {
|
||||||
unsafe {
|
unsafe {
|
||||||
glsl_type_singleton_init_or_ref();
|
glsl_type_singleton_init_or_ref();
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue