mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 07:28:11 +02:00
rusticl/program: skip linking compiled binaries
Applications can do their own caching, but are in any case required to properly "compiler" the binaries via clBuildProgram or clCompileProgram + clLinkPrograms. In any case, there is no point building something if we already have the result. 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/23847>
This commit is contained in:
parent
18f1087a21
commit
0759759658
1 changed files with 14 additions and 0 deletions
|
|
@ -525,6 +525,16 @@ impl Program {
|
|||
}
|
||||
|
||||
let mut d = info.dev_build_mut(dev);
|
||||
|
||||
// skip compilation if we already have the right thing.
|
||||
if self.is_bin() {
|
||||
if d.bin_type == CL_PROGRAM_BINARY_TYPE_EXECUTABLE && !lib
|
||||
|| d.bin_type == CL_PROGRAM_BINARY_TYPE_LIBRARY && lib
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
let spirvs = [d.spirv.as_ref().unwrap()];
|
||||
let (spirv, log) = spirv::SPIRVBin::link(&spirvs, lib);
|
||||
|
||||
|
|
@ -690,6 +700,10 @@ impl Program {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn is_bin(&self) -> bool {
|
||||
matches!(self.src, ProgramSourceType::Binary)
|
||||
}
|
||||
|
||||
pub fn is_il(&self) -> bool {
|
||||
matches!(self.src, ProgramSourceType::Il(_))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue