Merge pull request #94628 from Chaosus/rendering_fix_crash
Fix crash when assigning more textures than expected to texture array
This commit is contained in:
commit
ad1955a63d
2 changed files with 4 additions and 2 deletions
|
@ -874,7 +874,8 @@ void MaterialData::update_textures(const HashMap<StringName, Variant> &p_paramet
|
||||||
if (V->value.is_array()) {
|
if (V->value.is_array()) {
|
||||||
Array array = (Array)V->value;
|
Array array = (Array)V->value;
|
||||||
if (uniform_array_size > 0) {
|
if (uniform_array_size > 0) {
|
||||||
for (int j = 0; j < array.size(); j++) {
|
int size = MIN(uniform_array_size, array.size());
|
||||||
|
for (int j = 0; j < size; j++) {
|
||||||
textures.push_back(array[j]);
|
textures.push_back(array[j]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -807,7 +807,8 @@ void MaterialStorage::MaterialData::update_textures(const HashMap<StringName, Va
|
||||||
if (V->value.is_array()) {
|
if (V->value.is_array()) {
|
||||||
Array array = (Array)V->value;
|
Array array = (Array)V->value;
|
||||||
if (uniform_array_size > 0) {
|
if (uniform_array_size > 0) {
|
||||||
for (int j = 0; j < array.size(); j++) {
|
int size = MIN(uniform_array_size, array.size());
|
||||||
|
for (int j = 0; j < size; j++) {
|
||||||
textures.push_back(array[j]);
|
textures.push_back(array[j]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue