Fix: Cycles OSL random texture issue on macOS ARM
Shader compilation is multithreaded, this needs to be atomic. Pull Request: https://projects.blender.org/blender/blender/pulls/134854
This commit is contained in:
committed by
Brecht Van Lommel
parent
4b348453db
commit
b0fcd55aed
@@ -48,7 +48,7 @@ map<int, unique_ptr<OSL::ShadingSystem>> OSLShaderManager::ss_shared;
|
||||
int OSLShaderManager::ss_shared_users = 0;
|
||||
thread_mutex OSLShaderManager::ss_shared_mutex;
|
||||
|
||||
int OSLCompiler::texture_shared_unique_id = 0;
|
||||
std::atomic<int> OSLCompiler::texture_shared_unique_id = 0;
|
||||
|
||||
/* Shader Manager */
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <atomic>
|
||||
|
||||
#include "util/array.h"
|
||||
#include "util/set.h"
|
||||
#include "util/string.h"
|
||||
@@ -180,7 +182,7 @@ class OSLCompiler {
|
||||
ShaderType current_type;
|
||||
Shader *current_shader;
|
||||
|
||||
static int texture_shared_unique_id;
|
||||
static std::atomic<int> texture_shared_unique_id;
|
||||
};
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
Reference in New Issue
Block a user