Advertisement

vram or sys mem?

Started by May 03, 2002 02:18 AM
4 comments, last by edwinnie 22 years, 6 months ago
which is recommended for use? vram or the system memory?
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,
http://www.dualforcesolutions.comProfessional website designs and development, customized business systems, etc.,
Advertisement
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
MSVC++ 6DirectX 7
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!
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
MSVC++ 6DirectX 7
i see

This topic is closed to new replies.

Advertisement