Raven_coda

I am trying to figure out why the following lines are not working.

IDirect3DMobileSurface* surface;

HRESULT res=g_pd3dmDevice->CreateImageSurface(tileWidth, tileHeight, D3DMFMT_UNKNOWN, &surface);

When I use the windows mobile 5 emulator I have no problems but when I run it off the device I get 0x8d3d0828 as my HRESULT and the pointer is NULL. I'm not sure what the is suppose to mean. From http://msdn2.microsoft.com/en-us/library/ms909140.aspx I read that it is ether going to give me a D3DMERR_MEMORYPOOLEMPTY or D3DMERR_INVALIDCAL HRESULT if it doesn't work but that doesn't seem to be ether. I test the caps for

D3DMSURFCAPS_SYSIMAGESURFACE which comes back positive. Do I have a faulty device

Any help is welcome, I'm very new at both mobile device and directx programming.



Re: Smart Devices Native C++ Development Windows Mobile CreateImageSurface error

Guang-Ming Bian - MSFT

Hi Raven_coda,

Base on my understanding, you run CreateImageSurface method successfully on window mobile 5 emulator, but not on your device. If I have understood you, please let me know, thanks.

On the IDirect3DMobileDevice::CreateImageSurface page,

If the method fails, the return value can be E_OUTOFMEMORY, or one of the following D3DMERR Values.

The following table shows the individual D3DMERR values.

Value Description
D3DMERR_ALREADYLOCKED Returned when a surface has already been locked and another lock request has been made to it.
D3DMERR_CONFLICTINGRENDERSTATE Returned when the currently set render states cannot be used together.
D3DMERR_CONFLICTINGTEXTUREFILTER Returned when the current texture filters cannot be used together.
D3DMERR_CONFLICTINGTEXTUREPALETTE Returned when the current textures cannot be used simultaneously. This generally occurs when a multi-texture device requires that all simultaneously enabled palletized textures share the same palette.
D3DMERR_DEVICELOST Returned when a device is no longer accessible after recovering from a power down.
D3DMERR_DEVICENOTRESET Returned when a lost device could not be reset.
D3DMERR_DRIVERINTERNALERROR Returned when the driver experiences an internal error that cannot be mapped to another specific return code.
D3DMERR_DRIVERINVALIDCALL Returned when Direct3D Mobile was unable to make a call to a display driver. This is generated by a parameter failure on a malformed call in the driver.
D3DMERR_DRIVERUNSUPPORTED Returned when a call does not match the devices capabilities as outlined in the capability bits (see D3DMCAPS).
D3DMERR_INVALIDCALL Returned when a problem with a parameter passed to a function or method occurs.
D3DMERR_INVALIDDEVICE Returned when the hook for a device could not be found. This is generated when an unsupported adapter ordinal is passed.
D3DMERR_MEMORYPOOLEMPTY Returned when an allocation from memory has been made and there is insufficient resources for the request.
D3DMERR_MOREDATA Returned when a buffer passed into a routine does not contain the sufficient number of elements for the request.
D3DMERR_NOTAVAILABLE Returned when a requested operation or capability is not supported by a device or resource. This is also returned when a requested format is not available.
D3DMERR_NOTFOUND Returned when a search routine has failed to return the element(s) requested.
D3DMERR_TOOMANYOPERATIONS Returned when the application is requesting more texture-filtering operations than the device supports.
D3DMERR_UNSUPPORTEDALPHAARG Returned when the device does not support a specified texture-blending argument for the alpha channel.
D3DMERR_UNSUPPORTEDALPHAOPERATION Returned when the device does not support a specified texture-blending operation for the alpha channel.
D3DMERR_UNSUPPORTEDCOLORARG Returned when the device does not support a specified texture-blending argument for color values.
D3DMERR_UNSUPPORTEDCOLOROPERATION Returned when the device does not support a specified texture-blending operation for color values.
D3DMERR_UNSUPPORTEDFACTORVALUE Returned when the device does not support the specified texture factor value.
D3DMERR_UNSUPPORTEDTEXTUREFILTER Returned when the current texture filters cannot be used together.
D3DMERR_WRONGTEXTUREFORMAT Returned when the pixel format of the texture surface is not valid.






Re: Smart Devices Native C++ Development Windows Mobile CreateImageSurface error

Raven_coda

Yes, you understood me correctly. That HResult is D3DMERR_DRIVERUNSUPPORTED but I thought I tested for that in the caps. What caps do I need to check so that I know beforehand that the device does not support CreateImageSurface.

As a side note I found a workaround. I create a IDierect3DMobileTexture and then just use GetSurfaceLevel(0, &ptSurface) to create a surface. Kind of funny that the device will support creating a texture (which is a group of surfaces) but not a single surface.





Re: Smart Devices Native C++ Development Windows Mobile CreateImageSurface error

Guang-Ming Bian - MSFT

Hi Raven_coda,

I spent some time to research the relation between caps and D3DMERR_DRIVERUNSUPPORTED. but no luck.

Sorry for that.

Best regards,

Guang-Ming Bian - MSFT






Re: Smart Devices Native C++ Development Windows Mobile CreateImageSurface error

AlexFeinman

Could it be that it's the format that it does not like






Re: Smart Devices Native C++ Development Windows Mobile CreateImageSurface error

Raven_coda

Yeah, your right. I changed the D3DMFMT_UNKNOWN flag and it then likes it. Thanks!