DirectXTex icon indicating copy to clipboard operation
DirectXTex copied to clipboard

Support for loading/saving 'native' premultiplied WIC content

Open walbourn opened this issue 9 years ago • 1 comments

As part of the support for premultiplied alpha, the library will load DDS files with 'native' pm alpha data and preserve it with a metadata flag to indicate this, and the DDS writer respects this as well.

The WIC loader will currently always convert to 'straight alpha' before returning the data. The majority of the WIC built-in codecs do not support 'native' pm alpha pixel formats. There are one case that could potentially store 'native' pm alpha data.

TIFF

  • GUID_WICPixelFormat32bppPBGRA
  • GUID_WICPixelFormat64bppPRGBA
  • GUID_WICPixelFormat128bppPRGBAFloat

These are all the WIC native pixel formats for pmalpha, although they are not returned by most of the built-in native codecs. They primarily exist for conversions.

  • GUID_WICPixelFormat32bppPRGBA
  • GUID_WICPixelFormat32bppPBGRA
  • GUID_WICPixelFormat64bppPRGBA
  • GUID_WICPixelFormat64bppPBGRA
  • GUID_WICPixelFormat128bppPRGBAFloat
  • GUID_WICPixelFormat64bppPRGBAHalf (WIC2+)

This work item would be to include these in the 'direct-load' DXGI mappings to avoid any conversion and then setting the metadata flag, and the converse.

walbourn avatar Jun 20 '15 01:06 walbourn

The library currently only loads DXT2 and DXT4 DDS files as 'native' premultiplied formats, as well as any DDS file written with the additional alpha channel metadata set to premultiplied.

walbourn avatar Sep 13 '16 05:09 walbourn