Archived

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

baddrizz

read from unlocked surfs???

Recommended Posts

i was wondering if you can read pixels and or write pixels to an unlocked surf cause i''v been trying but no go and would it be safe to lock to surfs at once like src->Lock(......); dest->Lock(.......); crazy code dest->Unlock(....); src->Unlock(....); ohh and what would be the best way to make you own Blitter like Blt(.......); thx for any help that can be given

Share this post


Link to post
Share on other sites
You''re going to *have* to Lock whenever you read or write, paco. It''s really darn fast though, so you shouldn''t really worry too much, eh?

Blt in DX? You''re going to have to head for the old DX7 DirectDraw stuff: no buffer locking in Direct8. Sorry.

Oddball Software
http://zap.to/oddball

Share this post


Link to post
Share on other sites
I don''t think Lock can affect the speed of your DX application. I never heard of such thing. However, don''t expect to get fast blitting operation compared to the hardware blitting used by DX. Software blitting is too slower than hardware blitting. You''ll need to read some articles about optimization and you might need to write your blitting loop in assembly.

Share this post


Link to post
Share on other sites
What Lock() means is "lock it in a fixed place in memory so that it is not paged out while I''m trying to access it through a pointer". So yes, you need to lock it.

Share this post


Link to post
Share on other sites
Lock() most certainly can impact performance... Basically, while a VB is locked it can''t be rendered. Lock() also causes the 3d pipeline to be flushed (unless you''re using discardable buffers, which are a special case).

Share this post


Link to post
Share on other sites
also locking prevents directx from doing anything to that buffer. many locks will impact performance, juts like anything else being misused. in other words, only lock when you need to, and in that case keep it to as few locks as possible. the trick is to keeo things batched.

also NEVER lock() and read from a video memory surface unless its strictly for screen shot feature. reading from a video memory surface is very SLOW! (video busses are meant for upstream not downstream)

Edited by - a person on December 13, 2001 2:27:40 PM

Share this post


Link to post
Share on other sites