Jump to content
  • Advertisement

Archived

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

Liquid

DirectX surfaces: system memory or video memory?

This topic is 6915 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''m adding a software rendering component to my existing project, and was wondering if anyone knew from experience what would be a better approach: 1. Create the primary surface in video memory. Create the back buffer surface in system memory since reads/writes are much faster to system memory. Each frame is rendered and then bltted (which would probably be without hardware acceleration) to the primary surface. 2. Create the primary surface and back buffer in video memory and use hw-assisted blts. Now, taking into consideration that missing the VBI can cut your frame rate in half (which most people don''t seem to realize and consequently complain that their frame rate was cut in half when they switched to system memory surfaces) would it be better to render into a system memory buffer and transfer all that data over the system bus or to create both surfaces in video memory and deal with the slower writes and have a blt that returns almost instantly? I''m not bltting from any other surfaces, my code renders directly into the back buffer. thanx, -Liquid

Share this post


Link to post
Share on other sites
Advertisement
This is for windowed mode rendering, not fullscreen. In windowed mode, you can''t have a flipping chain.

-Liquid

Share this post


Link to post
Share on other sites
Personnally I like to create both front and back buffers in vidmem. This allows for easy sync''ing to the vertical retrace and if you have borders and such you can use hw accerated blts (vid to vid mem) to copy them to the back buffer once the frame is complete. This means you need a scratch surface in sysmem that is the same size as your back buffer. pushing a whole screens worth od data over the bus can be demanding, if it applies you can use dirty-rects to ease the load.

2-cents.

hebertjo

Share this post


Link to post
Share on other sites
I think it really depends how much hardware blitting you are doing, as opposed to your own drawing routines.

If you''re not using hardware blitting from offscreen surfaces, but you are writing each pixel individually, then its probably faster to create the backbuffer in system memory. Also, if you''re using Direct3DIM to do any rendering, I think the software renderer will be faster this way.

The best way is usually to add a frame rate counter and test it both ways (it only means changing a flag)!

Share this post


Link to post
Share on other sites
Unless you are manipulating the surfaces yourself via Lock() and Unlock(), all of your graphics should be in vidmem.

You only want graphics in sysmem if:
1. you are rarely blitting the surface to anywhere
2. you are changing pixel values yourself

Share this post


Link to post
Share on other sites
As far as I know the primary surface always has to be in video memory. By specifying the PRIMARY surface flag when creating the surface you tell it to be in video memory and by making a flipping chain in fullscreen you also tell the back surfaces to be in video memory.
I'm not sure what happens in windowed mode.
Correct me if I'm wrong.

Edited by - Mr Cucumber on May 20, 2000 7:43:30 AM

Share this post


Link to post
Share on other sites
In windowed mode, you don''t use complex surfaces.
You create the primary surface, and then the back buffer separately.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!