2
Vote

Add LoadTextureFromTexture function

description

The D3DX11LoadTextureFromTexture can be used to copy from one D3D11 texture to another starting with a specific source/dest box/rect, mip level, array element, num elements. It performs necessary conversions.

DirectXTex can be used to implement something like this using CopyRectangle, but it would be useful and informative to have a more full-featured LoadTextureFromTexture in the DirectXTex library.

comments

walbourn wrote Sep 8, 2013 at 4:12 AM

The signature of the D3DX11 function this would replicate is:
HRESULT D3DX11LoadTextureFromTexture(
  ID3D11DeviceContext *pContext,
  ID3D11Resource *pSrcTexture,
  D3DX11_TEXTURE_LOAD_INFO *pLoadInfo,
  ID3D11Resource *pDstTexture
);

typedef struct _D3DX11_TEXTURE_LOAD_INFO {
  D3D11_BOX *pSrcBox;
  D3D11_BOX *pDstBox;
  UINT      SrcFirstMip;
  UINT      DstFirstMip;
  UINT      NumMips;
  UINT      SrcFirstElement;
  UINT      DstFirstElement;
  UINT      NumElements;
  UINT      Filter;
  UINT      MipFilter;
} D3DX11_TEXTURE_LOAD_INFO;

walbourn wrote Sep 15, 2013 at 9:59 PM

This would need to handle decompressing / compressing BC blocks as well, although I may limit this to only decompressing.