Skip to content

Commit 81bcfe6

Browse files
committed
Merge pull request #91414 from Lateasusual/shader-globals-not-initialized
Ensure global shader sampler parameters are initialized when loading
2 parents 76afc98 + 44364fa commit 81bcfe6

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

drivers/gles3/storage/material_storage.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1966,13 +1966,9 @@ void MaterialStorage::global_shader_parameters_load_settings(bool p_load_texture
19661966
Variant value = d["value"];
19671967

19681968
if (gvtype >= RS::GLOBAL_VAR_TYPE_SAMPLER2D) {
1969-
//textire
1970-
if (!p_load_textures) {
1971-
continue;
1972-
}
1973-
19741969
String path = value;
1975-
if (path.is_empty()) {
1970+
// Don't load the textures, but still add the parameter so shaders compile correctly while loading.
1971+
if (!p_load_textures || path.is_empty()) {
19761972
value = RID();
19771973
} else {
19781974
Ref<Resource> resource = ResourceLoader::load(path);

servers/rendering/renderer_rd/storage_rd/material_storage.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1656,13 +1656,9 @@ void MaterialStorage::global_shader_parameters_load_settings(bool p_load_texture
16561656
Variant value = d["value"];
16571657

16581658
if (gvtype >= RS::GLOBAL_VAR_TYPE_SAMPLER2D) {
1659-
//textire
1660-
if (!p_load_textures) {
1661-
continue;
1662-
}
1663-
16641659
String path = value;
1665-
if (path.is_empty()) {
1660+
// Don't load the textures, but still add the parameter so shaders compile correctly while loading.
1661+
if (!p_load_textures || path.is_empty()) {
16661662
value = RID();
16671663
} else {
16681664
Ref<Resource> resource = ResourceLoader::load(path);

0 commit comments

Comments
 (0)