Merge branch 'blender-v4.2-release'
This commit is contained in:
@@ -231,14 +231,16 @@ void GPU_compilation_subprocess_run(const char *subprocess_name)
|
||||
file.seekg(0, std::ios::beg);
|
||||
file.read(reinterpret_cast<char *>(shared_mem.get_data()), size);
|
||||
/* Ensure it's valid. */
|
||||
if (validate_binary(shared_mem.get_data())) {
|
||||
end_semaphore.increment();
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
if (!validate_binary(shared_mem.get_data())) {
|
||||
std::cout << "Compilation Subprocess: Failed to load cached shader binary " << hash_str
|
||||
<< "\n";
|
||||
/* 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);
|
||||
}
|
||||
end_semaphore.increment();
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
/* This should never happen, since shaders larger than the pool size should be discarded
|
||||
|
||||
@@ -1936,7 +1936,8 @@ void GLShaderCompiler::prepare_next_specialization_batch()
|
||||
|
||||
/** WORKAROUND: Set async_compilation to true, so only the sources are generated. */
|
||||
sh->async_compilation_ = true;
|
||||
item.program = sh->program_get();
|
||||
sh->program_get();
|
||||
item.program = sh->program_active_;
|
||||
sh->async_compilation_ = false;
|
||||
|
||||
item.sources = sh->get_sources();
|
||||
@@ -1970,10 +1971,8 @@ bool GLShaderCompiler::specialization_batch_is_ready(SpecializationBatchHandle &
|
||||
}
|
||||
|
||||
if (!item.do_async_compilation) {
|
||||
/* Compilation will happen locally on shader bind. */
|
||||
glDeleteProgram(item.program);
|
||||
item.program = 0;
|
||||
item.shader->program_active_->program_id = 0;
|
||||
glDeleteProgram(item.program->program_id);
|
||||
item.program->program_id = 0;
|
||||
item.shader->constants.is_dirty = true;
|
||||
item.is_ready = true;
|
||||
continue;
|
||||
@@ -1985,15 +1984,15 @@ bool GLShaderCompiler::specialization_batch_is_ready(SpecializationBatchHandle &
|
||||
}
|
||||
else if (item.worker->is_ready()) {
|
||||
/* Retrieve the binary compiled by the worker. */
|
||||
if (item.worker->load_program_binary(item.program)) {
|
||||
item.worker->release();
|
||||
item.worker = nullptr;
|
||||
if (item.worker->load_program_binary(item.program->program_id)) {
|
||||
item.is_ready = true;
|
||||
}
|
||||
else {
|
||||
/* Compilation failed, local compilation will be tried later on shader bind. */
|
||||
item.do_async_compilation = false;
|
||||
}
|
||||
item.worker->release();
|
||||
item.worker = nullptr;
|
||||
}
|
||||
else if (worker_is_lost(item.worker)) {
|
||||
/* We lost the worker, local compilation will be tried later on shader bind. */
|
||||
|
||||
@@ -299,7 +299,7 @@ class GLShaderCompiler : public ShaderCompiler {
|
||||
|
||||
struct SpecializationWork {
|
||||
GLShader *shader = nullptr;
|
||||
GLuint program;
|
||||
GLShader::GLProgram *program = nullptr;
|
||||
GLSourcesBaked sources;
|
||||
|
||||
GLCompilerWorker *worker = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user