Regarding D3DXSaveTextureToFile

Hi,

I am working on an application that captures streams from D3D applications and then replays them. While replaying we can dump information related to the frames of our interest. In order to dump we switch to software processing mode.

Along with all the other information being dumped, we also dump textures in dds format using

D3DXSaveTextureToFileA(FileName, D3DXIFF_DDS, pTexture, NULL);

where pTexture = (LPDIRECT3DTEXTURE9) m_pTexObj->getIUnknown();

While doing this whenever
Desc.Format = D3DFMT_A2W10V10U10

D3DXSaveTextureToFileA fails with the error message
Direct3D9: (ERROR) :The format is not supported by this device. CreateRenderTarget/CreateDepthStencil failed
Direct3D9: (ERROR) :Failure trying to create render-target

I checked the supported formats using
hr = lpD3D->CheckDeviceFormat(D3DADAPTER_DEFAULT,D3DDEVTYPE_SW,pMode.Format,0,D3DRTYPE_TEXTURE,D3DFMT_A2W10V10U10);

which return NOT_AVAILALBE.

Is there anyway I can dump D3DFMT_A2W10V10U10 format textures to *.dds files.

I will really appreciate any help.

Thanks and Regards,
gullu

[1112 byte] By [gullu] at [2007-12-23]
# 1

Well, seems that D3DFMT_A2W10V10U10 couldn't be a render target in any video cards. So forget about D3DXSaveTextureToFile. You have to write your own texture writer or change format, D3DFMT_A2B10G10R10 is supported as render target starting from Radeon 9600, but unfortunately not on nVidia chips. Anyway, a texture writer shouldn't be so hard to code. In the DirectX documentation you can found the .dds file format specification that is quite straightforward. To read texels, I think that you can simply lock the surface and read its bytes.

Regards,

AGPX

AGPX at 2007-8-30 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: General...
# 2

Hi,

Thanks for your reply. There are a few things that I would like to point out.

1. D3DFMT_A2W10V10U10 can be a render targer if the device type is D3DDEVTYPE_HAL.
2. I am using ATI Radeon 1800 series.

Can you tell me why is it the case the D3DFMT_A2W10V10U10 is supported when I use device type to be D3DDEVTYPE_HAL while it does not work if device type is D3DDEVTYPE_SW?

I will start writing my own dds write. THanks for pointing me to this direction.

Regards,
gullu

gullu at 2007-8-30 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: General...
# 3
"1. D3DFMT_A2W10V10U10 can be a render targer if the device type is D3DDEVTYPE_HAL."

As far as caps viewer say the only directx rendering target formats are:

D3DFMT_R8G8B8
D3DFMT_A8R8G8B8
D3DFMT_X8R8G8B8
D3DFMT_R5G6B5
D3DFMT_X1R5G5B5
D3DFMT_A1R5G5B5
D3DFMT_A4R4G4B4
D3DFMT_R3G3B2
D3DFMT_A8
D3DFMT_A8R3G3B2
D3DFMT_X4R4G4B4
D3DFMT_A2B10G10R10
D3DFMT_A8B8G8R8
D3DFMT_X8B8G8R8
D3DFMT_G16R16
D3DFMT_A2R10G10B10
D3DFMT_A16B16G16R16
D3DFMT_MULTI2_ARGB8
D3DFMT_R16F
D3DFMT_G16R16F
D3DFMT_A16B16G16R16F
D3DFMT_R32F
D3DFMT_G32R32F
D3DFMT_A32B32G32R32F
D3DFMT_CxV8U8

Probably D3DFMT_A2W10V10U10 could be an extension supported by the device driver of your advanced video card.

AGPX at 2007-8-30 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: General...
# 4
Hi,

I have been looking into Directx Documentation and Google but have not been able to figure out the specific details related to the dds writer. Could you please refer me some documents that contains more detailed information regarding dds file format.

Thanks,
gullu

gullu at 2007-8-30 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: General...
# 5
What pool and format is your source texture?
RossRidge at 2007-8-30 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: General...