Render_target memory allocation

tldr: i want calling render.render_target('constant_name', some_parameters) multiple times to automatically deallocate previous render targets with the same name (or throw warning about having multiple targets with the same name). Or remove that ‘name’ field as it seems to be not used anywhere.

What is the purpose of the name parameter in render.render_target? It can’t be used anywhere and i assumed that if i call render.render_target multiple times with the same name then old target is deleted and new one is created over it. What really happens is that i get ‘gl out of memory’ crash after some time because i don’t call render.delete_render_target manually. Maybe engine should automatically deallocate previous targets with the same name or throw warning when that happens (or remove name field entirely if its not used anywhere and might confuse someone like me)?

2 Likes

The name seems to just be used internally to get rendertargets by name/hash, but nothing that is exposed to render script (as far as I can see). Agreed, we should definitely explain this better in the documentation. It will pose a problem for backwards compatibility to just remove it, but it might be something we will use later down the road. Thanks for pointing it out! :slight_smile:

2 Likes

I’m a bit curious now - can something break if i decide to use two render textures with the same name?

1 Like

As far as I can tell, no. But this raises a couple of good questions that we might need to look into in the engine team. :thumbsup:

2 Likes

Yey, i found more (like you don’t have enough with all the native extensions on youd hands) work for you guys! :nerd: Thx for the answers

1 Like

Hahaha, no problemo, that’s our job!

4 Likes