在DirectX中根据规则最上面的mip(最详细的),需要是4的倍数:
The formal rules of DirectX is that BC compressed images must have a multiple of 4 for the 'top-level' image width & height, but mipmaps can obviously result in non-multiple-of-4 values.
Link Stack Overflow 的答案。
Note that Direct3D will not allow a resource to be created using BC format with the top-level size set to something other than a multiple of 4 in width and height, even though it does allow the mipchain below it to not meet that requirement.
来自另一个来源。但我的理解是 Vulkan 没有这个要求。我的问题是,您显然不希望在可以卸载它并使用较低详细纹理的情况下加载最高的 mip 级别。那么我决定加载较低的 mip 级别作为最顶层,但它不是 4 的倍数,这是否意味着我不能使用该 mip 级别作为最顶层?你应该做什么?
最佳答案
当 Direct3D 首次添加对 block 压缩格式(即 DXTn)的支持时,API 强制要求纹理的最顶层的宽度和高度尺寸必须是 4 的倍数。随着时间的推移,很明显硬件必须处理较小的 block ,如 1x1、2x1、1x2、2x2、4x1、4x2、2x4,以便处理 mipmap 链。
因此,现代视频硬件无论如何都支持非 4 倍数 block 压缩表面,只是 Direct3D API 在顶级纹理上强制执行 4 倍数。事实上,许多驱动程序会毫无怨言地接受任意大小,并且只有 Direct3D 调试层会标记违规行为。
对于 Direct3D 12,D3D12_FEATURE_DATA_D3D12_OPTIONS8.UnalignedBlockTexturesSupported
可选功能指示驱动程序是否正式支持非 4 的倍数 BC 最顶层纹理。
关于graphics - block 压缩图像如何始终具有 4 倍数的第一个 mip 级别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/77165536/