so i try to save a lot of rt's after each other (animation image sequence), and for a reason i don't understand it slow downs awfully at a certain point.
in the following test code it is fast until ~245 frames and then each next frame takes as much time as all the previous ones together or something like this:
for j=1,1000 do
rt=RenderTarget.new(1024,1024)
rt:save("d:/test/test"..j..".png")
rt=nil
end |
is it a bug in gideros? or what should i do? i tried with a coroutine that is yielded once per enterframe but the same thing happens.
Comments
however, in my use case i actually have a huge table of rt's and i'm saving them one.
Fragmenter - animated loop machine and IKONOMIKON - the memory game
Fragmenter - animated loop machine and IKONOMIKON - the memory game
http://luatut.com/collectgarbage.html
Devices nowadays have huge amount of memory - no need to worry about it.
https://deluxepixel.com
Fragmenter - animated loop machine and IKONOMIKON - the memory game
Likes: SinisterSoft, totebo
https://deluxepixel.com
https://deluxepixel.com
what i want is a kind of 'video capture as an image sequence' but the problem is that saving a screenshot takes more time than an enterframe (1/60 sec), so it won't work realtime. perhaps i should make a save only after every second enterframe, but as a 'save' is one event, i guess it would still make it lag.
so my workaround was that i make only the rt and only save all rt's after such a 'realtime capture session'. but as you said, memory gets out of hands quickly.
let me know if you have other ideas about it.
btw with some smaller screen area (800x600) it seemed to work as i wanted.actually while creating those many rt's when the texture memory got around 4gb then it went back to almost zero (saved the texture memory to normal memory or i dunno what happened) and again started to increase. still at the end saving to a file all rt's it worked, without the big slowdown i was talking about.
Fragmenter - animated loop machine and IKONOMIKON - the memory game
Then reconstruct each frame later on (non realtime) and save them.
for the time being i decided to restrict 'live recording' to 30fps (and i save the frame immediately to file, so there is no huge array built) and that works with a tolerable lag. this way also there is no long postprocessing stage, which is good.
still i think there is a question left open about how rt:save() is using memory, how can it lag so much - as in my previous example the save loop lagged and not the rtArray[i]:new() loop.
Fragmenter - animated loop machine and IKONOMIKON - the memory game
Really I don't think rt:save() consume memory, and all in all not GC-based memory, IMO the issue is more something in OpenGL driver, having to copy texture data from/to GPU memory to cope with GPU memory size. Dealing with that much memory, maybe your computer uses swap, etc. But, in a sense you are right, because I can't explain why GC'ing regularly would help...
https://deluxepixel.com
that's good but not perfect as that will also grabs the mouse cursor, the gui, etc of my animating app, while optimally only the drawing area is saved.
Fragmenter - animated loop machine and IKONOMIKON - the memory game
i can also think of at least two solutions which would be better for me in many other ways:
1. multiple window gideros pc application, now that we have viewports, the sdk framework is essentially there. would this be very hard to add for the core developers?
2. being able to 'send via Spout' a viewport.
i even tried this but there was not enough help for me to get started:
http://giderosmobile.com/forum/discussion/6398/is-it-possible-to-make-my-gideros-app-work-with-spout#Item_10
here @hgy29 tried to help me, but it was far from enough for me. i tried to make an uwp exported app, so that maybe i can hack in it the feature i need, but i failed already at the first step of running the uwp app:
http://giderosmobile.com/forum/discussion/6709/uwp-exported-project-not-running#Item_1
in processing and many other frameworks there is a plugin to Spout, but it seems that i'm unable to write one for gideros with my current knowledge.
(thanks for spending time on my problem)
Fragmenter - animated loop machine and IKONOMIKON - the memory game
That way we could say that one of the stages isn't actually a normal output, but is in fact a remote screen - eg chromecast.
In windows the stage would be a real 2nd window away from the normal window.
Likes: keszegh
https://deluxepixel.com