Hi Wessam,
if the format(D3DMFMT_R5G6B5) isn't supported, why can CreateDevice go through?
I also try to repeat invoking CreateTexture passing every format which can be found in Mobile SDK, but no one return ok.
thanks for your concern.
I have done it as you say. I check if D3DMFMT_R5G6B5 is valid for the usage D3DMUSAGE_DYNAMIC | D3DMUSAGE_LOCKABLE and CheckDeviceFormat return ok, code as follow:
D3DMDISPLAYMODE mode;
HRESULT hr = m_pD3DMobile->GetAdapterDisplayMode( D3DMADAPTER_DEFAULT, &mode );
if ( FAILED( hr ) )
return hr;
hr = m_pD3DMobile->CheckDeviceFormat( D3DMADAPTER_DEFAULT, D3DMDEVTYPE_DEFAULT, mode.Format,
D3DMUSAGE_DYNAMIC | D3DMUSAGE_LOCKABLE, D3DMRTYPE_TEXTURE, D3DMFMT_R5G6B5);
if ( FAILED( hr ) )
return hr;
but CreateTexture returned D3DMERR_DRIVERUNSUPPORTED yet.
I have another question, and it's very weird when I try to use DD to create surface, because I have to use COM, and when start thread, call CoInitializeEx( 0, COINIT_MULTITHREADED ), but after this I can't create surface,if remove calling CoInitializeEx, it can create it successfully.I searched for doc, but didn't find any doc point out it.
do you know the reason?:)
I'm not sure what debugging capabilities D3DM offers, but the only thing left is to assert that the dimensions of the texture don't break through the caps of the device also. It's highly possible they have to be powers-of-two, and they most probably have an upper-limit also (probably not greater than 256x256).
Regarding your COM initialize issue, it's again hard to tell without additional info from D3D itself. On D3D9 you run your app under the debugger with D3D debug libs, and D3D will log helpful messages about every illegal operation you do with it... It would probably be a good idea to invest some time exploring if D3DM has such a facility.
Check the caps bits to see if your driver supports lockable textures (D3DMCAPS::SurfaceCaps & D3DMSURFCAPS_LOCKTEXTURE). If it doesn't, you'll have to create an image surface and use CopyRects to load the texture.
There is a debug version of the D3DM runtime that will report a lot more information when an API fails. It isn't shipped with the WM5 SDK though. It's included with Platform Builder and you'd have to enable debug zones on the target device in order to get the output to the debugger. I haven't tried this with a retail device but we use it with our Intel BSP devices all the time when doing driver development.
Thank you Wessam and Don,
I have found the issue, the reason is: demension of texture must be powers-of-two. I only used demension of image in our code, but it's not powers-of-two, so creating texture failed.
thank you once more Wessam.![]()