Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DLL Talk / [Image Kit] How to make a render target into a normal image?

Author
Message
JohnBarbarossa
14
Years of Service
User Offline
Joined: 9th Jul 2009
Location:
Posted: 17th Jul 2012 17:16
I am experimenting a little bit with the commands of the Image Kit plugin. I am rewriting a function which uses a lot of get image command and as a result is very slow.

I managed to rewrite most of the function with the Image Kit commands and Ian M's Draw to command.

However when my function end I am left with 3 render target images which I want to convert into normal images again so the rest of my program can use them.

How can I do that?
Diggsey
17
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 17th Jul 2012 18:08
For most things you should be able to use render target images like normal images what exactly is not working? The only thing they don't support is locking because they exist in video memory rather than main memory, and transferring data from video memory to main memory is very slow (this is what "get image" does). If you really need to do it though you can use "get image" to convert a render target into a normal image.

[b]
JohnBarbarossa
14
Years of Service
User Offline
Joined: 9th Jul 2009
Location:
Posted: 17th Jul 2012 19:02
I get an error later on in my program when I use:
make memblock from image
Diggsey
17
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 17th Jul 2012 21:17 Edited at: 17th Jul 2012 21:17
Yes, that command locks the image, which doesn't work if the image is in video memory. Transferring data from a render target to main memory is always going to be slow, so you can either accept the performance hit by using "draw to image" followed by "get image" or you can try to avoid the situation altogether. What exactly are you trying to achieve overall?

[b]
JohnBarbarossa
14
Years of Service
User Offline
Joined: 9th Jul 2009
Location:
Posted: 18th Jul 2012 01:08 Edited at: 18th Jul 2012 01:10
My source is around 10.000 lines now, with get image commands used all over the place. On several places I have written functions wich manipulate images through memblocks because otherwise it would have been too slow.

On one point the get image commands slowness was really getting unacceptable so I wanted to rewrite that function (which I did) and probably leave the rest of the code intact.

I guess I could try to end the function with a draw to image followed by get image and see if there is enough overal gain (because I eleminated a lot of get images in the function previously). Or I could see if I could do something about the memblock functions (now I know that most other commands will probably still work on render images).

This leads me to the following (newbie) question. Doesn't leaving all the images in videomemory lead to problems in the long run? For example when the videocard memory overflows?

Login to post a reply

Server time is: 2024-03-28 18:01:38
Your offset time is: 2024-03-28 18:01:38