Skip to content

Commit

Permalink
Fix loading mipmaps, if the mipmap levels have different formats.
Browse files Browse the repository at this point in the history
  • Loading branch information
mortarroad committed Aug 12, 2021
1 parent bf383a3 commit 0e26f17
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions scene/resources/texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,10 @@ Error StreamTexture::_load_data(const String &p_path, int &tw, int &th, int &tw_
ERR_FAIL_COND_V(img.is_null() || img->empty(), ERR_FILE_CORRUPT);
}

if (i != 0) {
img->convert(mipmap_images[0]->get_format()); // ensure the same format for all mipmaps
}

total_size += img->get_data().size();

mipmap_images.push_back(img);
Expand Down

0 comments on commit 0e26f17

Please sign in to comment.