Merge pull request #71878 from bitsawer/fix_shader_dependencies

Fix shader include dependency handling
This commit is contained in:
Rémi Verschelde 2023-01-24 09:47:28 +01:00
commit 06c930caf1
No known key found for this signature in database
GPG Key ID: C3336907360768E1
2 changed files with 6 additions and 2 deletions

View File

@ -42,9 +42,12 @@ Shader::Mode Shader::get_mode() const {
}
void Shader::_dependency_changed() {
RenderingServer::get_singleton()->shader_set_code(shader, RenderingServer::get_singleton()->shader_get_code(shader));
// Preprocess and compile the code again because a dependency has changed. It also calls emit_changed() for us.
_recompile();
}
emit_changed();
void Shader::_recompile() {
set_code(get_code());
}
void Shader::set_path(const String &p_path, bool p_take_over) {

View File

@ -60,6 +60,7 @@ private:
HashMap<StringName, HashMap<int, Ref<Texture2D>>> default_textures;
void _dependency_changed();
void _recompile();
virtual void _update_shader() const; //used for visual shader
Array _get_shader_uniform_list(bool p_get_groups = false);