Fix: GL Compilation Subprocess file locking

Prevent the cache file from being locked if the driver hangs during
validation.
This commit is contained in:
Miguel Pozo
2025-08-13 16:05:33 +02:00
parent 6cf196044e
commit e0b281a505

View File

@@ -262,6 +262,8 @@ void GPU_compilation_subprocess_run(const char *subprocess_name)
/* Use temp memory so we don't overwrite the source hash. */
static char tmp_mem[compilation_subprocess_shared_memory_size];
file.read(tmp_mem, size);
/* Close first in case validation hangs the driver. */
file.close();
/* Ensure it's valid. */
if (!validate_binary(tmp_mem)) {
std::cout << "Compilation Subprocess: Failed to load cached shader binary " << hash_str
@@ -269,7 +271,6 @@ void GPU_compilation_subprocess_run(const char *subprocess_name)
/* TODO: No longer true. */
/* We can't compile the shader anymore since we have written over the source code,
* but we delete the cache for the next time this shader is requested. */
file.close();
BLI_delete(cache_path.c_str(), false, false);
}
/* Copy the temp memory to the shared memory now that we know loading the shader doesn't