Merge pull request #52475 from tcoxon/fix_43733_3.x
Prevent shaders from generating code before the constructor finishes. [3.x]
This commit is contained in:
@ -176,7 +176,7 @@ void CanvasItemMaterial::flush_changes() {
|
|||||||
void CanvasItemMaterial::_queue_shader_change() {
|
void CanvasItemMaterial::_queue_shader_change() {
|
||||||
material_mutex.lock();
|
material_mutex.lock();
|
||||||
|
|
||||||
if (!element.in_list()) {
|
if (is_initialized && !element.in_list()) {
|
||||||
dirty_materials->add(&element);
|
dirty_materials->add(&element);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -313,6 +313,7 @@ CanvasItemMaterial::CanvasItemMaterial() :
|
|||||||
|
|
||||||
current_key.key = 0;
|
current_key.key = 0;
|
||||||
current_key.invalid_key = 1;
|
current_key.invalid_key = 1;
|
||||||
|
is_initialized = true;
|
||||||
_queue_shader_change();
|
_queue_shader_change();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -113,6 +113,7 @@ private:
|
|||||||
_FORCE_INLINE_ void _queue_shader_change();
|
_FORCE_INLINE_ void _queue_shader_change();
|
||||||
_FORCE_INLINE_ bool _is_shader_dirty() const;
|
_FORCE_INLINE_ bool _is_shader_dirty() const;
|
||||||
|
|
||||||
|
bool is_initialized = false;
|
||||||
BlendMode blend_mode;
|
BlendMode blend_mode;
|
||||||
LightMode light_mode;
|
LightMode light_mode;
|
||||||
bool particles_animation;
|
bool particles_animation;
|
||||||
|
|||||||
@ -1073,7 +1073,7 @@ void SpatialMaterial::flush_changes() {
|
|||||||
void SpatialMaterial::_queue_shader_change() {
|
void SpatialMaterial::_queue_shader_change() {
|
||||||
material_mutex.lock();
|
material_mutex.lock();
|
||||||
|
|
||||||
if (!element.in_list()) {
|
if (is_initialized && !element.in_list()) {
|
||||||
dirty_materials->add(&element);
|
dirty_materials->add(&element);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2317,6 +2317,7 @@ SpatialMaterial::SpatialMaterial() :
|
|||||||
|
|
||||||
current_key.key = 0;
|
current_key.key = 0;
|
||||||
current_key.invalid_key = 1;
|
current_key.invalid_key = 1;
|
||||||
|
is_initialized = true;
|
||||||
_queue_shader_change();
|
_queue_shader_change();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -366,6 +366,7 @@ private:
|
|||||||
_FORCE_INLINE_ void _queue_shader_change();
|
_FORCE_INLINE_ void _queue_shader_change();
|
||||||
_FORCE_INLINE_ bool _is_shader_dirty() const;
|
_FORCE_INLINE_ bool _is_shader_dirty() const;
|
||||||
|
|
||||||
|
bool is_initialized = false;
|
||||||
Color albedo;
|
Color albedo;
|
||||||
float specular;
|
float specular;
|
||||||
float metallic;
|
float metallic;
|
||||||
|
|||||||
@ -690,7 +690,7 @@ void ParticlesMaterial::flush_changes() {
|
|||||||
void ParticlesMaterial::_queue_shader_change() {
|
void ParticlesMaterial::_queue_shader_change() {
|
||||||
material_mutex.lock();
|
material_mutex.lock();
|
||||||
|
|
||||||
if (!element.in_list()) {
|
if (is_initialized && !element.in_list()) {
|
||||||
dirty_materials->add(&element);
|
dirty_materials->add(&element);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1367,6 +1367,7 @@ ParticlesMaterial::ParticlesMaterial() :
|
|||||||
current_key.key = 0;
|
current_key.key = 0;
|
||||||
current_key.invalid_key = 1;
|
current_key.invalid_key = 1;
|
||||||
|
|
||||||
|
is_initialized = true;
|
||||||
_queue_shader_change();
|
_queue_shader_change();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -203,6 +203,7 @@ private:
|
|||||||
_FORCE_INLINE_ void _queue_shader_change();
|
_FORCE_INLINE_ void _queue_shader_change();
|
||||||
_FORCE_INLINE_ bool _is_shader_dirty() const;
|
_FORCE_INLINE_ bool _is_shader_dirty() const;
|
||||||
|
|
||||||
|
bool is_initialized = false;
|
||||||
Vector3 direction;
|
Vector3 direction;
|
||||||
float spread;
|
float spread;
|
||||||
float flatness;
|
float flatness;
|
||||||
|
|||||||
Reference in New Issue
Block a user