From 3a981acf55570a9b1e023d2c7ef75d499c2c8fbc Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Thu, 22 Jun 2023 02:56:06 +0200 Subject: [PATCH] rusticl/device: create helper context before loading libclc Some drivers (llvmpipe) postpone some screen initialization until the first context is created. Signed-off-by: Karol Herbst Reviewed-by: Faith Ekstrand Part-of: --- src/gallium/frontends/rusticl/core/device.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gallium/frontends/rusticl/core/device.rs b/src/gallium/frontends/rusticl/core/device.rs index 4bcebd5cb80..83b121f3cb0 100644 --- a/src/gallium/frontends/rusticl/core/device.rs +++ b/src/gallium/frontends/rusticl/core/device.rs @@ -181,6 +181,9 @@ impl Device { return None; } + // Create before loading libclc as llvmpipe only creates the shader cache with the first + // context being created. + let helper_ctx = screen.create_context()?; let lib_clc = spirv::SPIRVBin::get_lib_clc(&screen); if lib_clc.is_none() { eprintln!("Libclc failed to load. Please make sure it is installed and provides spirv-mesa3d-.spv and/or spirv64-mesa3d-.spv"); @@ -188,7 +191,7 @@ impl Device { let mut d = Self { base: CLObjectBase::new(), - helper_ctx: Mutex::new(screen.create_context().unwrap()), + helper_ctx: Mutex::new(helper_ctx), screen: screen, cl_version: CLVersion::Cl3_0, clc_version: CLVersion::Cl3_0,