Browse Source

Ensure global shader sampler parameters are initialized when loading the editor

Chris Clyne 1 năm trước cách đây
mục cha
commit
44364faee5

+ 2 - 6
drivers/gles3/storage/material_storage.cpp

@@ -1966,13 +1966,9 @@ void MaterialStorage::global_shader_parameters_load_settings(bool p_load_texture
 			Variant value = d["value"];
 			Variant value = d["value"];
 
 
 			if (gvtype >= RS::GLOBAL_VAR_TYPE_SAMPLER2D) {
 			if (gvtype >= RS::GLOBAL_VAR_TYPE_SAMPLER2D) {
-				//textire
-				if (!p_load_textures) {
-					continue;
-				}
-
 				String path = value;
 				String path = value;
-				if (path.is_empty()) {
+				// Don't load the textures, but still add the parameter so shaders compile correctly while loading.
+				if (!p_load_textures || path.is_empty()) {
 					value = RID();
 					value = RID();
 				} else {
 				} else {
 					Ref<Resource> resource = ResourceLoader::load(path);
 					Ref<Resource> resource = ResourceLoader::load(path);

+ 2 - 6
servers/rendering/renderer_rd/storage_rd/material_storage.cpp

@@ -1656,13 +1656,9 @@ void MaterialStorage::global_shader_parameters_load_settings(bool p_load_texture
 			Variant value = d["value"];
 			Variant value = d["value"];
 
 
 			if (gvtype >= RS::GLOBAL_VAR_TYPE_SAMPLER2D) {
 			if (gvtype >= RS::GLOBAL_VAR_TYPE_SAMPLER2D) {
-				//textire
-				if (!p_load_textures) {
-					continue;
-				}
-
 				String path = value;
 				String path = value;
-				if (path.is_empty()) {
+				// Don't load the textures, but still add the parameter so shaders compile correctly while loading.
+				if (!p_load_textures || path.is_empty()) {
 					value = RID();
 					value = RID();
 				} else {
 				} else {
 					Ref<Resource> resource = ResourceLoader::load(path);
 					Ref<Resource> resource = ResourceLoader::load(path);