Imagination PowerVR SDK Blog

Surface Manipulation


Hello, all!

I really need help for your implementation of D3DM.

HRESULT IDirect3DMobileDevice::GetFrontBuffer( Â IDirect3DMobileSurface* pFrontBuffer );

But MS one is like:

HRESULT IDirect3DMobileDevice::GetFrontBuffer( Â IDirect3DMobileSurface** pFrontBuffer );

How I can handle this difference?

And one more question.

I need to implement glReadPixels for one pixel. How can I achive it with your realization of D3DM? If I try to get and lock backbuffer, i get it with compressed data. And (as I realized from your header) it decompress automatically after Unlocking. But the memory pointed by pBits is already unaccessible for that moment.



Or if it will be more appropriate for you, just give me source of D3DMPCViewer.lib. That way I'll try to solve that problems by myself and then to give some feedback to you.

Best regards.


Thanks for reporting this problem. It is ok for us to solve it. We will publish a new version once this matter is understood and fixed.


Best regards.




Hi Jiteman,

I assume you’re looking at the MSDN documentation for D3DM? It does indeed have two *'s there, but in the D3DM.h file it has a single * - our header matches the header from the MS Platform SDK. It appears to be a documentation error on MS’s part.

I don’t really follow your second question. What do you mean by compressed data? If you lock a render target you’ll get the real data, most likely in either 16-bpp or 32-bpp format; you’ll need to query for the surface format to understand the data.




I think that your GetFrontBuffer realised as one ohter method from D3D9 called GetFrontBufferData.

In your version of d3dm.h we can see bool bDecompress member.

IDirect3DMobileSurface ... {


// Data to handle auto-decompression of funky formats:
bool bDecompress; // <- THIS ONE
IDirect3DSurface9 *pC; // If the format is a compressed texture, we'll Lock/Unlock this one, and decompress into the real one at unlock.
RECT Rect;


And when I lock backbuffer that member bDecompress is set to true, and buffer is almost full of zeroes except several bytes in the beginning of pBits pointed memory.

Then, in the process of relesing, feq second takes to decompress (I tought) some data. But the data is still unreachable.

To check the real backbuffer content I've rewritten piece of code with directly access to D3D9 device and D3DSurface9, and it work almost as I expect, but not fully as I expect. And the backbuffer is not empty or filled with zeroes.

What can I try in context of D3DM and without hacks?

And thank you for your attention!



I'll be waiting for it.

We unable to develop such things on device now. And it looks like we unable to test results on simulator too.

We'll try to perform some tests on Windows Mobile 5.0 emulator next week.

If I can help you with testing of particular fix, I'll be ready to do it.

Best regards.



I don't familiar with this forum engine, so...

My previous post was a reply to Carlos's post.

carlos.sarria wrote:
Thanks for reporting this problem. It is ok for us to solve it. We will publish a new version once this matter is understood and fixed.

Best regards.