R10G10B10A2 and D3DX11SaveTextureToFile

Started by
4 comments, last by japamd_br 11 years, 3 months ago
Hi gurus,

Anyone knows what it takes to make D3DX11SaveTextureToFile work with R10G10B10A2 format?

A call to D3DX11SaveTextureToFile with any destination image format except D3DX11_IFF_DDS results in 0x80004005 error.

Thanks,
John
Advertisement
It probably only supports saving textures with 8-bit RGBA formats. If you link to the debug version of the D3DX libs you might get some extra error messages in the debug output. Otherwise you could try using D3DX11LoadTextureFromTexture to create a new texture with R8G8B8A8_UNORM format, and saving that instead.
Most image formats won't support this texture format - BMP for a fact doesn't, for example.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

MJP, thank you, D3DX11LoadTextureFromTexture works.

http://img641.images...9543/ss1uip.jpg
http://img825.images.../7906/ss2gi.jpg

The only downside is that D3DX11LoadTextureFromTexture is a bit slow causing a little freeze.
Yeah it will be a little slow since it will readback the texture on the CPU, and do the conversion there. Plus there will be a delay from having to allocate a new resource. What you could try instead is pre-allocating a Texture2D with the size you need at startup, with the R8G8B8A8_UNORM format. Then when you need a screen shot, you could use a compute shader or full screen render pass to sample the R10G10B10 texture and write it out to the R8G8B8A8 texture. Then you could save the R8G8B8A8 without having to do any conversion on the CPU, or allocating any resources.
Yeah it will be a little slow since it will readback the texture on the CPU, and do the conversion there. Plus there will be a delay from having to allocate a new resource. What you could try instead is pre-allocating a Texture2D with the size you need at startup, with the R8G8B8A8_UNORM format. Then when you need a screen shot, you could use a compute shader or full screen render pass to sample the R10G10B10 texture and write it out to the R8G8B8A8 texture. Then you could save the R8G8B8A8 without having to do any conversion on the CPU, or allocating any resources.

Sorry about delayed reply... thanks again for the tip, a fullscreen render pass did the trick and it's faster than D3DX11LoadTextureFromTexture.

This topic is closed to new replies.

Advertisement