mirror of https://github.com/godotengine/godot
Merge pull request #100364 from RandomShaper/fix_mtl_mt_deadlock_4.3
[4.3] Fix deadlock possibility in threaded load of materials
This commit is contained in:
commit
63e0fb55f9
|
|
@ -157,9 +157,13 @@ void CanvasItemMaterial::flush_changes() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CanvasItemMaterial::_queue_shader_change() {
|
void CanvasItemMaterial::_queue_shader_change() {
|
||||||
|
if (!_is_initialized()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
MutexLock lock(material_mutex);
|
MutexLock lock(material_mutex);
|
||||||
|
|
||||||
if (_is_initialized() && !element.in_list()) {
|
if (!element.in_list()) {
|
||||||
dirty_materials.add(&element);
|
dirty_materials.add(&element);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1886,9 +1886,13 @@ void BaseMaterial3D::flush_changes() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseMaterial3D::_queue_shader_change() {
|
void BaseMaterial3D::_queue_shader_change() {
|
||||||
|
if (!_is_initialized()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
MutexLock lock(material_mutex);
|
MutexLock lock(material_mutex);
|
||||||
|
|
||||||
if (_is_initialized() && !element.in_list()) {
|
if (!element.in_list()) {
|
||||||
dirty_materials.add(&element);
|
dirty_materials.add(&element);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1164,9 +1164,13 @@ void ParticleProcessMaterial::flush_changes() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParticleProcessMaterial::_queue_shader_change() {
|
void ParticleProcessMaterial::_queue_shader_change() {
|
||||||
|
if (!_is_initialized()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
MutexLock lock(material_mutex);
|
MutexLock lock(material_mutex);
|
||||||
|
|
||||||
if (_is_initialized() && !element.in_list()) {
|
if (!element.in_list()) {
|
||||||
dirty_materials.add(&element);
|
dirty_materials.add(&element);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue