Search code examples
directxdirectx-11render-to-texture

DirectX 11 Minimum Texture Size


I'm working on a volume rendering program using DirectX 11.

I render both to a window ( HWND ) and to a texture ( ID3D11Texture2D ).

While the rendering for the HWND always looks correct, my ID3D11Texture2D looks corrupt for render sizes smaller than 64x64:

enter image description here

I wonder whether there is a minimum size limit for textures in DirectX 11.

Unfortunately, I was only able to find information about the maximum texture size limit.


Solution

  • There is no minimum texture size; 1x1x1 is valid.

    It looks to me like you've mapped the 3D texture and are extracting the data while ignoring the "RowPitch" returned. On textures that are sufficiently small (or of unusual dimensions) the address at which the next row of texels begins need not necessarily be contiguous after the previous row, but will instead begin "RowPitch" bytes after the last.

    See D3D11_MAPPED_SUBRESOURCE