Fix T77346: GPU Workaround Always Render Using Main Context
In Blender 2.90 EEVEE materials were refactored that introduced crashes on Intel GPUs on Windows. The crash happened in the `local_context_workaround` that temporary stored compiled materials in a binary form to reload it in the main GL context. It has been tested that the workaround isn't needed anymore for HD6xx GPUs, but it is still needed for HD4000. After several unsuccesfull fixes we came to the conclusion that we could not support the local context workaround and needed to come with a different workaround. The idea of this patch is that in these cases there is only a single context that is used for rendering. Threads that uses these contextes are guarded by a mutex and will block. Impact on User Level: * Due to main mutex lock the UI freezes when rendering or baking or feel less snappy Reviewed By: Clément Foucault, Brecht van Lommel Differential Revision: https://developer.blender.org/D8410
This commit is contained in:
@@ -62,6 +62,7 @@ static std::vector<GLuint> orphaned_buffer_ids;
|
||||
static std::vector<GLuint> orphaned_texture_ids;
|
||||
|
||||
static std::mutex orphans_mutex;
|
||||
static std::mutex main_context_mutex;
|
||||
|
||||
struct GPUContext {
|
||||
GLuint default_vao;
|
||||
@@ -345,3 +346,13 @@ struct GPUMatrixState *gpu_context_active_matrix_state_get()
|
||||
BLI_assert(active_ctx);
|
||||
return active_ctx->matrix_state;
|
||||
}
|
||||
|
||||
void GPU_context_main_lock(void)
|
||||
{
|
||||
main_context_mutex.lock();
|
||||
}
|
||||
|
||||
void GPU_context_main_unlock(void)
|
||||
{
|
||||
main_context_mutex.unlock();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user