Archived

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

edwinnie

vram or sys mem?

Recommended Posts

mickey    100
hmm., this is thought to me by a guy here...,

reading from vram is slow so if you''re going to do things that needs to read the surface, put it in system memory instead. An example of this is alpha blending,

as much as possible, use your vram only for writing information, not reading,

Share this post


Link to post
Share on other sites
jdinger2    122
Blitting from VRAM to VRAM is fast. What I do is load my graphics in order of importance (ie: a bitmap that will be used a lot (main character) is loaded before a little used graphic (title screen)) by first trying to load into video ram and if that fails then load into system ram.

like this (semi pseudo-code):

HRESULT hr;
DDSURFACEDESC2 ddsd;
FunctionToSetUpAddsdForVidMem(&ddsd,width,height,vidram==true);
hr=lpDD->CreateSurface(&ddsd,&surface,NULL);
if(FAILED(hr))
{
FunctionToSetUpAddsdForSysMem(&ddsd,width,height,vidram==false);
hr=lpDD->CreateSurface(&ddsd,&surface,NULL);
}

This way my surface is loaded into vram if there''s enough available, but if not then in sys ram.


MSVC++ 6
DirectX 7

Share this post


Link to post
Share on other sites
edwinnie    122
ok, so how do u tell whether which involves reading or writing
vram more often?
(assuming we use vram throughout)

1) having a scrollable background image?
2) other animated objects that are present other than the main
character?
3) animated objects that last only for a very short period of
time?

thx!

Share this post


Link to post
Share on other sites
jdinger2    122
You shouldn''t need to read anything from memory do blit your background and sprite objects. When you set everything up you load your graphics and then when you need to blit them you just pass a pointer to the graphic surface.

Reading from memory would be getting per pixel data of the image for doing various effects like alpha-blending (as mickey mentioned).

MSVC++ 6
DirectX 7

Share this post


Link to post
Share on other sites