1
votes

I have texture, loaded from a .DDS file using the method D3DX11CreateTextureFromFile(). The DDS is created using Block Compression 1 compression, so when I query IDXGISurface1 from the ID3D11Texture2D, the pixel format of the surface is DXGI_FORMAT_BC1_UNORM.

So my question is: can I change (convert) the format of the surface to DXGI_FORMAT_B8G8R8A8_UNORM. I tried ID3D11DeviceContext::CopyResource method but it seems it is unable to convert from BC1 to 32bppBGRA.

Any suggestions are appreciated.

1
If it's just a one-off, you can convert and save in the required fromat using DxTex.exeRoger Rowland
Full screen quad (or full screen triangle) + rendertarget is pretty much the only way to go (or small compute shader, but I doubt it will be better than pixel shader in your use case, likely slower). CopyResource won't work since it's like a direct copy, not a conversion.mrvux

1 Answers

3
votes

If this is a one-time or build-time process, use the TexConv tool included in DirectXTex. If you need to do this at run-time, you can either render the image to a B8G8R8A8 render target, or use the CPU conversion code included in the DirectXTex library.