See DXUT for Win32 Desktop Update
Differences from the original DXUT11
-
DXUT11 now makes use of the Standard C++ Library; no longer includes CGrowableArray or CDXUTStack
-
All math functionality uses DirectXMath instead of legacy D3DXMath
-
Includes new helpers to replace common deprecated D3DX usage: DXUTCompileFromFile, DXUTCreateShaderResourceViewFromFile, DXUTCreateTextureFromFile, DXUTSaveTextureToFile
-
This version only supports Direct3D 11. It has no support for Direct3D 9 or Windows XP. The following API elements are therefore no longer in DXUT11:
- DXUTDevice9.h/.cpp
- struct DXUTD3D9DeviceSettings
- enum DXUTDeviceVersion
- callbacks LPDXUTCALLBACKISD3D9DEVICEACCEPTABLE, LPDXUTCALLBACKD3D9DEVICECREATED, LPDXUTCALLBACKD3D9DEVICERESET, LPDXUTCALLBACKD3D9FRAMERENDER, LPDXUTCALLBACKD3D9DEVICELOST, LPDXUTCALLBACKD3D9DEVICEDESTROYED
- DXUTSetCallbackD3D9DeviceAcceptable, DXUTSetCallbackD3D9DeviceCreated, DXUTSetCallbackD3D9DeviceReset, DXUTSetCallbackD3D9FrameRender, DXUTSetCallbackD3D9DeviceLost, DXUTSetCallbackD3D9DeviceDestroyed
- DXUTSetD3DVersionSupport. DXUTGetD3D9Object, DXUTGetD3D9Device, DXUTGetD3D9PresentParameters, DXUTGetD3D9BackBufferSurfaceDesc, DXUTGetD3D9DeviceCaps, DXUTGetD3D9DeviceCaps, DXUTDoesAppSupportD3D9, DXUTIsAppRenderingWithD3D9 DXUTIsD3D11Available, DXUTDoesAppSupportD3D11, DXUTIsAppRenderingWithD3D11
- DXUTSnapD3D9Screenshot, DXUTD3DFormatToString, DXUTConvertDeviceSettings11to9, DXUTConvertDeviceSettings9to11, ConvertFormatD3D9ToDXGI, ConvertFormatDXGIToD3D9, DXUTTraceDecl, DXUTTraceD3DDECLUSAGEtoString, DXUTTraceD3DDECLMETHODtoString, DXUTTraceD3DDECLTYPEtoString
- DXUTCreateRefDevice9
- CDXUTXFileMesh
-
DXUT11 no longer uses the legacy DXERR.LIB or DXERR9.LIB. It includes a copy of the standalone DxErr.
-
Removed legacy functionality: DXUTReLaunchMediaCenter, SDKWaveFile.h/.cpp, SDKSound.h/.cpp
-
The
#define DXUT_VERSION
indicates the release version as a decimal number.
Building
This code is designed to build with Visual Studio 2019 or later. It requires Direct3D 11 headers from the Windows 10 SDK which is included with Visual Studio.
This library has been updated to work without requiring any content from the DirectX SDK. For details, see Where is the DirectX SDK?, Where is the DirectX SDK (2021 Edition)?, and The Zombie DirectX SDK.
Adding to a VS solution
Using project-to-project references
You can either use the Add References feature to reference the DXUT vcxproj
files in your solution, or more commonly you just add the various DXUT files directly to your project. By convention, they are put into a "DXUT" filter and this includes both Core and Optional content--only Core is 'required'.
DXUT_2022_Win10 | Windows desktop applications for Windows 7 or later building with VS 2022 Community, Professional or higher with the latest Windows SDK. |
DXUT_DirectXTK_2022_Win10 | Same as above but without the DDSTextureLoader, ScreenGrab or WICTextureLoader modules as it's assumed you'll be linking with DirectXTK which already has them. |
DXUT_2019_Win10 | Windows desktop applications for Windows 7 or later building with VS 2019 Community, Professional or higher with the latest Windows SDK. |
DXUT_DirectXTK_2019_Win10 | Same as above but without the DDSTextureLoader, ScreenGrab or WICTextureLoader modules as it's assumed you'll be linking with DirectXTK which already has them. |
For VS 2019, use of the 16.11 is required as all previous versions are no longer supported.
In your application's project settings, on the "C++ / General" page set Configuration to "All Configurations", set Platform to "All Platforms", and then add the path $(SolutionDir)\DXUT\Core;$(SolutionDir)\DXUT\Optional;
to the Additional Include Directories properties. Click Apply.
Using the vcpkg C++ library manager
The DXUT is also available through the vcpkg C++ Library Manager.
vcpkg install dxut
For the 64-bit version of the library, use:
vcpkg install dxut:x64-windows
If you are using the dxut port in the same project as directxtk, then specify the [dxtk]
feature to remove code duplication which can result in link failures.
vcpkg install dxut[dxtk]
vcpkg install directxtk
CMake
You can reference the DXUT CMake package using:
find_package(dxut CONFIG REQUIRED)
target_link_libraries(foo Microsoft::DXUT Microsoft::DXUTOpt)
If using vcpkg C++ Package Manager, then you add the CMAKE_TOOLCHAIN_FILE
path to vcpkg\scripts\buildsystems\vcpkg.cmake
. If not using vcpkg, you need to provide a per-configuration path to the installed location in the dxut_DIR
variable. Otherwise the find_package
will fail.
The MinGW linker is very sensitive to link library order. If you get unresolved symbols in the DXUT library using this toolset, then try changing the link order (first DXUTOpt, then DXUT, and then Windows system libraries). For examples of this, see directx-sdk-samples.
Direct3D 11.1
If Direct3D 11.1 is supported on the platform at runtime, DXUT will have a Direct3D 11.1 device and immediate device context available for use. If the system only supports DirectX 11.0, these two interface pointers will be null.
auto dev1 = DXUTGetD3D11Device1();
auto context1 = DXUTGetD3D11DeviceContext1();
if ( dev1 )
// platform supports DirectX 11.1 or later
DirectX 11.1 is supported on Windows 8.0 or later, and Windows 7 Service Pack 1 with KB2670838 installed. Note that DirectX 11.1 specific hardware features including Feature Level 11.1 are only available on Windows 8.x.
- Direct3D 11.1 Features
- Platform Update for Windows 7
- DirectX 11.1 and Windows 7 Update
- DirectX 11.1 and Windows 7
Direct3D 11.2
If Direct3D 11.2 is supported on the platform at runtime, DXUT will have a Direct3D 11.2 device and immediate device context available for use. If the system only supports DirectX 11.0 or 11.1, these two interface pointers will be null.
auto dev2 = DXUTGetD3D11Device2();
auto context2 = DXUTGetD3D11DeviceContext2();
if ( dev2 )
// platform supports DirectX 11.2 or later
DirectX 11.2 is supported on Windows 8.1 or later. The primary feature it provides is Tiled Resources.
Direct3D 11.3
DXUT support for Direct3D 11.3 is optional since it requires the Windows 10 SDK. To enable this support, add a PreprocessorDefine to your VS 2015 project USE_DIRECT3D11_3
.
If Direct3D 11.3 is supported on the platform at runtime, DXUT will have a Direct3D 11.3 device and immediate device context available for use. If the system only supports DirectX 11.0, 11.1 or 11.2, these two interface pointers will be null.
auto dev3 = DXUTGetD3D11Device3();
auto context3 = DXUTGetD3D11DeviceContext3();
if ( dev3 )
// platform supports DirectX 11.3 or later
DirectX 11.3 is supported on Windows 10.
Direct3D 11.4
DXUT support for Direct3D 11.4 is optional since it requires the Windows 10 SDK (15063 or later). To enable this support, add a PreprocessorDefine to your VS 2017/2019 project USE_DIRECT3D11_4
.
If Direct3D 11.4 is supported on the platform at runtime, DXUT will have a Direct3D 11.4 device and immediate device context available for use. If the system only supports DirectX 11.0, 11.1 11.2, or 11.3, these two interface pointers will be null.
auto dev4 = DXUTGetD3D11Device4();
auto context4 = DXUTGetD3D11DeviceContext4();
if ( dev4 )
// platform supports DirectX 11.4 or later
DirectX 11.4 is supported on Windows 10 (15086) or later.
D3D11_FEATURE_D311_OPTIONS4
was added to Windows 10 (14393)
Using in combination with DirectXTK
This updated version of DXUT11 includes copies of the standalone modules DDSTextureLoader, WICTextureLoader, and ScreenGrab to provide support previously provided by the deprecated D3DX11 library. These modules are also present in the DirectX Tool Kit library. If you are using both DXUT and DirectXTK in the same project, you need to remove these three modules (DDSTextureLoader.h
, DDSTextureLoader.cpp
, ScreenGrab.h
, ScreenGrab.cpp
, WICTextureLoader.h
, and WICTextureLoader.cpp
) from DXUT\Core
to avoid link errors or header-mismatch.
Removing the DXUT\Optional\SDKmesh.*
files is also recommended. Use the DirectXTK Model class instead.
You need to add the DirectXTK\Inc
folder to the Additional Includes search path for DXUT.
See this sample.
Note that DXUT uses left-handed view coordinates. Many aspects of DirectXTK default to right-handed view coordinates, but can be made to work with left-handed as well.
Dependencies
The DXUT library requires the D3DCompile DLL to be present at runtime.
-
When using the Windows 8.1 SDK . Windows 10 SDK and targeting only Windows 8.1 or Windows 10, you can rely on the
D3DCompile_47.DLL
to be present on the system as part of the OS image. -
When using the Windows 8.x SDK or Windows 10 SDK and targeting Windows Vista or later, you can include the
D3DCompile_46.DLL
orD3DCompile_47.DLL
side-by-side with your application copying the file from the REDIST folder.%ProgramFiles(x86)%\Windows kits\8.0\Redist\D3D\arm, x86 or x64
%ProgramFiles(x86)%\Windows kits\8.1\Redist\D3D\arm, x86 or x64
%ProgramFiles(x86)%\Windows kits\10\Redist\D3D\arm, x86 or x64
DXUT makes use of LOAD_LIBRARY_SEARCH_SYSTEM32
which requires KB 2533623 to be installed (already included with Windows Vista Service Pack 2 and Windows 7 Service Pack 1).
When creating a device with the D3D11_CREATE_DEVICE_DEBUG
flag, you must have the correct version of the SDKDebugLayer installed on your system for your OS.
d3dcompiler.lib
: See above.dxguid.lib
: Provides COM GUID values forIID_ID3D11Device
,WKPDID_D3DDebugObjectName
, etc.comctl32.lib
,usp10.lib
: These are required for the DXUT GUI library.imm32.lib
,version.lib
are needed when using the IME features of the DXUT GUI library.windowscodecs.lib
oruuid.lib
: Provides COM GUID values for WIC usage such asCLSID_WICImagingFactory
,CLSID_WICImagingFactory1
,CLSID_WICImagingFactory2
, etc.- For Win32 desktop applications,
ole32.lib
: ProvidesCoCreateInstance
needed for WIC.
Release Notes
DXUT currently requires that Font.DDS
be available in the Media\UI
folder. DXUTControls.DDS
is not actually read at runtime, but is included for completeness.
For Use
- Windows desktop apps
- Windows 11
- Windows 10
- Windows 8.1
- Windows 7 Service Pack 1
For Development
- Visual Studio 2022
- Visual Studio 2019
- clang/LLVM v12 - v15
- MinGW 12.2
- CMake 3.20
Related Projects
All content and source code for this package are subject to the terms of the MIT License.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.