Archived

This topic is now archived and is closed to further replies.

Mr Cucumber

Moving surfaces in memory

Recommended Posts

What can I do to move a (texture) surface from video to system memory or from system to video? I have looked at the SetSurfaceDesc function but it seems as that only works with system memory surfaces. So is there any fast way to do it without having to release and then recreate it with different memoryflags?

Share this post


Link to post
Share on other sites
As always there are different ways to do it :

1. If you wan''t to move your surface because of texture managment in your application,
(moving currently unused textures from vid-mem to sys-mem , and moving currently needed textures from sys-mem to vid-mem)

you can DX handle this for you (new since Dx7.0),
When creating your texture surfaces do the following :
(DDSURFACEDESC2 ddsd
ddsd.ddsCaps.dwCaps2 = DDSCAPS2_TEXTUREMANAGE;

There are also some hint Values you can set :
DDSCAPS2_HINTDYNAMIC
DDSCAPS2_HINTSTATIC
DDSCAPS2_OPAQUE

the hints are used to tell dx how to exactly manage the textures.
look into the sdk-help for more info on them.

2. The second way (if you don''t want to do texture-managment)
You realy got to create the surface in vid-mem again and blit
the data from the old surface to your new vid-mem surface.
And of cauze don''t forgett to release the old-surface.

There is no other way i know of.

Share this post


Link to post
Share on other sites