summaryrefslogtreecommitdiffstats
path: root/drivers/gles3/storage/texture_storage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gles3/storage/texture_storage.cpp')
-rw-r--r--drivers/gles3/storage/texture_storage.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/gles3/storage/texture_storage.cpp b/drivers/gles3/storage/texture_storage.cpp
index 4e34fbcf0a..5a59f6c772 100644
--- a/drivers/gles3/storage/texture_storage.cpp
+++ b/drivers/gles3/storage/texture_storage.cpp
@@ -766,7 +766,7 @@ void TextureStorage::texture_2d_layered_initialize(RID p_texture, const Vector<R
ERR_FAIL_COND(p_layered_type == RS::TEXTURE_LAYERED_CUBEMAP && p_layers.size() != 6);
ERR_FAIL_COND_MSG(p_layered_type == RS::TEXTURE_LAYERED_CUBEMAP_ARRAY, "Cubemap Arrays are not supported in the GL Compatibility backend.");
- Ref<Image> image = p_layers[0];
+ const Ref<Image> &image = p_layers[0];
{
int valid_width = 0;
int valid_height = 0;
@@ -1475,7 +1475,7 @@ void TextureStorage::update_texture_atlas() {
//generate atlas
Vector<TextureAtlas::SortItem> itemsv;
itemsv.resize(texture_atlas.textures.size());
- int base_size = 8;
+ uint32_t base_size = 8;
int idx = 0;
@@ -1488,7 +1488,7 @@ void TextureStorage::update_texture_atlas() {
si.size.height = (src_tex->height / border) + 1;
si.pixel_size = Size2i(src_tex->width, src_tex->height);
- if (base_size < si.size.width) {
+ if (base_size < (uint32_t)si.size.width) {
base_size = nearest_power_of_2_templated(si.size.width);
}
@@ -1519,7 +1519,7 @@ void TextureStorage::update_texture_atlas() {
TextureAtlas::SortItem &si = items[i];
int best_idx = -1;
int best_height = 0x7FFFFFFF;
- for (int j = 0; j <= base_size - si.size.width; j++) {
+ for (uint32_t j = 0; j <= base_size - si.size.width; j++) {
int height = 0;
for (int k = 0; k < si.size.width; k++) {
int h = v_offsets[k + j];
@@ -1550,7 +1550,7 @@ void TextureStorage::update_texture_atlas() {
}
}
- if (max_height <= base_size * 2) {
+ if ((uint32_t)max_height <= base_size * 2) {
atlas_height = max_height;
break; //good ratio, break;
}
@@ -2647,7 +2647,10 @@ void TextureStorage::render_target_copy_to_back_buffer(RID p_render_target, cons
glBindFramebuffer(GL_FRAMEBUFFER, rt->backbuffer_fbo);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, rt->color);
- GLES3::CopyEffects::get_singleton()->copy_screen();
+ Rect2 normalized_region = region;
+ normalized_region.position = normalized_region.position / Size2(rt->size);
+ normalized_region.size = normalized_region.size / Size2(rt->size);
+ GLES3::CopyEffects::get_singleton()->copy_to_and_from_rect(normalized_region);
if (p_gen_mipmaps) {
GLES3::CopyEffects::get_singleton()->gaussian_blur(rt->backbuffer, rt->mipmap_count, region, rt->size);