Archived

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

Possibility

How to create a copy of BackBuffer in system memory?

Recommended Posts

Possibility    122
Using DirectX 8 (8.1) how do you create a copy of the backbuffer in system memory. I need to do pixel editing directly to the backbuffer every frame and need a fast way of doing it. Thanks Possibility

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Im not sure if directly modifying the back buffer is the best option:

-to directly modify a surface, it must be locked
pSurface->LockRect()

-a d3dpool_default resource cannot be locked

- therefore your backbuffer would have to be created in system mem.
- also need to use the D3DPRESENTFLAG_LOCKABLE_BACKBUFFER when creating the swap chain.

- this will probably come at a fairly serious performance cost.
(and if not on your video card, then most others)

A better way, perhaps, is to just create a seperate sysmem surface, update that one directly, then just use CopyRects() to update the relevant section on the backbuffer.

Another way is create a texture and update that directly, then render it as a quad to the screen.


experiment with them.

good luck

later
Marc

Share this post


Link to post
Share on other sites
MindWipe    940
You need to create it as any other surfaceses in the systemmemory. You can''t create a specific "backbuffer" in the smem.

And instead of flip you should do a blit from the backbuffer to the frontbuffer.

/MindWipe

"If it doesn''t fit, force it; if it breaks, it needed replacement anyway."

Share this post


Link to post
Share on other sites
Possibility    122
Yah, mindwipe, but how do you do that? I am already currently just locking the backbuffer as Anonymous Poster described and it drops my frame rate in half.

Possibility

Share this post


Link to post
Share on other sites
MindWipe    940
lol Sorry, but I thought it was about DirectX7
I have no idea how to do it in DX8. Sorry.

Good luck!

/MindWipe

"If it doesn''t fit, force it; if it breaks, it needed replacement anyway."

Share this post


Link to post
Share on other sites
CrazedGenius    156
The best way to do pixel editing in DX8 would be either with points or *anything* other than locking the backbuffer (which is very slow). What exactly are you trying to do? In almost every instance of people asking a similar question there has been a MUCH better way to accomplish the samed end goal.

Share this post


Link to post
Share on other sites
jollyjeffers    1570
D3D8 seems to have hidden much of that stuff from us... we no longer deal directly with the ZBuffer, primary surface or backbuffers as we did in DD7/D3D7... I think that''s partly to do with speed... we cant touch the backbuffer, which allows the 3D card to do lots of funky stuff to make it go faster =)

I think your best bet is to use textures/surfaces and lock those... then render them to the backbuffer as quads... but I dont think that''ll work for what you want (?)...

Jack;

Share this post


Link to post
Share on other sites
EvilDecl81    360
quote:
Original post by Possibility
Using DirectX 8 (8.1) how do you create a copy of the backbuffer in system memory. I need to do pixel editing directly to the backbuffer every frame and need a fast way of doing it.

Thanks

Possibility


You don''t. It has not been possible to directly manipulate pixels on the screen for several years now, at least not unless you want about 1 fps. If you need to reuse your pixels for something else, I suggest rendering into a texture render target and redrawing. With Pixel shaders and recycling, even very complex operations are possible.




EvilDecl81

Share this post


Link to post
Share on other sites