Skip to content

Commit b70ebab

Browse files
committed
Rendering: Don't cache image in editor build
1 parent b5fb870 commit b70ebab

File tree

4 files changed

+0
-52
lines changed

4 files changed

+0
-52
lines changed

drivers/gles3/storage/texture_storage.cpp

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,10 +1004,6 @@ void TextureStorage::texture_2d_update(RID p_texture, const Ref<Image> &p_image,
10041004
Texture *tex = texture_owner.get_or_null(p_texture);
10051005
ERR_FAIL_NULL(tex);
10061006
GLES3::Utilities::get_singleton()->texture_resize_data(tex->tex_id, tex->total_data_size);
1007-
1008-
#ifdef TOOLS_ENABLED
1009-
tex->image_cache_2d.unref();
1010-
#endif
10111007
}
10121008

10131009
void TextureStorage::texture_3d_update(RID p_texture, const Vector<Ref<Image>> &p_data) {
@@ -1084,12 +1080,6 @@ Ref<Image> TextureStorage::texture_2d_get(RID p_texture) const {
10841080
Texture *texture = texture_owner.get_or_null(p_texture);
10851081
ERR_FAIL_NULL_V(texture, Ref<Image>());
10861082

1087-
#ifdef TOOLS_ENABLED
1088-
if (texture->image_cache_2d.is_valid() && !texture->is_render_target) {
1089-
return texture->image_cache_2d;
1090-
}
1091-
#endif
1092-
10931083
Ref<Image> image;
10941084
#ifdef GL_API_ENABLED
10951085
if (RasterizerGLES3::is_gles_over_gl()) {
@@ -1199,12 +1189,6 @@ Ref<Image> TextureStorage::texture_2d_get(RID p_texture) const {
11991189
}
12001190
#endif // GLES_API_ENABLED
12011191

1202-
#ifdef TOOLS_ENABLED
1203-
if (Engine::get_singleton()->is_editor_hint() && !texture->is_render_target) {
1204-
texture->image_cache_2d = image;
1205-
}
1206-
#endif
1207-
12081192
return image;
12091193
}
12101194

@@ -1325,12 +1309,6 @@ Vector<Ref<Image>> TextureStorage::texture_3d_get(RID p_texture) const {
13251309
ERR_FAIL_NULL_V(texture, Vector<Ref<Image>>());
13261310
ERR_FAIL_COND_V(texture->type != Texture::TYPE_3D, Vector<Ref<Image>>());
13271311

1328-
#ifdef TOOLS_ENABLED
1329-
if (!texture->image_cache_3d.is_empty() && !texture->is_render_target) {
1330-
return texture->image_cache_3d;
1331-
}
1332-
#endif
1333-
13341312
GLuint temp_framebuffer;
13351313
glGenFramebuffers(1, &temp_framebuffer);
13361314

@@ -1361,12 +1339,6 @@ Vector<Ref<Image>> TextureStorage::texture_3d_get(RID p_texture) const {
13611339
glDeleteTextures(1, &temp_color_texture);
13621340
glDeleteFramebuffers(1, &temp_framebuffer);
13631341

1364-
#ifdef TOOLS_ENABLED
1365-
if (Engine::get_singleton()->is_editor_hint() && !texture->is_render_target) {
1366-
texture->image_cache_3d = ret;
1367-
}
1368-
#endif
1369-
13701342
return ret;
13711343
}
13721344

@@ -1719,12 +1691,6 @@ void TextureStorage::_texture_set_3d_data(RID p_texture, const Vector<Ref<Image>
17191691

17201692
texture->total_data_size = all_data_size;
17211693
texture->mipmaps = mipmap_level + 1;
1722-
1723-
#ifdef TOOLS_ENABLED
1724-
if (Engine::get_singleton()->is_editor_hint() && !texture->is_render_target) {
1725-
texture->image_cache_3d = images;
1726-
}
1727-
#endif
17281694
}
17291695

17301696
void TextureStorage::_texture_set_swizzle(GLES3::Texture *p_texture, Image::Format p_real_format) {

drivers/gles3/storage/texture_storage.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,6 @@ struct Texture {
191191

192192
RenderTarget *render_target = nullptr;
193193

194-
Ref<Image> image_cache_2d;
195-
Vector<Ref<Image>> image_cache_3d;
196-
197194
bool redraw_if_visible = false;
198195

199196
RS::TextureDetectCallback detect_3d_callback = nullptr;

servers/rendering/renderer_rd/storage_rd/texture_storage.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1319,9 +1319,6 @@ void TextureStorage::_texture_2d_update(RID p_texture, const Ref<Image> &p_image
13191319
ERR_FAIL_INDEX(p_layer, tex->layers);
13201320
}
13211321

1322-
#ifdef TOOLS_ENABLED
1323-
tex->image_cache_2d.unref();
1324-
#endif
13251322
TextureToRDFormat f;
13261323
Ref<Image> validated = _validate_texture_format(p_image, f);
13271324

@@ -1437,11 +1434,6 @@ Ref<Image> TextureStorage::texture_2d_get(RID p_texture) const {
14371434
Texture *tex = texture_owner.get_or_null(p_texture);
14381435
ERR_FAIL_NULL_V(tex, Ref<Image>());
14391436

1440-
#ifdef TOOLS_ENABLED
1441-
if (tex->image_cache_2d.is_valid() && !tex->is_render_target) {
1442-
return tex->image_cache_2d;
1443-
}
1444-
#endif
14451437
Vector<uint8_t> data = RD::get_singleton()->texture_get_data(tex->rd_texture, 0);
14461438
ERR_FAIL_COND_V(data.is_empty(), Ref<Image>());
14471439
Ref<Image> image;
@@ -1482,12 +1474,6 @@ Ref<Image> TextureStorage::texture_2d_get(RID p_texture) const {
14821474
image->convert(tex->format);
14831475
}
14841476

1485-
#ifdef TOOLS_ENABLED
1486-
if (Engine::get_singleton()->is_editor_hint() && !tex->is_render_target) {
1487-
tex->image_cache_2d = image;
1488-
}
1489-
#endif
1490-
14911477
return image;
14921478
}
14931479

servers/rendering/renderer_rd/storage_rd/texture_storage.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@ class TextureStorage : public RendererTextureStorage {
173173
bool is_render_target;
174174
bool is_proxy;
175175

176-
Ref<Image> image_cache_2d;
177176
String path;
178177

179178
RID proxy_to;

0 commit comments

Comments
 (0)