Merge pull request #91414 from Lateasusual/shader-globals-not-initialized

Ensure global shader sampler parameters are initialized when loading
This commit is contained in:
Rémi Verschelde 2024-05-01 20:32:34 +02:00
commit 81bcfe62a6
No known key found for this signature in database
GPG key ID: C3336907360768E1
2 changed files with 4 additions and 12 deletions

View file

@ -1966,13 +1966,9 @@ void MaterialStorage::global_shader_parameters_load_settings(bool p_load_texture
Variant value = d["value"];
if (gvtype >= RS::GLOBAL_VAR_TYPE_SAMPLER2D) {
//textire
if (!p_load_textures) {
continue;
}
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();
} else {
Ref<Resource> resource = ResourceLoader::load(path);

View file

@ -1656,13 +1656,9 @@ void MaterialStorage::global_shader_parameters_load_settings(bool p_load_texture
Variant value = d["value"];
if (gvtype >= RS::GLOBAL_VAR_TYPE_SAMPLER2D) {
//textire
if (!p_load_textures) {
continue;
}
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();
} else {
Ref<Resource> resource = ResourceLoader::load(path);