Yann wrote:Is the backbuffer a [pitch*height] bytes system memory?
That is correct.
Yann wrote:I want to use the backbuffer from PHAL instead, but it need to a lock(BeginScene) first and unlock
Correct. You should use it and you will need to lock at the beginning of a frame and unlock at the end. This works just like DirectX.
Yann wrote:So it 'may' not give me a permanent buffer right?
The returned buffer can be different each time you Lock()/Unlock() on certain devices. You shouldn't assume the same buffer will be returned.
Yann wrote:If I don't change the architecture of my game then
I will do my final offcreen -> BeginScene -> copy my offscreen to backbuffer -> EndScene
this way make a duplicate big memcpy :(
Yes, that is very inefficient. You should instead Lock() the display and use the returned buffer for drawing. This will same you a whole screen copy each frame.
I find there is a param can be set
- Code: Select all
SWAP_NONE, ///< Direct access (no buffering).
SWAP_DISCARD, ///< We don't care about the content of the backbuffer.
SWAP_COPY ///< We want to keep the backbuffer content.
6 lines; 1 keywds; 0 nums; 5 ops; 0 strs; 3 coms Syntactic Coloring v0.4 - Dan East
but I can't understand the meaning...
SWAP_NONE won't do anything, don't use it. I wanted to provide direct screen access once, but it isn't possible to do so on many devices.
SWAP_DICARD means that PocketHAL is allowed to discard the content of the backbuffer each frame. This means that you have to fill the entire screen each frame, otherwise "corrupted pixels" will appear on screen.
SWAP_COPY means that PocketHAL will leave the backbuffer intact between each frame. Typically you would use this if only small parts of the screen change each frame and you don't want to redraw everything.
This, BTW, works just like DirectX. So you can look there if you want more details.