Windows 10 中的 Direct3D 11 问题(D3DX11_IMAGE_LOAD_INFO 已删除)

Direct3D 11 issues in Windows 10(D3DX11_IMAGE_LOAD_INFO is removed)

据我所知,结构 D3DX11_IMAGE_LOAD_INFO 在 DX 11 中已弃用 Windows 8.1 及更高版本,我可以使用哪种结构来替换此结构。

D3DX11_IMAGE_LOAD_INFO 是 DirectX SDK 中 D3DX11 实用程序库的一部分。

D3DX9、D3DX10 和 D3DX11 以及旧版 DirectX SDK 都已弃用。请在此处查看 MSDN 了解完整详细信息。

根据你想用 D3DX11 做什么,这里有许多不同的选项(所有这些都是 MIT 许可证下的开源)。

  • DirectXTex 库在 D3DX 中提供了加载位图、调整位图大小和转换位图、生成 mipmap、压缩然后将它们写为 .DDS 文件的功能。对于大多数应用程序来说,在 运行 时间做这件事通常是过大的杀伤力,而且无论如何也不是特别好地利用最终用户的时间,但它非常适合编写用于纹理处理的自定义内容工具管道。 DirectXTex 包包括一个 'sample',它是使用 DirectXTex 而不是 D3DX 的古老的 texconv 命令行工具。

  • DDSTextureLoader module is intended to handle efficient loading of .DDS files and creating Direct3D 11 resources from them. It does not perform any runtime conversions, so some legacy files with pixel formats that do not directly map to a DXGI format will fail to load and in some cases the DXGI format of the file is not supported by the device and will also fail to load. For these cases, you will want to use DirectXTex to convert them offline to something that you can rely on being able to load on your target machine. This code supports the full range of Direct3D 11 resources including 1D, 2D, 3D, cubemaps, and texture arrays with mipmaps. The DDSTextureLoader module is included in both the DirectXTK 库和 DirectXTex 包中。

  • 对于非常简单的情况,在 DirectXTex 包中还有一个 WICTextureLoader module which can load standard bitmap files, does some runtime conversions and resizing, and then creates a Direct3D 11 texture 2D from it. It can optionally enable the 'auto-gen mipmaps' feature of Direct3D 11 to provide some basic mipmap support as well (standard bitmap files can't store mipmaps with the base image the way a .DDS file can). This makes use of the Windows Imaging Component (WIC), but is much more 'heavyweight' than DDSTextureLoader. This gives you less control over the quality of the filtering (particularly mipmaps), and does not support complex textures like volume maps, cubemaps, or texture arrays. The WICTextureLoader module is also included in both the DirectXTK 库。

  • ScreenGrab module is intended as a light-weight texture saver for creating 'screen shot' bitmap files from render target textures. The ScreenGrab module is included in the DirectXTK 库和 DirectXTex 包。

-- 摘自 this post

For a complete catalog of replacements for legacy D3DX, see this post. There are similar posts for samples, tools, and the DirectX components.

由于您已使用 VS 2013 标记标记此问题,我假设您使用的是 Visual Studio 2013。您应该阅读您可能想要查看的 Windows 8.1 SDK that comes with it. There's a NuGet package for DirectX Tool Kit that works with VS 2013 Update 5, as well as a "Direct3D Game" template package for VS 2013