microsoft / DirectXTex

DirectXTex texture processing library
https://walbourn.github.io/directxtex/
MIT License
1.83k stars 449 forks source link

Add function to convert a texture to Standard Swizzle and vice versa #475

Open walbourn opened 6 months ago

walbourn commented 6 months ago

DirectXTex should add a function to convert between D3D12_TEXTURE_LAYOUT_ROW_MAJOR and D3D12_TEXTURE_LAYOUT_64KB_STANDARD_SWIZZLE.

https://learn.microsoft.com/en-us/windows/win32/direct3d12/default-texture-mapping

walbourn commented 6 months ago

https://learn.microsoft.com/en-us/windows/win32/api/d3d12/ne-d3d12-d3d12_texture_layout#remarks

Note that _pdep_u32 is a BMI2 instruction so you can count on it with /arch:AVX2.

walbourn commented 2 months ago

A challenge here is that the 'mip tails' packing is not defined, so we need to determine the way to solve this.