diff options
Diffstat (limited to 'scene/resources')
-rw-r--r-- | scene/resources/surface_tool.cpp | 1 | ||||
-rw-r--r-- | scene/resources/visual_shader.cpp | 11 | ||||
-rw-r--r-- | scene/resources/visual_shader.h | 3 |
3 files changed, 9 insertions, 6 deletions
diff --git a/scene/resources/surface_tool.cpp b/scene/resources/surface_tool.cpp index 5ce3532d42..47933bd69a 100644 --- a/scene/resources/surface_tool.cpp +++ b/scene/resources/surface_tool.cpp @@ -299,6 +299,7 @@ void SurfaceTool::add_triangle_fan(const Vector<Vector3> &p_vertices, const Vect void SurfaceTool::add_index(int p_index) { ERR_FAIL_COND(!begun); + ERR_FAIL_COND(p_index < 0); format |= Mesh::ARRAY_FORMAT_INDEX; index_array.push_back(p_index); diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp index a296156bf5..d8e63e47be 100644 --- a/scene/resources/visual_shader.cpp +++ b/scene/resources/visual_shader.cpp @@ -1400,11 +1400,11 @@ bool VisualShader::has_func_name(RenderingServer::ShaderMode p_mode, const Strin } void VisualShader::_update_shader() const { - if (!dirty) { + if (!dirty.is_set()) { return; } - dirty = false; + dirty.clear(); StringBuilder global_code; StringBuilder global_code_per_node; @@ -1590,11 +1590,11 @@ void VisualShader::_update_shader() const { } void VisualShader::_queue_update() { - if (dirty) { + if (dirty.is_set()) { return; } - dirty = true; + dirty.set(); call_deferred("_update_shader"); } @@ -1614,7 +1614,7 @@ void VisualShader::_input_type_changed(Type p_type, int p_id) { } void VisualShader::rebuild() { - dirty = true; + dirty.set(); _update_shader(); } @@ -1668,6 +1668,7 @@ void VisualShader::_bind_methods() { } VisualShader::VisualShader() { + dirty.set(); for (int i = 0; i < TYPE_MAX; i++) { Ref<VisualShaderNodeOutput> output; output.instance(); diff --git a/scene/resources/visual_shader.h b/scene/resources/visual_shader.h index f3f3caf15e..ef724c7650 100644 --- a/scene/resources/visual_shader.h +++ b/scene/resources/visual_shader.h @@ -32,6 +32,7 @@ #define VISUAL_SHADER_H #include "core/string/string_builder.h" +#include "core/templates/safe_refcount.h" #include "scene/gui/control.h" #include "scene/resources/shader.h" @@ -99,7 +100,7 @@ private: static RenderModeEnums render_mode_enums[]; - volatile mutable bool dirty = true; + mutable SafeFlag dirty; void _queue_update(); union ConnectionKey { |