Jump to content
  • Advertisement

Archived

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

FunkyTune

Offscreen surfaces in video memory being terribly slow in DDraw7

This topic is 5890 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I create the primary buffer and the backbuffer in video memory. Then, if I create my offscreen surfaces(sprites) in system memory with the DDSCAPS_SYSTEMMEMORY flag, i get around 60 fps. However, if I create my sprites in video memory (DDSCAPS_VIDEOMEMORY), which I thought was the best choice, I get about 6 (six) fps. The profiling shows that blitting a 16x16 surface to the backbuffer takes about 17 ms! Does anyone have any suggestions what I am doing wrong? /John

Share this post


Link to post
Share on other sites
Advertisement
quote:
Original post by Carrot
Are you reading from video mem anywhere (locking surfaces etc)?



Yes, I am, but the function that does that comes far down the profiling list, and is not related to the blitting.
However, I removed that function just to be sure, but I''m still getting the same lousy fps.

Share this post


Link to post
Share on other sites
Sounds like a bandwidth/flush problem somewhere but its hard to say why.
What spec card do you have, and are you sure the surfaces are actually being created where you say?
Can you post some initialisation code?

Share this post


Link to post
Share on other sites
it dont matter how often you call the funtion that reads from vram. reading from vram is VERY VERY slow. you should NEVER need to lock a vram surface except ot write to it. in fact, if you have vram offscreen surfaces, you should be soly using blit to deal with them after your ONE time initlization and loading of images. blitting from an offscreen surface to your BACKbuffer should be quick. make sure you are NOT blitting to your primary buffer. NO locking of the surfaces either, that is bad and not needed.

Share this post


Link to post
Share on other sites
I think I remember reading a while ago that OFFSCREEN surfaces do not gaurantee a texture will be placed in video memory, maybe some special texture ram or even system. I think there might be a VID mem flag you can try and if that fails you should just dump everything in system.

Share this post


Link to post
Share on other sites
OK, here''s some of my init code:


  
DDSURFACEDESC ddsd;
DDE_INITSTRUCT(ddsd);
ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;

ddsd.dwWidth = width;
ddsd.dwHeight = height;

ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN |
DDSCAPS_VIDEOMEMORY; //<- Problem is here (I think)


//Allocate memory for the surfaces

if(!( lpdds = (LPDIRECTDRAWSURFACE*) malloc(numFrames * sizeof(LPDIRECTDRAWSURFACE)) ))
return(0);

//Create surfaces

int i;
for (i=0; i<numFrames; i++)
{
if (dde->getDirectDrawObj()->CreateSurface(&ddsd, &lpdds[i], NULL) != DD_OK)
return(0);
}


I''m really appreciating your help, by the way.

/John

Share this post


Link to post
Share on other sites
quote:

ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN |
DDSCAPS_VIDEOMEMORY; //<- Problem is here (I think)]



Try:

ddsd.ddsCaps.dwCaps = DSCAPS_OFFSCREENPLAIN |
DDSCAPS_SYSTEMMEMORY;

Guy

Share this post


Link to post
Share on other sites
ddsd.ddsCaps.dwCaps = DDSCAPS_VIDEOMEMORY;

And... try just this and report back your frame rate... Don''t forget to check your return values because your video card may not have enough room for all your textures.

Share this post


Link to post
Share on other sites
Arion: I normally use the DDSCAPS_SYSTEMMEMORY flag, as I said in my first post. With that, everything works fine, but I''ve read that you should create as many of your sprites as you can in video memory, so I was a bit surprised with the lousy performance I got with DDSCAPS_VIDEOMEMORY.

iwasbiggs: Nope, same framerate. Everything works fine, except for the speed, and the sprites are displayed correctly, so I don''t think it''s a memory shortage.

/John

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!