microsoft / DirectXTex

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

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

Open walbourn opened 1 month ago

walbourn commented 1 month 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 1 month 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.