• Advertisement

Archived

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

Accessing video memory quickly with DDraw

This topic is 6355 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 using directdraw and I do many per pixel calculations. This is always very slow unless I specify DDSCAPS_SYSTEMMEMORY when creating the surfaces. But then, all blits are extremely slow. Is there a way I can make accessing video memory faster? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Accessing video memory is always a bit slow. I dont''t know what exactly you are trying to do but here are a few tips:

- use DDLOCK_NOSYSLOCK flag when locking the surface (no use if you lock the primary surface)
- use the DDLOCK_WRITEONLY or DDLOCK_READONLY flag if possible

Try not to make your calculations directly with the surface. Allocate a normal memory block, do your calculations there and write the data once per frame to the surface (This is only useful if you have to access a certain pixel several times).

This will however not work good if you try to write a software alpha blitter or a fader or something like that, but it worked fine for my fire effect.

Share this post


Link to post
Share on other sites
I keep all of my surfaces in client memory, but I blt directly to video memory. I use asm blts, so colorkeys are still fast.

I can''t give better suggestions without knowing what you''re doing. Use MMX, since you can work with more than one pixel at a time then.

Share this post


Link to post
Share on other sites

  • Advertisement