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:
Brecht Van Lommel
2025-02-20 16:32:44 +01:00
committed by Brecht Van Lommel
parent 4b348453db
commit b0fcd55aed
2 changed files with 4 additions and 2 deletions

View File

@@ -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 */

View File

@@ -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