use filp() without Lock()ing the surface ?

Started by
11 comments, last by djsomers 22 years, 5 months ago
I think there is only one absolutely safe way to use a surface without locking it first.

IDirectDrawSurface7::SetSurfaceDesc

quote:
MS SDK

Currently, this method can be used only to set the surface data and pixel format used by an explicit system-memory surface. This is useful because it allows a surface to use data from a previously allocated buffer without copying. The new surface memory is allocated by the client application, and therefore the client application must also deallocate it. For more information, see Updating Surface Characteristics.

Using this method incorrectly causes unpredictable behavior. The DirectDrawSurface object does not deallocate surface memory that it did not allocate. Therefore, when the surface memory is no longer needed, it is your responsibility to deallocate it. However, when this method is called, DirectDraw frees the original surface memory that it implicitly allocated when creating the surface.




Edited by - burp on November 17, 2001 6:52:36 PM
Advertisement
And one time at band camp...

quote:
webmunkey

I once had a program that locked the vertex buffer around 480000 times a frame!



So, did those 480000 locks slow your engine down or what?

Edited by - burp on November 17, 2001 1:20:27 PM
quote:Original post by burp
So lock really has nothing to do with the graphics card per say, it has to do with Windows memory management.


Well, kinda. Any decent graphics card now provides video memory - that is, surface memory can be in the video card itself. However, because not all the cards do this, Windows has to be able to fill in the gap. So the card does it if it can, and otherwise it''s left to the memory manager...

Superpig
- saving pigs from untimely fates
- sleeps in a ham-mock at www.thebinaryrefinery.cjb.net

Richard "Superpig" Fine - saving pigs from untimely fates - Microsoft DirectX MVP 2006/2007/2008/2009
"Shaders are not meant to do everything. Of course you can try to use it for everything, but it's like playing football using cabbage." - MickeyMouse

This topic is closed to new replies.

Advertisement