mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2024-12-05 08:14:57 +08:00
rusticl/program: add debugging option to disable SPIR-V validation
This is useful for running applications known to pass in invalid SPIR-V. Signed-off-by: Karol Herbst <git@karolherbst.de> Reviewed-by: Nora Allen <blackcatgames@protonmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23818>
This commit is contained in:
parent
2b2a513890
commit
45d86b419b
@ -945,6 +945,7 @@ Rusticl environment variables
|
||||
|
||||
a comma-separated list of debug channels to enable.
|
||||
|
||||
- ``allow_invalid_spirv`` disables validation of any input SPIR-V
|
||||
- ``clc`` dumps all OpenCL C source being compiled
|
||||
- ``program`` dumps compilation logs to stderr
|
||||
|
||||
|
@ -17,6 +17,7 @@ pub struct Platform {
|
||||
}
|
||||
|
||||
pub struct PlatformDebug {
|
||||
pub allow_invalid_spirv: bool,
|
||||
pub clc: bool,
|
||||
pub program: bool,
|
||||
}
|
||||
@ -57,6 +58,7 @@ static mut PLATFORM: Platform = Platform {
|
||||
devs: Vec::new(),
|
||||
};
|
||||
static mut PLATFORM_DBG: PlatformDebug = PlatformDebug {
|
||||
allow_invalid_spirv: false,
|
||||
clc: false,
|
||||
program: false,
|
||||
};
|
||||
@ -70,6 +72,7 @@ fn load_env() {
|
||||
if let Ok(debug_flags) = env::var("RUSTICL_DEBUG") {
|
||||
for flag in debug_flags.split(',') {
|
||||
match flag {
|
||||
"allow_invalid_spirv" => debug.allow_invalid_spirv = true,
|
||||
"clc" => debug.clc = true,
|
||||
"program" => debug.program = true,
|
||||
_ => eprintln!("Unknown RUSTICL_DEBUG flag found: {}", flag),
|
||||
|
@ -559,7 +559,11 @@ impl Program {
|
||||
// has to match CL_DEVICE_MAX_PARAMETER_SIZE
|
||||
limit_max_function_arg: dev.param_max_size() as u32,
|
||||
};
|
||||
spirv.clone_on_validate(&options)
|
||||
if Platform::dbg().allow_invalid_spirv {
|
||||
(Some(spirv.clone()), String::new())
|
||||
} else {
|
||||
spirv.clone_on_validate(&options)
|
||||
}
|
||||
}
|
||||
ProgramSourceType::Src(src) => {
|
||||
let args = prepare_options(&options, dev);
|
||||
|
Loading…
Reference in New Issue
Block a user